From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-22-2012 03:38 PM
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.
08-22-2012 03:46 PM
Use queues to pass data between a main VI and a subPanel
08-22-2012 11:53 PM - edited 08-22-2012 11:54 PM
Hi
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.
08-23-2012 12:36 AM - edited 08-23-2012 12:37 AM
Call by reference Node can also be used if its a one time data transfer from the Main vi to sub vi.
If continuous data transfer is required then use Queues,Control references
08-23-2012 09:04 AM
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.
08-23-2012 09:09 AM
It convertes any data type to varient data.
08-23-2012 09:57 AM - edited 08-23-2012 09:59 AM
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?
Thanks.
08-23-2012 10:39 AM
I should also mention that the subVI has already been configured for re-entrant execution.
08-23-2012 11:11 AM
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?
Thanks.
08-23-2012 11:17 PM - edited 08-23-2012 11:22 PM
@Griffon2-6 wrote:
I've figured that out too - set the "Option" input on the "Open VI Reference" block to 0x8.
Great!
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.
@Griffon2-6 wrote:
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.)