LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rt- Writing to TDMS every hour

Solved!
Go to solution

Guys,

I don't know if this helps but if i remove the wait function and unwire the error of tdms nodes from stop variable. the second file still gets created but only the first line get written( which is the right data)  and nothing else( the corrupted data)! Meanwhile i had probes all over, at every case on the error wire, and it looks like the problem happens right after "TDMS open" in "CREATE" case structure! the error message is not very helpfull :

 

Error 6 occurred at TDMS Open in main.vi

Possible reason(s):

LabVIEW:  Generic file I/O error.

 

PS: it doesn't matter where i put the wait function in "CREATE" or "CLOSE" case structure both of them do the same thing!!!

 

Thanks

Persol

0 Kudos
Message 11 of 15
(1,155 Views)

Hello persol,

First, about adding a "TDMS Close" node. Please have a look at your writing while loop, we assume the VI had closed the first file, and began to write a second tdms file, at this point we press the Stop button on the front panel, the sequence looks like:   


Open second tdms file --> Write data --> Write data --> ... --> Stop pressed --> VI stoped.  (Question: where is the second file closed?)


So I suggested adding a "TDMS Close" node after the writing while loop ends, please refer the the snapshot in attachment, you'd also make sure the close node was executed and returned no error.

 

 

I attached the modified VI, I saved the VI for LV2009 version which is the same LabVIEW version as your attached VI, I think you could use it directly in your Monitoring.lvproj. Changes were made based on your VI:
1. Removed all hardware stuffs and replace them with made up numbers.
2. Removed waiting 1 second.
3. Add "TDMS Close" node outside the while loop.
4. Write to a new tdms file every 60 seconds.

The generated tdms data files are also in attachment.

 

Download All
0 Kudos
Message 12 of 15
(1,146 Views)

Tianbin,

Thank you for your explanation.

This is really weird, I ran the same VI that you sent me but  I don't get the same output files as you get, the VI again stops when creating the second file without writing anything to it!!( see attached)

 

The error code is:

Error -2506 occurred at TDMS Open in mainasd.vi

Possible reason(s):

LabVIEW:  LabVIEW failed to read data from the TDMS file.

 

Thanks again

Persol

0 Kudos
Message 13 of 15
(1,127 Views)
Solution
Accepted by topic author persol

Persol,

 

I was running that main.vi with LabVIEW 2012(plus Real-Time module) on a cRIO-9024, the cRIO-9024 OS is VxWorks. I noticed you were using a cRIO-9074 according your lvproj, but I'm not sure which LabVIEW version you are running.

 

Also the error code -2506 doesn't make sense to me, since you are creating a brand new file, it should contain no data at its open time(the error code -2506 is for failed read operations), so I would suggest that you change the current "open or create" to "create or replace" in "CREATE" case , this can forcibly write a new file from zero byte. In case sometines the file with same name already exists on your cRIO target, this option can help you clean old data and write a new file from beginning.

 

Although this may not solve your data missing/corruption problem, but I think it still worth a try! 🙂

 

Regards,

Tianbin

0 Kudos
Message 14 of 15
(1,113 Views)

Tinabin,

The good news is it is working. but it is very puzzling as why it is working! because i can swear i had changed "open or create" to "create or replace" before and it wasn't working but now it is!!!

Nevertheless thank you very much for your help. The VI is doing what i wanted so this would be the solution.

 

Persol

0 Kudos
Message 15 of 15
(1,091 Views)