LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

run a previously stopped subVI

Hello you all!!

The situation is the following. I have two while loops that are executed in parallel. One of this loops, gets the signal from a Spectrum Analyzer connected. In case of alarm (eg Spectrum Analyzer disconnected) the loop is stopped (and so, the Spec An SubVI). The main loop is noticed when this subVI is stoped, and polls the intrument to know when the alarm has solved. In case the alarm is solved, the Spectrum Analyzer subVI needs to be run again... And that is the problem...

How can I run a subVI that is just "opened" but not running from the main VI? I have tried to use the "Run vi" (invoke node) but an error message is obtianied because "the VI is not in an allowed state".

Thanks you very much for your help.
0 Kudos
Message 1 of 6
(2,619 Views)
Hi

One solution could be, to place you vi in a case-structure in another while-loop.

Your polling-result could feed the case-structure and, if it is ok, start your vi again.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 6
(2,616 Views)
Perhaps this could work, but the problem is I have some other while loops and case structures, and I thought perhaps there where a method to run the vi programatically, by calling a function or something like this... I will try to implement your suggestion... Thanks!!
0 Kudos
Message 3 of 6
(2,604 Views)
For sure there is a way to do it programmatically, but I think data-exchange will be a bit more complicated.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 6
(2,601 Views)
One solution to programmatically call this subVI is to dynamically load it always. So it is not already embedded in a running VI, which I think is why you get the error that the subVI is not in an allowed state. To do this, remove the subVI from the all calling VIs and call it using the Run.vi and other VIServer VIs.
..
More ellegant would be to make all the calls to the Spectrum Analyzer using the same subVI, so the subVI monitors the alarm solved conditions and restarts that portion of coded that errors out within a loop inside itself. This method will allow the subVI to always have an output that tells you the state of the Spectrum Analyzer even alarm states. This subVI could then be used directly as a subVI (avoiding any complications of passing data with VIServer with the dynamic loading method) under your program because it handles the alarms and errors and keeps running.
0 Kudos
Message 5 of 6
(2,580 Views)
thanks for your suggestion. Finally, I used the while with case structure proposed and I managed it to work. Thanks!!!
0 Kudos
Message 6 of 6
(2,572 Views)