I'm currently working on a program that consists of a main VI which passes in several inputs to numerous copies of the same subVI which are displayed in subpanels. As you may know, in order to display a subVI in a subpanel, a reference to the subVI must be passed into the "Insert VI" property node of the subpanel. However, I am unsure as to what is the proper way in which I can generate this reference from the subVI block on the block diagram of the main VI. Note that in my case, it is insufficient to simply generate a reference to the subVI by pointing to the file path of the subVI and opening an instance of it, because that instance of the subVI must also receive input from the main VI. Generating a reference in this way does not, as far as I know, allow the main VI to interface with the subVI.
I had thought that I developed a solution to this problem by extracting a reference to the current instance of the subVI from the "Owning VI" property node of any control or display in the subVI. This works well for about 12 hours of program execution. However, after that point, the program starts highlighting the "Insert VI" property node every time the subVI is updated. Furthermore, the main VI seems to often lose the reference to the subVI and becomes unable to start, especially after the subVI has been edited. Given these two problems, this solution clearly is not a proper solution.
Could anybody advise on how to properly generate a reference to an instance of a subVI that receives input from a main VI?
Any suggestions would be appreciated.
If the inputs to be passed from the Main VI to the subVI involve control values, like, you want to pass a value to a control on the subVI, then you can use VI reference to pass data.
Use the invoke node for the subVI and set the Control Value. This value will then be seen when the subVI is loaded in the subpanel.
Post your VI so that we can have a look at it and suggest the best option. Also we can look at the issues you are facing.
Thanks for the responses everyone.
Using invoke nodes to pass control values looks promising. I should probably be embarrassed to ask this, but could somebody tell me what those converter blocks going into the control value terminals are in Freelance LV's example?
Thanks, I just figured that out myself. I've managed to get one instance of the subVI to display properly in a subpanel by passing control values through invoke nodes. However, Labview complains when I want multiple instances of the same subVI to display in subframes in the main VI. Each of the instances receive inputs with different values from the main VI. Any suggestions for that?
I've figured that out too - set the "Option" input on the "Open VI Reference" block to 0x8. However, now I've discovered that the inputs from the main VI are not being passed to the subVI instances as the program is running. Does passing control values via invoke nodes allow for real-time data transfer?
I've figured that out too - set the "Option" input on the "Open VI Reference" block to 0x8.
Thats the way to go. Keep digging around and you will find solutions in the LabVIEW Help or on the forums for most of the things.
When you set the open VI reference option to 0x08, you can obtain reference to different instances of the same VI, so that you can pass different data and let them run separately.
However, now I've discovered that the inputs from the main VI are not being passed to the subVI instances as the program is running. Does passing control values via invoke nodes allow for real-time data transfer?
I have one question. You said you are calling this sub VI in a sub panel? How many subpanels do you have and why are you calling the reentrant vi in differnet sub panels?
Could you post your code?
(If a post helped you sove the problem, mark it as solution. That will help us identify and track the solutions for different issues.)