10-18-2023 08:27 AM
@Caxaho wrote:
What I mean by this is that the Sub-VI must be being called by something, either by the Sub-VI itself (i.e. a while loop within the Sub-VI forcing it to run constantly), or by calling the VI by reference within the main window BD.
A, quite right.
The execution state should be running, the VI doesn't need to be executing though.
The VI doesn't need to actively doing something, it shouldn't be idle.
There's a slight difference.
A loop will keep it running, and that will work.
But if you put it as a subVI in the caller, it's not running (e.g. executing) but it isn't idle (editable).
Same if you put the VI in the caller, but in a case that is never executed (being careful that it's not compiled out in the executable by dead code removal): the VI isn't running, but it isn't idle.
With a Static VI Reference, the VI won't be running.
With a strict Static VI Reference, the VI will be in run state, even if you don't run it.
@Caxaho wrote:
This may have been obvious to some folks,
No, it's definitely not obvious
10-18-2023 09:03 AM
Ah I see, yes, I just tested and it does indeed work with only the strict static VI reference piped into the open VI block.
This seems like it's not very well documented. I wasn't aware that there was a difference between not executing and not editable. This has been insightful (and painful).
So as I understand it, with just a static VI reference, it can be opened and inserted into the SubPanel (preventing it from being edited) but isn't actually executing. But with a strict static VI reference, it will be in a run state regardless? Do you even have to do the "Run VI" invoke method?
10-18-2023 10:02 AM
@Caxaho wrote:
Ah I see, yes, I just tested and it does indeed work with only the strict static VI reference piped into the open VI block.
This seems like it's not very well documented. I wasn't aware that there was a difference between not executing and not editable. This has been insightful (and painful).
Well there's obviously a difference, you just didn't link it to this exact situation.
If a VI has a normal subVI, it's pretty normal that you can't edit the subVI, even if it isn't running.
@Caxaho wrote:
So as I understand it, with just a static VI reference, it can be opened and inserted into the SubPanel (preventing it from being edited) but isn't actually executing. But with a strict static VI reference, it will be in a run state regardless?
Yes.
You can actually use the Execution>State property to see this, quite directly.
@Caxaho wrote:
Do you even have to do the "Run VI" invoke method?
No, you don't if you use a strict static VI reference.
Note however, that IIRC, you can't use the run method anymore either. The state is running, and you can't invoke a run method on a running VI. You'll have to use 'call by reference', 'call and forget' or 'call and collect'. You can, because you'd have a strict type specifying the connector pane. Benefit is that call by\and ref\collect\forget doesn't need an idle root loop, while the run method does. *sigh*.
The VI state will turn to running, as if it was a subVI on the diagram, but it wasn't started.
So 'run' method and 'running' state is quite confusing.
The 'running' state should actually be 'not-idle'.
Distinguishing between executing and running is not possible with 'normal' LabVIEW techniques.
10-19-2023 06:11 AM
Ah I see, this is really good to know. Thank you for the clarifications, you have cleaned up my BD significantly 🙂