LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Log Data over a certain period of time without Stopping The program

I built a Program that Utilizes NI cDAQ-9179 and 9 NI9203 Moduals to get readings from several different Transducers. This program collect/store data that is being recorded off 7 different inverters. Everything seems to work as how I wanted, but the only thing I cant figure out is how would I keep recording data with a specified time on when the data would be dumped. So basically I want my program to collect data for 5 hours then dump the recorded data, after 5 hours the program keeps recording and starts the process over again.

I will include my program as well but be warned it is messy 😄

 

Thanks in advance!

0 Kudos
Message 1 of 8
(4,483 Views)

You can use Elapsed Time Express VI with the time set to 300 seconds (5 Hours) and connect Boolean TRUE constant autoreset.

-Use the Time has Elapsed boolean,which becomes true when the elapse time is more than 300 seconds you can dump the recorded data.

-You can also use two Get Date/Time In Seconds and shift register to get the time elapsed and save the data.

Thanks
uday
0 Kudos
Message 2 of 8
(4,428 Views)

@udka wrote:

You can use Elapsed Time Express VI with the time set to 300 seconds (5 Hours) and connect Boolean TRUE constant autoreset.

 


Hmm.  60 seconds = 1 minute, 60 minutes = 1 hour, so 300 seconds * 1 minute/60 seconds = 5 minutes, and 5 minutes * 1 hour/60 minutes = 0.0333 hours.  Oops.  You probably meant 5 hours * 60 minutes/hour * 60 seconds/minute = 18000 seconds.

 

Bob Schor

Message 3 of 8
(4,422 Views)
Oops :P, You are right. I just calculated in minutes while writing post and then forgot to make it to seconds. Thanks for the correction.
Thanks
uday
0 Kudos
Message 4 of 8
(4,421 Views)

@udka wrote:
Oops :P, You are right. I just calculated in minutes while writing post and then forgot to make it to seconds. Thanks for the correction.

But starting in minutes is a good idea while developing the VI.  You can find out in 5 minutes whether what you did is right rather than waiting 5 hours to find out it didn't work.  Smiley WinkSmiley Tongue

Message 5 of 8
(4,412 Views)

Here is something you might want to consider.  You described a program that runs for "many hours", continually generating data, and every 5 hours you want to take the accumulated data and save it to a file (and, I presume, also delete the saved data and start building the data array all over again).

 

What if, say, at 4 hours, your computer crashes?  Nothing is saved.  Here are some ideas that will probably allow you to "Have your Cake and Eat It, Too".  Note that I assume that you have a unique naming scheme for each of the "Five Hour" records, and you "know" this name and update it when appropriate.

  • Every hour (or at an interval that seems appropriate to you), write the (probably not-yet-complete) data record to disk, over-writing any earlier file with the same name.  This ensures that "First Saved Data" is up-to-date at 1 hour, 2 hours, 3 hours, 4 hours, and 5 hours, after which time you'll start writing the next-named file.
  • If you don't want to over-write "old" data, and know where the "new data" starts in your saved data array, you can, instead, open the (growing) data file, position yourself at the end, and write the "new data" before saving the file.  This requires a little more bookkeeping on your part, but involves less disk I/O.
  • Consider using a Producer/Consumer scheme so that writing to disk won't seriously impact the rest of your program.
  • If the data are coming in sufficiently slowly (say, every few seconds/minutes), you can combine the last two techniques to keep the data "fully written" but "fully crash-proof" by sending every data record to the Consumer, and have the Consumer use the Open-Go to EOF-Write-Close scheme.

Bob Schor

 

 

Message 6 of 8
(4,397 Views)

Can you give e detail on how to do this?

0 Kudos
Message 7 of 8
(391 Views)

Why don't you describe fully what you want to do, and provide the LabVIEW code that you think will do it. I assume you know LabVIEW, and have some experience with writing data to disk.  If not, stay awake in class and pay attention when File I/O and the functions on the File I/O palette are discussed.  There are also other forms of File I/O, including the Report Generation Toolkit for Excel and Word, XML, TDMS, and other types of data records that might be more appropriate for your application.

 

If you are, however, just learning LabVIEW, be patient.  You could open the File I/O palette, look at some of the Functions in it, read the detailed Help descriptions on the ones that seem relevant to you, and check out the Example LabVIEW code that is listed for most of them.

 

Bob Schor

0 Kudos
Message 8 of 8
(383 Views)