LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a GUI for controlling multiple instruments

Solved!
Go to solution

Greeting to LabVIEW Enthusiasts 🙂

 

I am developing a GUI for multiple Function generators and Oscilloscopes. There will be some measurements which I have developed mostly. Now I start to think about assembling my devices in the front panel where a user can choose which device he/she want to pick up for a measurement.

 

Available function generator: Analog discovery 2, Rigol, R&S and Siglent

Available oscilloscope: Analog discovery 2, Rigol and R&S

 

Rephrasing my plan for GUI: For instance if a user choose Analog discovery 2 as function generator and Rigol as oscilloscope then in the measurement Tab only these two device will be shown and proceed for the measurement.

 

I am using Queue Message Handler (QMH) for developing my program. So for all devices, initialization have been done in “Initialize MHL”.

As initialize APIs are different so the problem I’m dealing with to show exact name of the device for Rigol and R&S, Siglent APIs. These device uses VISA resource name as “Instrument handle in” identifier which shows string as "GPIB::6::INSTR….." format. So first I want to convert this names to Rigol, R&S and Siglent then these names will be available in the menu ring drop-down. Afterwards by choosing one function generator and one oscilloscope measurement will proceed.

 

So what will be the convenient way to do this?

 

Planned front panel and initialize MHL (in block diagram) attached in the attachment.

 

Thanks.

- Reduanul

Download All
0 Kudos
Message 1 of 6
(793 Views)
Solution
Accepted by REDUANUL

@REDUANUL wrote:

Greeting to LabVIEW Enthusiasts 🙂

Rephrasing my plan for GUI: For instance if a user choose Analog discovery 2 as function generator and Rigol as oscilloscope then in the measurement Tab only these two device will be shown and proceed for the measurement.

 

I am using Queue Message Handler (QMH) for developing my program. So for all devices, initialization have been done in “Initialize MHL”.

As initialize APIs are different so the problem I’m dealing with to show exact name of the device for Rigol and R&S, Siglent APIs. These device uses VISA resource name as “Instrument handle in” identifier which shows string as "GPIB::6::INSTR….." format. So first I want to convert this names to Rigol, R&S and Siglent then these names will be available in the menu ring drop-down. Afterwards by choosing one function generator and one oscilloscope measurement will proceed.

 

So what will be the convenient way to do this?

 

Planned front panel and initialize MHL (in block diagram) attached in the attachment.


It's not clear to me where you're stuck. Probably not setting the ring's string items...

 

In the MHL parent, make a method that has an array of all children. For each child, call a method that returns it's name to display (or use the class's name with .lvclass stripped). That gives you an array of names that you can put in the ring.

 

On the ring's value change event, call a factory-ish method in the parent that instantiates the selected child (the same array could be used, it could be a simple index array).

 

For the selected class, call it's initialization. That should be a DD VI, so it can be done by passing a reference file, or the object could open it's own settings from somewhere. A file, the registry, a database...

 

Each child could have a UI method, that can be started dynamically. The method could be dynamic dispatch, but if the parent has a static method that calls it, you can start that VI easily with VI server. Run the VI, and put it's front panel in a sub panel.

 

The GUI should communicate it's settings and events through user events or any other reference mechanism (control refs, queue's, DVRs). It's even possible to let the class read the controls from the GUI's front panel in another method.

 

This can be done in a lot of ways. It's usually not easy regardless the method you pick. You either have some GUI running in parallel, causing sync problems, or you have something 'passive' (a VI that doesn't loop) and you get event handling problems.

Message 2 of 6
(739 Views)

I'll assume all of your instruments communicate via VISA and respond to to the *IDN? Below will identify all instrument class names, you will need to parse, keep track of VISA resource and then populate your test ring.

 

snip.png

 

mcduff

 

EDIT: Better to NOT use shift register for error, and handle error cases individually

Message 3 of 6
(728 Views)

wiebe@CARYA,

 

Thanks for your suggestion.

 

I'm basically stuck in two thing:

 

1. How to convert VISA name ?? Usually they appeared in "GPIB::6::INSTR….." format but I want something like manufacturer name e.g. Rigol or R&s and so on.

 

2. If I can covert visa name to manufacturer name what will be be best way to select (using ring or enum) the device for running the measurement. 

 

As a novice in LabVIEW If I'm not wrong then you suggesting for Object-Oriented Design Pattern. Unfortunately, I'm not too much familiar with Object-Oriented Design Pattern. Is there is other way to play around ?

 

For your better understanding I have attached my planned GUI.

 

0 Kudos
Message 4 of 6
(722 Views)
Solution
Accepted by REDUANUL

You can use a combo box, or create a cluster that has all of the information.  Below is an example of a combo box, modify using the code I showed earlier. (Make sure you set the properties of the combo box correctly.)

 

When you initiate your loop, run a scan to detect all instruments, populate your controls, etc. You can also have a scanning loop run every 10s to see if new instruments are attached.

 

mcduff

 

snip.pngSnap70.png

Message 5 of 6
(715 Views)

@REDUANUL wrote:

2. If I can covert visa name to manufacturer name what will be be best way to select (using ring or enum) the device for running the measurement. 


You should have a link to the list of devices that populated the ring. If the user selects ring item 4, use the 5th device.

 


@REDUANUL wrote:

As a novice in LabVIEW If I'm not wrong then you suggesting for Object-Oriented Design Pattern. Unfortunately, I'm not too much familiar with Object-Oriented Design Pattern. Is there is other way to play around ?


People use OO because it's easier, not because it's harder.

 

Any OO workaround will be OO-ish, without all the benefits of the build in OO. The only benefit to DIY is a better understanding, which might not turn out the way you planned it.

 

I don't know an easier way than OO...

 

Other ways are VI Server (*sigh*), or hardcode everything in case structures (*shiver*).

0 Kudos
Message 6 of 6
(681 Views)