LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous call: Checking if the sub-VI is running.

Hi!

 

For a small application (part of a bigger one) using QMH architecture, I need to enable a pop-up window showing some random info (axis orientation etc.) which would be helpful to stay showed when operating the application.

 

I thought of using an Asynchronous call as my sub-vi doesn't even produce any data. Typically just a front panel with a fwe pictures and text, a "Ok" (or close) button and allowing the user to close the window.

 

Question: How do I programmatically check if this sub-VI is still running or not? The goal is to programmatically close it if ever it's not when the application is closed and to do nothing if the info VI was not open (to not generate an error).

I know there is the property node Exec.state that exists, but for some reasons it is always returning "Running" even when it's not (Or at least I don't think it is)

I should point out that I am not really fluent with non-static VI calls, this would actually be my first attempt in an official application.

 

I enclose a quick example to illustrate what I'm trying to do based on the P/C event design pattern.

 

Any help?

 

Thanks in advance.

Vinny.

Download All
0 Kudos
Message 1 of 26
(1,273 Views)

 


@VinnyAstro wrote:

Hi!

 

For a small application (part of a bigger one) using QMH architecture, I need to enable a pop-up window showing some random info (axis orientation etc.) which would be helpful to stay showed when operating the application.

 

I thought of using an Asynchronous call as my sub-vi doesn't even produce any data. Typically just a front panel with a fwe pictures and text, a "Ok" (or close) button and allowing the user to close the window.

 

Question: How do I programmatically check if this sub-VI is still running or not? The goal is to programmatically close it if ever it's not when the application is closed and to do nothing if the info VI was not open (to not generate an error).

I know there is the property node Exec.state that exists, but for some reasons it is always returning "Running" even when it's not (Or at least I don't think it is)

I should point out that I am not really fluent with non-static VI calls, this would actually be my first attempt in an official application.

 

I enclose a quick example to illustrate what I'm trying to do based on the P/C event design pattern.

 

Any help?

 

Thanks in advance.

Vinny.


You can use a notification system. Simply send a notification ever x time from the asynch VI. Then check the notification in the master VI, if the notifications do not arrive you can assume that the VI is not running.

---------------------------------------------------

Projektingenieur
Restbust, Simulations and HiL development
Custom Device Developer
Message 2 of 26
(1,238 Views)

Make an FGV that stores the boolean for if the SubVI is running or not. At the start of the SubVI, write a true value to it, and write a false value at the end of it. Then you can read that FGV anywhere in your main VI

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 3 of 26
(1,220 Views)

@VinnyAstro wrote:

Hi!

 

For a small application (part of a bigger one) using QMH architecture, I need to enable a pop-up window showing some random info (axis orientation etc.) which would be helpful to stay showed when operating the application.

 

I thought of using an Asynchronous call as my sub-vi doesn't even produce any data. Typically just a front panel with a fwe pictures and text, a "Ok" (or close) button and allowing the user to close the window.

 


Are you perhaps suffering from "man with a hammer" syndrome?  Why does your subVI need to be an asynchronously running thing if it has nothing to actually do?  A simple subVI call to set its info, plus Open/Close Front Panel by reference, is all that is needed.  Let the User close the window with the X button.

0 Kudos
Message 4 of 26
(1,201 Views)

@drjdpowell wrote:

Are you perhaps suffering from "man with a hammer" syndrome?  Why does your subVI need to be an asynchronously running thing if it has nothing to actually do?  A simple subVI call to set its info, plus Open/Close Front Panel by reference, is all that is needed.  Let the User close the window with the X button.


Quite the inverse actually, I'm exploring new solution I have never used before, for training purposes 🙂

 

The problem with using a sub-vi and calling it statically is that it would block the rest of my application until the user closes it.... Sure this VI does nothing in particular, just showing some info, but imagine opening the Help menu in labview and having to close it before using labview again ...

0 Kudos
Message 5 of 26
(1,187 Views)

I've actually found a somehow easier solution: 

In the options when opening the VI reference, I used 0x100 ionstead of 0x80. 

This automatically closes my Info VI when closing the application.

VinnyLaTaupe_0-1597325653842.png

 

 

However, if the user clicks multiple times on the info button without closing the subVi in between, then the subvi will reopen the same number of time after every close. And I guess the only solution is to indeed use either a notification or a global variable.

 

I'm quite confused though why the "Exec.state" always show "running". Any explanations ? Because all of the solutions above sounds like random bodging to overkilling, rather than a clean solution, no ? 🤔

0 Kudos
Message 6 of 26
(1,184 Views)

@VinnyAstro wrote:

The problem with using a sub-vi and calling it statically is that it would block the rest of my application until the user closes it.... Sure this VI does nothing in particular, just showing some info, but imagine opening the Help menu in labview and having to close it before using labview again ...


You're just describing the issues of using your hammer.   There are many other tools that can show an info box, some of which involve no blocking and are simpler than what you are trying.

0 Kudos
Message 7 of 26
(1,180 Views)

Well, I'm all ears to these kind of solutions! That's also why I posted in the forum 😀

0 Kudos
Message 8 of 26
(1,177 Views)

@VinnyAstro wrote:

 

I'm quite confused though why the "Exec.state" always show "running". Any explanations ? 


A VI is "running" if it is running in the LabVIEW execution system and is available to be called.  Whether its code is actually in the process of being called at a point in time is a different question.  There is no property for that, probably because such a feature would add significant overhead to very-fast executing subVIs.

0 Kudos
Message 9 of 26
(1,176 Views)

Use a "Static VI Reference" to the VI you wish to call Asynchronously.  Wire the reference to a property node for the "Execution State" (read).  The enum provided will tell you if the VI is idle, bad, running, or running as top level.

 

See "Execution:State Property" in the LabVIEW help.

 

If you are interested, i'd recommend you look in to the Delacor QMH (DQMH) toolkit (free on VI Package Manager and listed on NI's website as well).  It sounds like some of the things you are interested in trying are native features of DQMH.

It is an extension of the QMH architecture and has been presented at NI week a few times at least.  Their built-in project template for "Continuous Measure and Log" helps understand how it works quite a bit.  https://delacor.com/products/dqmh/  (they have documentation, videos, and even a youtube channel).

Message 10 of 26
(1,162 Views)