LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What's the best way to make a "status" in LabVIEW?

Hi, when I have large LV programs I often want a "status" text box on my front panel so I can both (a) See what the state the program is currently in when it's running, and (b) Save to file the history of these states, for use with debugging and analyzing results.

 

I've done this so far in a way that works, but is obviously pretty derpy. I basically create a blank "status" string, and then have a subVI that, when you pass it the status string and the string you want to update the status with, it appends to the status and adds a time since the program started. Like this:

 

status1.PNG

 

and the function looks like:

 

status2.PNG

 

and... this works, but I'm betting there's a smarter way to do it in LV.

 

To be clear, I want a field where I can see not only the most recent entry (where it currently is), but also the history of it for a little while back. Is there a good way to do this? thanks!

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

Well without seeing the entire program architecture and going by your use of the term "states" I am guessing you are using a proper state machine architecture.

 

One thing used to I like to do is make an indicator out of the typedef that controls the state of the state machine so the current stat is always displayed. 

 

As for logging to a text file, it's gonna be derpy as you have to build a string and save it with a timestamp.

 

Speaking of time stamps what are you doing with the Tick Count? Why not the Format Date/Time String vi?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(3,374 Views)

@RTSLVU wrote:

Well without seeing the entire program architecture and going by your use of the term "states" I am guessing you are using a proper state machine architecture.

 

One thing used to I like to do is make an indicator out of the typedef that controls the state of the state machine so the current stat is always displayed. 

 

As for logging to a text file, it's gonna be derpy as you have to build a string and save it with a timestamp.

 

Speaking of time stamps what are you doing with the Tick Count? Why not the Format Date/Time String vi?


Hi, I am indeed using a state machine with real states/shift registers/etc.

 

Hmm, I see that I could do that... however there are often little flat sequences within a given state (that don't really merit making their own sub-state diagram) that I'd still like to print to the status.

 

Hmm, why would I use that vi? I mostly just want a time elapsed since the program started, and the "time elapsed express vi" confuses me...

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

Hi optoelectro,

 

however there are often little flat sequences within a given state (that don't really merit making their own sub-state diagram)

Well, there always is a reason the get rid of sequence structures/frames, even with tiny subVIs - but that's not the focus of your question…

 

that I'd still like to print to the status.

I would use something like this:

- create one subVI with the only purpose to put some text (maybe with including timestamp) into a queue. Call this subVI each time you want to update a "status" (or: action/event log) on your UI…

- create an additional loop receiving all messages from that queue and have it display the text (maybe after applying the required formatting)…

That would be a simple kind of QMH (queued message handler)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(3,340 Views)