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".
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!!
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.