LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

check asynchronous process is running

Solved!
Go to solution

Hi,

 

A quick question: I have this program consisting of multiple state machines. The user interface can start these state machines (asynchronous) and send commands to them. Now, the problem is that I need to be able to check whether a certain state machine is running or not. What's the best way of doing this?

 

Kind regards,

Wouter

0 Kudos
Message 1 of 7
(3,030 Views)

I would have the state machines update their status in a functional global variable or Action Engine.  The user interface can read the data from the FGV to update the front panel.

0 Kudos
Message 2 of 7
(3,027 Views)

I already considered using a notifier or FGV but I was wondering whether there's not a more fundamental solution to check whether a process is running.

0 Kudos
Message 3 of 7
(3,022 Views)

If I wasn't worried about race conditions, i.e. there is only one "writer",  I would consider using a regular global variable or a shared variable.  The state machine writes what state it is in to the variable, then one or more other readers read that variable and do what they want with the information.

0 Kudos
Message 4 of 7
(3,015 Views)

Hallo wouter 🙂

As RavensFan already stated, if you want to know what the status of your parallel loops is, you have to put their status into a functional global.

You can keep more then just 'alive'

If there is hardware communication in there you can extend your statussen with : initialised, running, saving,...

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
0 Kudos
Message 5 of 7
(3,005 Views)

The problem I have with this solution is that the FGV will not be in the correct state if a statemachine is aborted (which tends to be necessary during development). I think I might have to use some sort of hartbeat instead.

 

Is there really no way to just check whether a vi is running?

0 Kudos
Message 6 of 7
(2,994 Views)
Solution
Accepted by topic author WouterVleugels

I would have the FGV or variable include a timestamp as well.

 

There is a property node for VI's called Execution:State.  That will tell you the status of a VI.  But I don't think I'd rely on it.  It would tell you a VI is running, but perhaps you are actually stuck in some sort of endless loop that prevents it from effectively doing what you are expecting it to do.  For your App, you would consider it stuck, but according to LabVIEW it is running.

 

I would rely on that watchdog method where you update a variable that would be a cluster of a timestamp and another useful piece of information such as your state machines current state.  Now you'll know what is happening, and you'll know if that data is too old.

0 Kudos
Message 7 of 7
(2,990 Views)