From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

I try to acquire and record multiple channel data at two different rates.

I am using compactDAQ 9178 with thermocouple module NI 9211 and current module 9203 (both for Analog input).

 

I would like to acquire Current data for 8 channels with higher rate with sample period 100 ms, and acquire Temperature data for 3 channels with lower rate with sample period 2000 ms.

 

I am using Producer/Consumer pattern to synchronize the three loops (acquire data in 2 loops with two different period, and record data in another loop).

 

The problem is I got Finished Late with running Timed-Loop for the 8 Current channels at 100 ms period (or lower).

 

BTW, the NI 9211 module only has sample rate of 14 S/sec for 4 channels; while NI 9203 has 200k S/sec sample rate.

0 Kudos
Message 1 of 5
(3,646 Views)

Hello Shawnfu10,

 

Here I found a document that will help you understand better what the timed loop modes are and how they work so that you can better understand the behavior of your program:

 

"Configuring Timed Loops (Windows, ETS, VxWorks)"
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/configuring_the_labview_timed_loop/

 

I also suggest you to take a look to the "Timed Loop Modes.vi" LabVIEW shipping example, which can be helpful too.

 

 

Hope this can be helpful!

 

Regards!

 

>Daniel C.

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

So in a task, all the data is taken at the same time.  This is very convient because all of the data is syncronized and you know a samples are taken at the same time.  Of course the limitation is all your devices need to be able to sample at this rate, and you need to have some hardware to perform the syncronization.  For you it is the chassis doing the syncronization.

 

That's why you can't have one task with multiple sample rates.  But who says you have to do this in one task?  You can setup two tasks, at two different rates, for two different pieces of hardware.  Now the data won't be syncronized, but for this it doesn't sound like you need to know that each sample is micro-seconds apart from another devices samples.  How do you do this?  Without Express VIs, they only work for very simple tasks and having control of when and how tasks are opened and closed is what you need.  Look into the standard DAQmx VIs and use these instead.

 

Yes avoid using timed structures for this.  You don't want to rely on Windows to do your software timing.  Windows is a non-deterministic OS and you can't say for sure that you will execute at the rate you want.  But you can rely on your hardware to take the samples for you in a Continuous or Finite mode and just ask for all the samples it got since the last time you read them.

 

Also next time you might want to not include your company logo.

0 Kudos
Message 3 of 5
(3,562 Views)

There is an excellent White Paper here that will allow you to avoid using Express VIs.  You should not use Express VIs for doing anything except the very simplest of tasks, especially if you want to understand what is happening and "tweak" things.

 

As others have said, it is easy to set up two tasks that run at their own (independent) rates.  Indeed, you should use the DAQ devices (most of which have internal clocks that more accurate and less "interruptable" than the PC's clock) for timing the acquisition.  You can also do things like take 1000 points all at once, so your Producer runs less often, delivering a "batch" of points to the Consumer.

 

One thing to consider if you are acquiring data from two sources at two different rates is how you will save and synchronize the data.  Note that you can do a pretty good job of synchronization by starting the tasks together.

 

Bob Schor

0 Kudos
Message 4 of 5
(3,553 Views)
There is one other reason to use an express VI: to learn how to do something new. If you have configured and express VI to do what you need, right click on it and select the option to open its front panel. LabVIEW will warn you about doing a conversion, but just say OK.

The result will be a conventional VI that you can examine, take apart, put back together, modify and learn from.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 5
(3,537 Views)