LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET CAN - Signal In Waveform session: unexpected and "fake" samples

Hello,

I need to acquire CAN signals by using a CompactDAQ and a NI-9860 module. These signals will be handled together with DAQ signals.

As requirement, these signals (both CAN and DAQ) must have the same sample frequency (let's say 1kHz). For this reason, I'm using an XNET CAN - Signal In Waveform session which resamples the received signals in order to obtain a "constant-rate sampled signal". 

 

My acquisition is configured as follows:

  • Resample rate for the XNET-CAN session = 1 kHz
  • Sample to read per read: 100 samples.
  • Timeout for reading = 10 seconds.

So, to simplify, the loop runs at 100 ms and every read should return 100 samples. See the code below for details.

 

 

 

canAcquisition.png

 

 

 

For testing, I'm writing a 50-Hz sinusoidal signal on the CAN bus and I can read this signal correctly.

But..

Quite frequently, the received sin signal contains wrong values. In these cases, the received package contains 100 samples (as exptected) but the last  3-4-5 samples are a repetitions of the last valid sample. It performs a sort of 0-order interpolation (as reported in the following figure).

daq-can_panelScreen.PNG

 

I know that the Signal In Waveform session resamples the received data in order to return the desired resample rate. 

In this cases, I believe that, when the read request is sent, the last 3-4-5 samples are not available yet . So, the XNET session replicates the last valid sample in order to reach the desired number of samples for the package (in my case 100 samples).

 

For me this is an unexpected behaviour because there is a large timeout.

From help: "Timeout is the time to wait for number to read samples to become available.[...] If timeout is positive, the XNET Read (Signal Waveform) VI waits for number to read samples, then returns that number. If the samples do not arrive prior to the timeout, an error is returned. [...]"

 

I'm using 10 sec timeout. So, if 100 samples are not available when the read request is sent, the read VI should "wait" until all the requested samples are available (or until timeout reaching).

 

I've also check the received frame with a Frame In Session. I wanted to be sure that samples were actually sent on the CAN bus. The following figure compare the received data with a Signal In Waveform session (red plot) and the Frame In Session (white plot). All the samples in the sin period are actually sent on the CAN bus.

 

 

 signalIn_Raw_compare.PNG

 Am I missing something? It this a bug?

 

 

 

 

0 Kudos
Message 1 of 1
(446 Views)