LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulated NIDAQ timing is off

Solved!
Go to solution

Hi all - I have a timing question for writing a "simple" data acquisition, file writing, and display of values task. This will ultimately be on a cDAQ9178 using voltage, strain/load cell, thermocouple, and multipurpose (4-20 mA) modules with lots of channels on each module, and each module at different speeds since (for example) the max speed of the thermocouple module is a lot slower than the minimum speed of the load cell module. I'm starting small (and, thanks to COVID, outside the lab using NIMAX simulated channels) with two modules, a two channel thermocouple and two channel voltage simulator.

 

Except my small model has problems. As far as I can tell, my producer loop should run on a 100 ms period, acquiring 2 TC data points at 20 Hz and 5 voltage points at 50 Hz (2 channels each). But when I looked at my data file, there was a ~120 ms gap between sets of data points. I added a couple "Get Time Stamp" commands on the producer loop to see how long it runs for . . . and it runs around 150 ms per loop.

 

What am I missing? Why is my producer loop taking 50% longer than expected to run? And how do I fix this?

 

I'm attaching my code in LabView 2018 and a NIMAX file (it's the only file in the .zip; apparently we can't upload NIMAX exported files?) that should have my simulated device info.

 

Thanks in advance for your help - John

Download All
0 Kudos
Message 1 of 4
(1,669 Views)

I didn't get to review your code, but in general, as the name suggests "Simulated" is not a replacement for hardware and does not emulate the hardware timing exactly.

 

Please do not expect the code developed with simulated instruments to work with actual hardware as the simulation feature does not mimic the hardware 1-1.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 4
(1,659 Views)
Solution
Accepted by topic author John_Easton

I do not use NI-MAX tasks; I dynamically make a task in a program. So this is only a guess here as I looked at your task.

 

You are constantly starting the task in the loop, you have a finite acquisition, so once the task is done it stops, then it must restart. A task starting/stopping multiple times in a loop will have some overhead.

Make the task continuous and grab your points.

Use DAQmx function to create your task, that way you can better control the stop and start of the task, as I have no idea of MAX tasks are imported to LabVIEW. (Maybe you can use the MAX task but explicitly put start task or commit task then start task OUTSIDE the loop.)

Message 3 of 4
(1,634 Views)

Thanks for the reply! Using continuous grabs instead of N Samples worked. I'll play around with the Start Task as well.

0 Kudos
Message 4 of 4
(1,613 Views)