LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview realtime file write query

I am writing a data logger application in labview realtime 8.2.1. I am concerned that if I turn the power off during a data write cycle all the data I have stored will be lost.
I am planning to have a single log file for the data, and to append the new data to the end of it every few seconds. This is to minimise the number of times I am needing to write data to the storage device. In this case it will be a USB stick.
 
Tom
0 Kudos
Message 1 of 5
(3,942 Views)

hi there

if you are using the file IO functions try the "flush file" function. This funtion forces the OS to write the data to the medium (at least at high level OSes, i don't know about NI-RT, but i'd try it) if this function does not work try to close and reopen the file every few seconds, this also should force the OS to write the data to the medium.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 5
(3,940 Views)
If you're using PharLap, you can use the TDMS file format. It comes with a "flush" function, too (not supported on VxWorks right now).
Herbert
0 Kudos
Message 3 of 5
(3,913 Views)

Chris,

Thanks for the comments. I'm not sure if I explained myself very well.

What I am concerned about is what happens to the data file if the power to the system fails during a file write. I am intending to append data to the end of a log file every few seconds, to co-encide with GPS information. I am not too worried about loosing the current data, but I am concerned about what happens to the existing data in the file.

 

Regards,

 

Tom

0 Kudos
Message 4 of 5
(3,868 Views)

to make sure that you don't loose data the data has to be written to the medium PHYSICALLY (not only virtually). this can be done by flushing the file or by a close/reopen-operation.

it's about 10 years ago since i saw the last (LV written data-)file that was corrupted due to a system breakdown during a write operation. the worst case scenario would then be the loss of all data since the last flush or close/reopen.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 5
(3,865 Views)