LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to replicate/duplicate sets of front panel controls and indicators?

Hi There,

 

Thank you for your time.  We often have projects that require multiple sets of hardware, and therefore multiple sets of corresponding controls and indicators on the front panel.  For example, we had a project that controlled 8 identical pneumatic cylinders, and each had its own position and force sensors.  Each one of the 8 needed its own, identical, interface to control such things as the command signal, PID control parameters, data collection, and manual overrides.  In another example, we had 3 identical Modbus devices, and each had its own data set.  Each of the 3 needed 40+ front panel controls and indicators to read and write data.  For each of these, we needed a way to edit the interface in one place, and automatically have it replicate.

PneumaticPneumaticModbusModbus

For the pneumatic cylinder example, our approach was to use only 1 set of front panel objects.  We gave the operator a control to select which of the 8 cylinders they wanted to control.  This worked okay, but the downside was the block diagram messiness of loading and unloading data from the front panel objects.  For the Modbus example, we just put the objects on separate tabs.  I worked really hard getting the first one right, and then I put them all in a group, and copied them to the other two panels.  This worked okay, but the downside will be making future changes.

 

I've also considered using property nodes to read the properties of the objects on one tab, and then writing them to the objects on the other tabs.  The hard part is that I would want to read and write ALL the properties... position, representation, visibility, etc.  Not sure there is a way to do this.

 

I've attached an example that represents the ideal.  I've used a typdef'd cluster as a front panel.  Then, when I change the typedef, all instances of it change at once.  On the block diagram, I just put these into an array and use indexing in a FOR loop to keep the code identical.  This looks like the answer we want, however, one downside is that all objects in the cluster must be either a control or an indicator, not a mix.  Another downside is that there also doesn't seem to be a way to access the properties of the individual objects in the cluster.  I've attached a simple example of this.  This has got to be a very common issue with a clean solution by now.  Looking forward to figuring this out!

 

Thank you!

0 Kudos
Message 1 of 7
(4,455 Views)

You could look into using a Subpanel control to load a different instance of a reentrant VI. Here's info on a Subpanel:

 

http://zone.ni.com/reference/en-XX/help/371361P-01/lvhowto/loading_panel_in_subpanel/

 

When asynchronously running each instance of the VI, you'll need to pass in whatever inputs they need to be identified with a specific pneumatic cylinder.

 

Instead of a tab control, use a drop-down to load whatever VI instance at runtime.

Feel free. Contact me for anything more,
    Pang

You too can be LabVIEW Awesome!
Message 2 of 7
(4,445 Views)

1) Learn how to use sub-panels.

2) Modify your code for each widget such that all of the VIs are re-entrant.

3) Insert clones of the re-entrant VIs into each of the sub-panels possibly using a FP control of the clone to tell it which device it should talk to.

 

Done!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 7
(4,444 Views)

If you are going to go the sub-Panel, reentrant VI route (which is an excellent idea, one I've used many times), then I recommend the following:

  1. Write the VI that handles one Task.  Give it Controls and Indicators (as though you were calling it as a sub-VI, but wanted to be able to look at the indicators while it was running).  Make sure it works.
  2. Make it a pre-allocated reentrant VI.  Make sure the sub-VIs it calls are also reentrant.
  3. Let's say you want N of these.  Launch them using Start Asynchronous Call (there are examples, including here in the Forum) -- do this in a For loop and bring the resulting VI References out as an "automatically-created Array of VI References.
  4. To look at Clone X (X goes from 0 to N-1), just plug VI Reference X into the sub-Panel's Insert VI Method.

Bob Schor

Message 4 of 7
(4,414 Views)

I tried the subpanels and have a couple questions. What is the procedure to center the controls in the subpanel?  What is the procedure to exchange data between the main block diagram exchange data the subvi?  See attachment with 3 methods: cluster, subpanel, and single front panel.

0 Kudos
Message 5 of 7
(4,327 Views)

@andy_3141593 wrote:

I tried the subpanels and have a couple questions. What is the procedure to center the controls in the subpanel?  What is the procedure to exchange data between the main block diagram exchange data the subvi?  See attachment with 3 methods: cluster, subpanel, and single front panel.


  • Make the SubVI window the exact same size as your subpanel. Then you can edit the controls and see how they will look at run time.
  • You can exchange data however you like. One possibility is to use a queue.
0 Kudos
Message 6 of 7
(4,306 Views)

You can even call it just like you would a normal SubVI with inputs and outputs using the Start and Wait on Asynchronous Call VIs.

 

Picture1.png

0 Kudos
Message 7 of 7
(4,303 Views)