06-10-2021 08:22 AM - edited 06-10-2021 08:23 AM
Hi all,
I'm trying to design a program in such a way that it has:
1) Main vi which reads and displays sensor readings
2) A SubVi reads an input string in the Main Vi to call and display data (manufacturer, serial number, etc.) of the device under test (DUT) from an excel sheet. A boolean within this subVi records the real time values from the sensors (located in the main vi) in a table on the front panel of the SubVi.
3) To call this SubVi, a button on the Main vi opens the front panel of the SubVI in a floating window.
4) When the button is clicked again, the front panel is opened again as a second floating window
The idea behind the multiple floating windows is to be able to input those sensor readings for more than one DUT at the same time and switch between them independently.
Note: I know about subpanels but I want to view the DUTs simultaneously/side by side
After some browsing in the forum, there seems to be two options to make this happen, namely using a vi template or making the subvi reentrant. However I'm still unclear as to which one is suitable for my application.
May I know the difference between the two and some tips to get this to work?
Thanks in advance!
Solved! Go to Solution.
06-10-2021 11:20 AM
@nikvl wrote:
Hi all,
I'm trying to design a program in such a way that it has:
1) Main vi which reads and displays sensor readings
2) A SubVi reads an input string in the Main Vi to call and display data (manufacturer, serial number, etc.) of the device under test (DUT) from an excel sheet. A boolean within this subVi records the real time values from the sensors (located in the main vi) in a table on the front panel of the SubVi.
3) To call this SubVi, a button on the Main vi opens the front panel of the SubVI in a floating window.
4) When the button is clicked again, the front panel is opened again as a second floating window
The idea behind the multiple floating windows is to be able to input those sensor readings for more than one DUT at the same time and switch between them independently.
Note: I know about subpanels but I want to view the DUTs simultaneously/side by side
After some browsing in the forum, there seems to be two options to make this happen, namely using a vi template or making the subvi reentrant. However I'm still unclear as to which one is suitable for my application.
May I know the difference between the two and some tips to get this to work?
Thanks in advance!
There really is 1 best option. Call the subvi asynchronously as a fire and forget. The overhead of building a new vi from template cannot be buried and is extremely poor performance wise. In fact, it is exactly why the asynchronous call by reference node exists. Programmatic calls to vits should be considered obsolete for new development.
06-11-2021 12:20 AM
Thank you for your reply.
Does the SubVi still need to be a reentrant vi for asynchronous calling to work? If by using the fire-and-forget mode, would I still be able to save the results of table in the multiple subvi's later in separate locations (probably via a button in the subvi itself)?
06-11-2021 09:28 AM
I tried making a sample vi to see if it would work and to demonstrate what I'm aiming for. The random number generator are meant to be sensor readings
This almost works but every time I open a new SubVi front panel, all references are applied only to the latest clone.
How do I modify it so that I am also able to register the latest values for the previous clones (ie the StringTable of all clones are also continuously updated from the main)?
Thanks in advance!
06-11-2021 10:17 AM
@nikvl wrote:
How do I modify it so that I am also able to register the latest values for the previous clones (ie the StringTable of all clones are also continuously updated from the main)?
Use a notifier. Create the notifier in in your calling vi and pass the reference to the notifier to your subvi. Read the notifier in the subvi and take the appropriate action.
06-14-2021 04:37 AM
There are some excellent examples in the example folder just take one look at that project and it'll probably answer all your questions. the rest of my going to be have to be dug out of the help file