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: 

write to csv to occur after a specific time interval

Solved!
Go to solution

Thanks GerdW for the feedback .

 

- the consumer loop should run as fast as possible: it will use the Dequeue function to wait for new data packets. Never have the consumer run slower (in your case 8 times!) then the producer!

 

Actually the requirement was to not write every movement but after every 2 seconds (after a user defined time frame) to check the postion of controller and record it ,  that is the reason i was not so sure about the consumer producer solution .Also as it involves 2 different loops.

 

0 Kudos
Message 11 of 17
(1,233 Views)

I think what we have here is a failure to communicate. What you need is incredibly simple because you're just ignoring the data that isn't written to file, not "delaying the csv function". All you need is a case structure and a timer.

Single Loop Write Data.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 12 of 17
(1,195 Views)

James 

I tried this , but  The elapsed time is getting affected by the main while loop wait time ,for e.g like at present it is 100 ms .But if the main loop time is 2 sec .The elapsed time will slow down aswel .Can this be avoided? If yes then this is just what i want avoiding the second while loop 🙂 

0 Kudos
Message 13 of 17
(1,191 Views)
Why would your acquisition be slower than the saving? What would you accomplish by doing that except writing duplicate data?
0 Kudos
Message 14 of 17
(1,180 Views)
Solution
Accepted by RaunakBahri

There should be no reason for your main loop to be running at a 2 second period. You can alter other parts of your code with case structures like this if you need to slow them down, but you will always be limited by your loop rate, so don't go so slow.

 

If you are required only 1 loop, then the above is your only option.

 

 

This is all basic dataflow, so you really need to look in to better understand how dataflow works in LabVIEW. LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. Here's a simple resource to become more familiar with how it works. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 15 of 17
(1,174 Views)

Dennis : I do not wish to have acquisition loop slower , i was just saying that it affects the time elapse function . 

James : I get your point so as of now i have implemented the Producer consumer logic only 🙂 . Thanks for your input , learning labview long way to go 😄 

0 Kudos
Message 16 of 17
(1,157 Views)
Of course it affects it. That's basic. If a loop iterates slower than the setting for the elapsed time, there is no way for the elapsed time function to read faster.
0 Kudos
Message 17 of 17
(1,142 Views)