07-09-2012 06:14 AM - edited 07-09-2012 06:15 AM
Hello, I got a problem with time delay of the data writing into file. It also delays the data acquisition which I don't want. As you can see in my VI, I put the time delay only in the sub VI of writing data into file. However, it also retards the whole program. I want my DAQ to run at the normal speed but the data to be saved every 1s. If I remove the time delay of saving data, there will be too much data in the file. What should I change the time function? It might be the consequence of the position of the time block function.
Thank you
07-09-2012
08:05 AM
- last edited on
05-14-2025
03:17 PM
by
Content Cleaner
It is because the file save subVI is dertermining the loop speed. Look into the Producer-Consumer architecture. Basicly, your acquire and log need to be in separate loops. Send your acquired data to the log code using a queue.
07-09-2012 08:14 AM
as crossrulz said, Ive used the producer/consumer architecture for this purpose very successfully, One loop getting data then one displaying then saving to tdms. Working like a dream.
07-09-2012 08:16 AM
could you please show me how to use these functions, like creating a simple example?
07-09-2012 08:21 AM
@Bombbooo wrote:
could you please show me how to use these functions, like creating a simple example?
Search the forums for "producer/consumer architecture" and look for nuggets and/or highly kudoed threads.
Here is just one...
07-09-2012 08:22 AM
Have you read the link supplied earlier? also search the examples shipped with labvieq and this website. You should be able to modify one of the examples to fit your purpose.
let me know if you need further help tho
07-09-2012 08:33 AM
According to the link, I am supposed to move only the sub VI of data logging into a new while loop using queues? I am still confused of the process of queuing.
07-09-2012 08:38 AM
what should happen is you create a queue. Set up 2 independant while loops one above the other on the screen. In the top loop have your data capture, put the data on the queue. then in bottom loop put your save to file (or whatever you want to do with the data. (dequeue data, process). The loops will run independantly of each other ad infinitum so you will need a stop mechanism of some sort. Best bet is look at examples and work out how they work.
07-09-2012 08:45 AM - edited 07-09-2012 08:48 AM
My question is that my data output from the main data stream is cluster, but the input of enqueue element is string. Do I need to extract it before plugging into it? There are also more than one outputs to be wired to the SubVI "Write to file" but there is only one input of an enqueue block function.
07-09-2012 09:56 AM
here is the modified version with using queuing process (not sure if it's correct but I already followed the instructions). The problems now are the data acquisition is so delayed, and only the first value is saved in the file. Are there anything wrong with my modified VI?
Thank you for helping 🙂