LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Template or Reentrant for calling and opening front panel of the same SubVI multiple times in separate floating windows?

Solved!
Go to solution

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!

0 Kudos
Message 1 of 6
(184 Views)
Solution
Accepted by nikvl

@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. 


"Should be" isn't "Is" -Jay
Message 2 of 6
(138 Views)

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)?

0 Kudos
Message 3 of 6
(91 Views)

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!

0 Kudos
Message 4 of 6
(71 Views)
Solution
Accepted by nikvl

@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.

Message 5 of 6
(60 Views)

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


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(13 Views)