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 spreadsheet at regular intervals and optional manual interval selections

Hi ppl, need help!

 

I have a simple vi that constantly acquire data and displays in a graph/chart (just to view in runtime). The expt runs for 14 days.

 

1) how do i time the VI it to run for 14 days?  and

 

2) I need to be able to write the constantly acquiring data to a spreadsheet at regular intervals like, only 30 secs of data every 8 hrs for 14 days (without express vi's) in order not to flood my harddisk writing 14days of data

 

3) also I need to be able to write data to spreadsheet in between the above specified intervals manually while VI is running , like , i can select 45 seconds of data at that instance and then write to spreadsheet.

 

4) each data entry (30 sec of data) should be seperated/spaced and have a header that shows the date+time info  at which it was acquired and also how can i make the spreadsheet to have the date+time  on each value that is on the spreadsheet

 

would be greatly thankful to you

 

thanks a ton

freemason

 

0 Kudos
Message 1 of 18
(3,834 Views)

Here are some suggested ways to handle each problem:

 

1) Take the current date/time and add 14 days, use a while loop to run the measurements and display, stop looping when the current date/time is equal to the calculated end date/time

2) Inside the while loop use a "Delay (ms)" VI and wire it to a control or constant to set it up for 30secs (or whatever you want)

3) Need you to clarify this part a little.  My recommendation is to right data at every interval

4) Use a "Write to Spreedsheet File.vi" VI to write each row.  This VI takes an array of your data.  The first element in the array can be a timestamp.

0 Kudos
Message 2 of 18
(3,818 Views)

thanks joshjack,

 

i got the 1) ans

 

2) using a delay inside while loop will acquires data at those multiples ( lets say 5 ms) continously for 14 days and just display on a front panel so that i can look what's happeneing that is fine, but my main aim is to write only those 30sec of data every 8hrs until the end of expt to a spread sheet while it acquires nonstops ( only the writing to file part has to be timed)

 

3) while the writing to file part at above said intervals is happening silently behind scenes, i still need to be able to poke into vi and write some random data (ex:45 secs) whenever i wish and save them as seperate files

 

0 Kudos
Message 3 of 18
(3,808 Views)

I was thinking that maybe a case structure might do the job...  If you have a case structure, which is linked to a boolean control (i.e. T/F), then, when the button is not pressed, (i.e. False), the false case should be empty (the inside of the case structure when set to false should be empty).  When the button is pressed (i.e. set to true), the true case should have a write to file command.

0 Kudos
Message 4 of 18
(3,800 Views)

For the data recording use a case structure around what you want to happen every thirty seconds. Use the express VI timer (im not sure if thats the actual name but its in the timing submenu of the function palette) which has the option to set a count down time. Set that to 30 seconds, set reset to true, and wire it to the case structure. Whenever the 30  seconds is up, your case structure will be true and the data recording inside it will run.

 

http://digital.ni.com/public.nsf/websearch/05A9C3B0A4D5A7638625712B006FB30F/$FILE/Elapsed%20Time%207...

heres a picture of the express VI so you know what to look for. Just add the 30 secondsof data to an array outside the case structure, then have it write to spreadsheet file inside the case structure and it will write the 30 seconds of data at once. 

 

Question though, how frequently are you recording the data during the 30 second interval? Every 125 ms every 5 seconds, every 15 seconds etc before writing to your file? You should have some sort of time delay in your loop so it doesn't become greedy Smiley Happy 

Message Edited by for(imstuck) on 01-13-2009 11:10 PM
Message Edited by for(imstuck) on 01-13-2009 11:16 PM
0 Kudos
Message 5 of 18
(3,779 Views)
As for recording data in between the 30 seconds you can use a boolean control and an OR. If the countdown timer reaches zero OR the boolean is switched to true it will turn the case structure to true and record the data.
0 Kudos
Message 6 of 18
(3,774 Views)

Is the attached what you are looking for?

 

You will need to do something so your shift registers dont fill up if you are taking data that frequently for 14 days.

 

Download All
Message 7 of 18
(3,741 Views)

thank u so much

 

im working on it and few different examples in other threads,

will ping u in a while

 

thanks

0 Kudos
Message 8 of 18
(3,712 Views)
you may also want to get the array sizein order to reshape it to the correct number of rows rather than use the counter. This would be useful if you weren't adding data to your array with every iteration of your loop.
0 Kudos
Message 9 of 18
(3,707 Views)

this works, but i need something like this

 

+__________________+___________________+_________________+............................................14 days

0            8hrs                 8                8hrs              16             8hrs            24

|30sec|                         |30sec|                            |30sec|                         |30sec| 

 

every 8hrs i need to able to write up 30secs of data and continue the operation until the end of expt (14 days)

 

I was trying with 2 elapsed time vis, one countsdown 8hrs ,when elapses it should trigger another 30 sec timer which will enable those 30s of of writing and continue again for 8hrs.( it should not stop, it should reset again and wait for the 8hr timer to set it) but i am very much stuck with these timers, 

 

any help would be appreciated

0 Kudos
Message 10 of 18
(3,687 Views)