09-29-2021 03:11 PM
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
Solved! Go to Solution.
09-29-2021 03:52 PM
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.
09-29-2021 10:58 PM
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.)
09-30-2021 09:29 AM
Thanks for the reply! Using continuous grabs instead of N Samples worked. I'll play around with the Start Task as well.