LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rapid subpanel execution

Solved!
Go to solution

Hello experts,

 

I am working on a application which will allow the user to see one of 50 or so data-collection sub-VIs via a subpanel, and execute said VI peridocally (as rapidly as every 100ms). Each of these data collection sub-VI has identical inputs but a unique cluster as its output, and takes 10-20ms to run. I thought that showing the FP of the data collection sub-VIs via a sub-panel would be the easiest way to allow the user to see data without needing a tab control and switching to one-of-X tabs with the matching datatype.

 

The issue I'm facing is that I'm using the Run VI method to call the sub-VI currently loaded in the subpanel, but whenever it executes it steals the focus for a second and changes the mouse cursor from arrow to selection-finger - you can imagine what happens at 100ms timing - the cursor is flinching wildly. I've tried disabling the subpanel VI but that doesn't change the loss-of-focus.

 

Is there a way to call the subpanel VI without causing loss of focus? Will using an asynchronous call work in this case? If so I guess I would need to preserve the reference to the loaded sub-VI and have a unique set of async nodes for each VI since the datatypes are unique.

0 Kudos
Message 1 of 17
(3,909 Views)

I do precisely this.  My routine handles from 4-24 Data Stations that can be selected to show their Front Panel as a sub-Panel in the Main routine (I use a Radio Button as the Station Selector, which insures that at most one Station is selected for display).  I launch the number of Stations I want as Asynchronous "Clones" (Pre-Allocated Reentrant routines), retaining a reference to each Station to use in populating the sub-Panel.  Switching seems essentially instantaeous.

 

Bob Schor

 

Message 2 of 17
(3,871 Views)

@Madmanguruman wrote:

Hello experts,

 

I am working on a application which will allow the user to see one of 50 or so data-collection sub-VIs via a subpanel, and execute said VI peridocally (as rapidly as every 100ms). Each of these data collection sub-VI has identical inputs but a unique cluster as its output, and takes 10-20ms to run. I thought that showing the FP of the data collection sub-VIs via a sub-panel would...


The front panel is for a user too observe.  20 frames per second is all the human eyeball can see..... and that is faster than the brain can assimilate the data!

 

You have gone and made a mistake.   Slow down the UI to human speeds or, get a "mentat" ala Frank Herbert.  Oh, Duncan Idaho is fictional!  So just slow down the UI.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 17
(3,869 Views)

The sub-VI is what performs the data collection, so even if I slow down execution to 4 times a second, the mouse pointer is going to still 'flinch' 4 times a second, which is what I *don't* want

 

I want to be able to execute the sub-VI in the subpanel without it flinching the pointer - it's extremely visually distracting.

 

0 Kudos
Message 4 of 17
(3,845 Views)

What I read in your first post, it sounds like you load the VI into the subpanel, THEN you have it run and that is what gives you the flicker?  Are you giving it multiple run commands to get it to repeatedly run?

 

You should design your subVI so that you open it, start it running, load it into the subpanel, and keep it running until your done with it.  If you have a subVI that has an idle mode, it can behave like it is not running, then instead of issuing a Run VI command, you just send it a message to change over to its "run" case.  It would just be a mini- state machine inside the subVI.  Keep it running!

0 Kudos
Message 5 of 17
(3,836 Views)

I should have been more clear in my original query, but yes - you did discern my intended use for the sub-panel. A particular sub-VI is loaded into the subpanel, then it's periodically fired by a timer-controlled loop to facilitate the data collection activity. The whole thing is in a big QMH app so the user could switch to another function and do some commands in between data collection steps so if execution is paused in the sub-VI, that could be an issue.


With this architecture I was hoping to avoid both having a tab control with the 50 different clusters and a big switch-case where I need to call one of 50 data collection sub-VIs - by using the subpanel and invoking the loaded sub-vi, I can just show the front panel of the data collection VI via the subpanel and only have one function to call (run the subpanel VI) instead of 50.  The only hang-up is this cursor flinching thing.

 

0 Kudos
Message 6 of 17
(3,829 Views)

I suspect that your display "flickers" because you are doing something that violates the Principle of Data Flow and "programming a pause" in your code.  It could also be that your code updates the display twice, introducing a flicker.

 

Post your code!  Attach VIs, or if you have several of them (and especially if they are part of a LabVIEW Project), compress the folder containing the VIs/Project and attach the resulting .zip file.  We are usually pretty good at finding "problems" in VIs that we can see, and often "reasonably" good at guessing what the problem might be.  If you do not post the code, then you will get only "guesses" and will have to find the problem (and fix it) yourself, wasting your time and ours.

 

Bob Schor

0 Kudos
Message 7 of 17
(3,826 Views)

Understood. I will t post a representative example project - the project in question will not run unless connected to our company-specific hardware.

 

It's not a screen flicker - while the sub-VI runs, the mouse pointer changes from arrow to selection finger, regardless of its location on the application (over the subpanel or not) - if this is intrinsic behavior, I will need to re-architect the application to not use a subpanel. 

0 Kudos
Message 8 of 17
(3,825 Views)

What you need to do is rearchitect the program so that it uses the subpanel properly.

 

What you are doing is like those people who create a VI and want it to run repeatedly, so instead of putting a while loop around it, they are just hitting the Run Continuously button.

 

In your case, you are repeatedly mashing the run button on the subVI in your sub-panel, but doing it programmatically, 

0 Kudos
Message 9 of 17
(3,819 Views)
Solution
Accepted by topic author Madmanguruman

I am not "Muad'Dib" but I suspect the issue is the way you are using the target sub-VIs.

 

Q: Does each sub-VI run to completion and then stop?

 

If so the flickering is due to the VIs changing to running then back to idle. LV has to fiddle with memory mapping etc each time a VI is invoked so the OS needs to get involved.

 

What others have been trying to tell you is you should change the way your target sub-VI are run. Do not run each one to completion but rather start them all ahead of time and just let them run in the background in an idle state until it is time to invoke them, Then message them (User Events would be handy for this) when they should do their thing.

 

If you keep track of the reference of each of the target sub-VI you can remove them (while they are still running) from the sub-panel and insert another.

 

....

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 17
(3,815 Views)