From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing samples with analog boards using DAQmx driver

Dear all,

I have an application using:

Software:

-LabView 2014

- DAQmx 15.5

Hardware:

- cDAQ 9174 (4 slots) link to a computer
    - NI 9234 (+/- 5V)
    - NI 9230 (+/- 30V)
    - NI 9211 (Temperature measurements)
    - NI 9862 (CAN)
- NI PCI RS (8 ports)
- NI PCI 6353 (Multifunction board)

 

Boards from the computer permit to drive a test bench (electronic load - current generator...)

cDAQ module is used for measurements, that are saved in .txt file.

 

The  problem concerns board 9230 and 9234.

These boards have to be synchronized, at the same sample rate --> No problem (sample rate chosen: 3011 samples/channel/second).

The aim is to have one measurement every ms --> it means the average of 3 points (I don't care about the exact value (3.011) because I recalculate the exact time with the sample rate. I just have to know how long time I have integrated the value and the value itself.)

If I want to change the integration time, I will change the number of points to average, not the sample rate of the boards. It means the boards will have the same sample rate for the whole test (can last until 1 month).

 

From the other side, I will create a profile with an analog output  that drive electronic loads.

This profile is generated exactly as I expected (after verification of the command sent and the output of the electronic load on oscilloscope). Response time of the electronic load is below 1ms.

 

Problem:

- the program is generating the profile and the boards are measuring at the speed of 3kS/s. I am saving all the points in a file result.

To be sure to save all the points, I am using a producer/consumer loop and I will read all the samples.

When I change the sample time (meaning I am changing the number of points to average and not the speed of the boards), I have to get back first all the samples available per channel in the boards with the previous sample rate (If the number of samples is 10, it means that these 10 points have to be averaged with the previous sample rate).

However, when I am doing this operation and when I compare with the oscilloscope, the number of samples available is lower than expected and I miss measurements. More explanation with a graph are provided in the document linked (as well as the code)

 

Does anyone has an idea about how to solve this problem?

Where is the information that I am missing?

 

Any help will be really appreciated on this topic.

 

Kind regads.

0 Kudos
Message 1 of 2
(2,497 Views)

First of all, always post code, not screenshots unless you talk about very limited functionality. Nobody is able to follow your description just with 5 (or so) screenshots being unable the run the code, set probes and stuff.

 

If you configure a continuous acquisition and do not fail to read values on time (e.g. not running into buffer overflow), you will not lose any acquired data.

That being said, the 'virtual loss of data' has to be inside of your code.

Please notice that once you call DAQmx Read, all data inside the driver buffer is transferred into the data space of your application. DAQmx buffer do not retain a history for you.

So when changing the number of samples for averaging where you require some sort of history, you have to maintain a buffer of data inside your user application. Looking at your screenshots i cannot tell if you already do this or not. I assume that you don't.

Another note is that changing the averaging changes the "timebase". So using a simple graph does not reflect proper time relation of the data. You have to create appropriate data (time - averaged values) for an XY Graph.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 2
(2,439 Views)