LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing default values of a subpanel vi

Solved!
Go to solution

Hi marvi,

 

why do you need a tab container with 8 pages to hold 8 subpanels to hold 8 subVIs?

Why not use just  a single subpanel - and (un)load the subVIs as needed?

 

 

You can set a parameter in your subVI before running it: the GPIB address (or any other value) to describe the device it should handle. Then you run your VI and it loads the parameters for that specific device from your INI file. Then the VI waits for user action…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 20
(1,288 Views)


 why do you need a tab container with 8 pages to hold 8 subpanels to hold 8 subVIs?

Why not use just  a single subpanel - and (un)load the subVIs as needed?



 

Because I'm planing with up to 8 devices at once which I need to configurate at startup (in parallel). The use is presented with up to 8 tabs (one for each device) to make his config and then press init.

 


You can set a parameter in your subVI before running it: the GPIB address (or any other value) to describe the device it should handle. Then you run your VI and it loads the parameters for that specific device from your INI file. Then the VI waits for user action…

First, all 8 vi's need to run in parallel with the main thread, so that the user can change the front panel of each sub vi. I'm trying now to wait in each subvi for a notifier (the init button from the main thread), but somehow this doesn't work 😞

 

0 Kudos
Message 12 of 20
(1,278 Views)

what's not working is that I cannot change the controls in the subpanels, except the last one I added. Any ideas?

0 Kudos
Message 13 of 20
(1,262 Views)
Since you simply cannot run GPIB in parallel, your basic design is flawed. The subVIs do not need to load the configuration. That can be done by the main and the values passed to a single subVIS that you call sequentially.
0 Kudos
Message 14 of 20
(1,253 Views)

Uh, Doesn't LabView serialize the bus messages internally? Of course you cannot put two bytes at the same time on the bus.

 

I cannot load the ini from the main thread, because it does't know the data format of the stuff it should load. Only the subvi knows. Well, I can just read a JSON flattend string for example. Still, my main problem now is that the controls are not working (except the last one).

0 Kudos
Message 15 of 20
(1,243 Views)
LabVIEW will serialize the commands if you write the code to do that.
0 Kudos
Message 16 of 20
(1,236 Views)

@marvin24 wrote:

 why do you need a tab container with 8 pages to hold 8 subpanels to hold 8 subVIs?

Why not use just  a single subpanel - and (un)load the subVIs as needed?


Because I'm planing with up to 8 devices at once which I need to configurate at startup (in parallel). The use is presented with up to 8 tabs (one for each device) to make his config and then press init.

Again, you do not need 8 tabs.  You just need a single subpanel.  You could use a list control to select which instrument to load into the subpanel.  The fact that all 8 are running at the same time makes this even more suitable.  When the user selects an instrument, that instrument's panels is loaded into the subpanel.  All of the VIs are still running.

 

So I am still in the idea that you have the instrument VIs read the configuration file and load up what it needs and continue running.  I would then use an Event Structure in the instrument VI to allow for recieving of commands (from User Events) and front panel commands.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 17 of 20
(1,222 Views)

@crossrulz wrote:

 

Again, you do not need 8 tabs.  You just need a single subpanel.  You could use a list control to select which instrument to load into the subpanel.  The fact that all 8 are running at the same time makes this even more suitable.  When the user selects an instrument, that instrument's panels is loaded into the subpanel.  All of the VIs are still running.

So I am still in the idea that you have the instrument VIs read the configuration file and load up what it needs and continue running.  I would then use an Event Structure in the instrument VI to allow for recieving of commands (from User Events) and front panel commands.


 

is there a technical reason not to show all 8 panels at once (or in tabs) or is this more a matter of taste?

 

I currently use a notifier to communicate with the instrument VIs and I protect the write to the config file by a semaphore (I could also do this for VISA i required). See attached files.

Download All
0 Kudos
Message 18 of 20
(1,196 Views)

marvin24 wrote:

is there a technical reason not to show all 8 panels at once (or in tabs) or is this more a matter of taste?


You do not want to overload the user with information.  Therefore it is best to limit what the user can do at a time.

 

Plus this will make you code more extendable.  What would you do if you needed another instrument?  Show a 9th panel?  That's a bunch of code you have to upade.  With just the one panel, you just add the name to the list and use the same code you already had.

 


marvin24 wrote:

I currently use a notifier to communicate with the instrument VIs and I protect the write to the config file by a semaphore (I could also do this for VISA i required). See attached files.


No need for the semaphore.  I would just open the config file in your main VI and use an Action Engine or global variable to maintain your reference to the config file.  The API VIs will block on their own.

 

And I typically do not like to use Notifiers for communicating commands.  Notifiers are lossy, meaning you could miss commands if another notification was send before you read the last one.  If you want the broadcast capability with the losslessness of a queue, use User Events.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 19 of 20
(1,177 Views)
Solution
Accepted by topic author marvin24

@crossrulz wrote:

marvin24 wrote:

is there a technical reason not to show all 8 panels at once (or in tabs) or is this more a matter of taste?


You do not want to overload the user with information.  Therefore it is best to limit what the user can do at a time.

 

Plus this will make you code more extendable.  What would you do if you needed another instrument?  Show a 9th panel?  That's a bunch of code you have to upade.  With just the one panel, you just add the name to the list and use the same code you already had.



Letting the use zapp through a list searching for the right device also isn't very user friendly. However, I accepts that mine is neither an elegant nor expandable solution. Time will tell if it's ok or not. I'm programmer and user at the same time....


@crossrulz wrote:


marvin24 wrote:

I currently use a notifier to communicate with the instrument VIs and I protect the write to the config file by a semaphore (I could also do this for VISA i required). See attached files.


No need for the semaphore.  I would just open the config file in your main VI and use an Action Engine or global variable to maintain your reference to the config file.  The API VIs will block on their own.

And I typically do not like to use Notifiers for communicating commands.  Notifiers are lossy, meaning you could miss commands if another notification was send before you read the last one.  If you want the broadcast capability with the losslessness of a queue, use User Events.


Yes, the config file stuff needs a bit cleanup (also the rest of the example above). For some reason I hate globs, so I'll think of something different. Maybe I don't need a sem for read key, but for write key, I'm pretty sure - will test this.

 

For the notifier, it's working in my case because I only have a single event (init button pressed). Will think if I can replace it by an event or so.

 

All in all, the stuff is working as expected now. In the example above there is something in front of subpanel 1 which actually hides it, so I was not able to use the controls. Easy fix once I found it...

 

Thanks crossrulz for your detailed answers!

 

0 Kudos
Message 20 of 20
(1,171 Views)