Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when logging status to text file

Dear all,

 

I am facing following issue while developing a Labview Real-time application for compactRIO. I would like to log statusses and errors into a .txt file and therefore use the code below. This code appends a new line, including date and time string, on each occurring event. The code below works as expected on my computer, but does not function properly on the compactRio.

 

When I execute the code on compactRio (I tried it for several different file paths), the first time the file gets created and the string is written into the text document. However, the second event is not appended to the text file as it should. It is just the first line that remains in the text file.

 

Does anyone of you have experience with this and give me advice on how to solve this issue?

 

Kind regards,

Giel Van den Broeck

0 Kudos
Message 1 of 3
(4,349 Views)

1.  Your read doesn't make any sense at all.  If you want to read what you just wrote, then you need to move the file pointer again.

2.  I would make a seperate loop that does nothing but the logging.  The idea here is that you leave the file open until your test is done and then close it.  Use queues to send commands and data to that logging loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(4,340 Views)

While I agree there's probably a logic error in this code snippet, that doesn't explain why the behavior's different on the two platforms.  One possible cause would be an upstream error on the error cluster wire.  Nothing will be written if there's an incoming error, but there's not enough code snippet or information in your post to determine the origin of that wire.  Have you run the code in interactive mode (click the run arrow on the top-level VI under the RT target's namespace) and used LabVIEW's built-in tools to troubleshoot?  The RT Debug String can also be used to instrument the code then NI Web Based Configuration and Monitoring can view the debugging information.

-Steve K

0 Kudos
Message 3 of 3
(4,330 Views)