LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save data: how prevent loose of data when a blackout occur?

Hi,
I'm in trouble. My vi acquire data from a DAQ board and save it into a .txt file. The vi runs continuously saving data in a file created by itself. Here we have many energy problems and my acquisition system can be turned off when we have a blackout . The problem is that I'm losing data, even the saved one in the file, when those blackouts occur.
I'd like to keep the information acquired saved in the file when it happens. Is it possible?
 
Thanks,
Juliana
0 Kudos
Message 1 of 16
(3,997 Views)

How fast is your sampling rate? If not too fast then you can open the file, write the data, and close the file. Repeat for each sample. This would minimize the opportunity for a file to be corrupted. But if power outage arrives while file is open you may lose data or corrupt the file.

Ideally, get an uninterruptable power supply with enough capacity to power your system for as long as needed. Of course if power is off then the data you are collecting may be useless if whatever you are monitoring looses power.

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 16
(3,986 Views)
I've already tried it, but nothing change. When i turn off my computer i loose the file...
 
Thank you anyway.
Juliana
0 Kudos
Message 3 of 16
(3,975 Views)

There's a whole lot of possibilites

If you have a UPS, then you can probably monitor it for when it switches to battery. Immediately close and save the file.

You should probably be writing to a series of files instead of the same one. Switch files periodically so that you have at least some data saved.

Don't write to a text file. Instead write to a database on a server that is well protected by a UPS. Even if you open and close the database connection with every write, I don't think that will take much longer than writing to a text file. Choose a robust datadase such as SQL Server, Oracle, or MySQL and get your IS department to help.

0 Kudos
Message 4 of 16
(3,961 Views)
Juliana,

Suppose you create a file with another program, such as a text editor, save it, close the file, and then shut off the computer (as in a power outage). Does that file exist when the computer is restarted? This will help. isolate whether the problem is with the computer OS or hardware or with the LV program. If it seems to be LV related, try making two files. Write data to one for some time period. Close that one. Then open the other file and write to it for a while. Switch back and forth from time to time. (Perhaps use one file during even numbered minutes and the other during odd minutes). After an outage, see if one file exists and the other does not.

Post a copy of the portion of your program which handles the files. Maybe someone can spot something in it.

Lynn
0 Kudos
Message 5 of 16
(3,957 Views)
A technique I've used on files that remain open during a long data acq was to call the "File Flush" function after each write.  On a couple occasions we had PC crashes and found that the data file was intact right up until the reboot.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 6 of 16
(3,935 Views)

I'd like to thank you all for this tips. I've tested some of them and I'm going to use the flush file function and create a backup file.

Thanks again

Juliana

0 Kudos
Message 7 of 16
(3,906 Views)
Ok, people, the word you're looking for is "LOSE"...LOSE your data, not "LOOSE" your data. Sorry, I know this is anal, but we ARE writing English and it's really wierd how many people I've noticed lately doing that, and, omg, TWO people in this thread did it.


lose (lz)
v. lost, (lôst, lst) los·ing, los·es
v. tr.
  1. To be unsuccessful in retaining possession of; mislay: He's always losing his car keys.

loose (ls)
adj. loos·er, loos·est
  1. Not fastened, restrained, or contained: loose bricks.



0 Kudos
Message 8 of 16
(3,858 Views)
omg?indifferent smiley
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 9 of 16
(3,832 Views)
OH Like you have never misspelled a word in your life. Smiley Very Happy And just because most of everything in this forum is written in english does not mean everyone on the forum can spell every word in the dictionary correctly or use use it in proper context including you. If your going to post things to the forum, MAKE THEM MEANINGFUL OR FUNNY AND WORTH READING. swmt.



Joe.
"NOTHING IS EVER EASY"
Message 10 of 16
(3,823 Views)