Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Frames conversion with NaN as Default value change

Hello all,

 

Please let me know if anyone knows about this.

 

Currently I’m using XNET Convert.vi to convert CAN Frames to Physical values. Here, everything is working fine.

As per NI XNET user manual, if CAN Frames are not present for selected Signals then it will displays “Default value” (from DBC File).

But, It could be more helpful, if we can display NULL/NaN (Instead of Default Value).

Because, some CAN signals will output only zero/one (High/Low) so,

 

For example:

Case-1:  If CAN Frames is present --- > Output value : “0” (as per Signal Data)

Case-2: If CAN  Frame is not present -- > Output value: “0” (Default Data)

 

In case-1 & case-2 displaying same value so, we will get confuse.

we have to differentiate both.

 

Please check this sample code and DBC File:

Here,

  1. If I’m passing Default value as “NaN”  then I’m getting Error (i.e. -1074384895).
  2. If I’m passing any other value and value is less than max value then it’s returning correct value.
  3. If I’m passing default value is greater than Max value then its returning default value is max value.
Munna
0 Kudos
Message 1 of 3
(5,428 Views)

I totally agree, which is why I went and wrote a LVClass wrapper around the conversion routine, which defaults values to NaN if the frame that signal is associated with isn't seen.  It isn't too hard just find for all signals, the arbIDs of the frames they belong to. Then after doing the conversion if that frame doesn't exist, replace the value with NaN.

 

EDIT:  Oh and do you need to do the conversion your self?  Can you just read signals as XY?  Then you get the value of the signal, and the time it was seen.  

0 Kudos
Message 2 of 3
(5,415 Views)

Dear Hoovahh,

 

Thanks for your reply.

 

Yes, If NI XNET is not working for this then we need do some workground (like you told). I'm also thinking same way, in Array of CAN frames we need to find where Signal ID is matching (Index value) for each Signal then need to replace with NaN.

.................................................................................

EDIT:  Oh and do you need to do the conversion your self?  Can you just read signals as XY?  Then you get the value of the signal, and the time it was seen. 

..................................................................................

 

Yes, I'm doing by my self. I'm converting all Vector files to Physical values. I'm simply displaying Time & Corsponding values. If Signal value is not present then taking prevoius value.

 

 

 

 

 

Munna
0 Kudos
Message 3 of 3
(5,406 Views)