LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed saves

What structure is the easiest to use to achieve saving of data at specific increments of time?  I've been trying timed loops but I don't quite understand their mechanics.  I have the vi attached.  If I condition the loops correctly will I be able to have data put into an array every say 10 minutes, and then saved to a file every hour?

Thanks

0 Kudos
Message 1 of 4
(2,555 Views)
I often go with a wire from a timer express VI to a case structure. With the timer expressVI there is a boolean called "expired?" I believe. Wire that boolean to a case structure, wire a recording interval to the timer, and inside the true case of the case structure put your logging steps. You may also be able to do this with an event structure, but haven't really tried it.
0 Kudos
Message 2 of 4
(2,552 Views)
I can't find the timer express vi, do you have an example of what the diagram would look like?  I'm using LabView 7.1
0 Kudos
Message 3 of 4
(2,545 Views)

First off, timed loops on a Windows machine are not what you are looking for. Timed loops are geared towards real-time systems where we can have deterministic behavior. This just isnt possible with a Windows machine. Plus, the way you have it architected now, you are going to write the same data point every time the loop iterates(besides the fact there is no stop condition)

 

Next, there are many other issues with this code other than timing a loop. You run your configuration VIs(vertical, timing, edge) ever iteration. You also open a file reference log every iteration as well.

 

What sort of resolution are you looking for here? Log every x milliseconds, seconds, minutes? I guarantee you will not get any sort of millisecond accuracy  with your current setup.

 

Your best bet is to run your acquisition at a semi-fixed rate and then use your iteration counter to determine when to write. I notice you have a 'wait until next ms multiple' but you have 20 milliseconds. I highly doubt that you are getting 20ms out of this since it there is a lot going on with file I/O, dialogues, 

 

Or, you could write your data to a local variable whenever you read it, and have a seperate loop running in parallel at a fixed rate logging that variable(keep in mind you may duplicate writes if the variable hasnt been updated in that time frame!)

 

Or you include a timestamp every time you pull in a data point (fetch measurement) and use this to determine when to write a data point. You have to keep in mind the time to actually pull the data point in as well, and also that your acquisition has a different dt every time it runs.

Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
0 Kudos
Message 4 of 4
(2,505 Views)