LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Popup window

Solved!
Go to solution

Hello I have Main Vi containing Many sub VI I set some of them to pop up when I press ok button, I set the subvi using VI properties to pop up when called. However it pop up and it is start to appear and dusappear very quickly with changing data from loop. What I want to do is to make that subvi controlable so I can close and open it easily and avoid the twikling window that happen to me now. I attached picure for part of my block diagram for main vi with subvi icon getteing the data from main vi to draw graphs in subvi.I hope this clear.

0 Kudos
Message 1 of 11
(6,103 Views)

You need to attach actual VI's.  That image of a crudely drawn subVI is useless to be able to give you any help.

Message 2 of 11
(6,086 Views)

ok I attached the main VI and Sub VI, I have labview 8.5 so the block diagram look messy .

0 Kudos
Message 3 of 11
(6,053 Views)

and this the conitnue of subvi, also could I find some way to make the block diagram and wiring looking good

0 Kudos
Message 4 of 11
(6,051 Views)

What you are seeing is by design (both LabVIEW and your code). The while loop cannot iterate until the subVI finishes if it has been called. Since you have it set up as a modal dialog, and to close its panel when it finishes, then it opens, writes data to the graph, and then closes, since that's all that's in there. What you need to do is to launch the VI dynamically so that you can leave it running while your loop continues.  This means that when the popup VI is launched, it needs to keep running. I.e., it needs it own loop (though not a Greedy Loop). Your button would open/close the VI. Or, you can just have the button on the main panel open the popup, and have a button on the popup to close it (or just use the "X" button in the top-right). You can pass data to the VI using queues. Examples ship with LabVIEW on launching VIs dynamically.

 

Alternatively, you could have a separate loop for each popup VI, also using a queue to pass data.

Message 5 of 11
(6,037 Views)

Thanks for help. although I have done every things as you said but still same problem, I remove one of the Vi out side and I used queue for data handling , also I change the subvi apperance properties as shown in the picture attached. but still the subvi appear and dissapear. I attached the main vi. 

Download All
0 Kudos
Message 6 of 11
(6,025 Views)

Hi Faris,

 

In the Producer/Consumer architecture, you would ideally keep only the production of data (i.e. DAQ Assistant in your application) in the producer loop. This will ensure that the processing (or "consumption") of data (i.e. all other operations like writing to file and analysis in your application) does not affect the acquisition of the data. It is also important to use the error clusters of the queue functions - and correctly remove the queue from memory (Destroy Queue) - this is also used to stop the consumer loop (when queue no longer exists) by default.

 

However, it sounds like in your application you want the data in the sub VI to be continuous, rather than updated only when it's visible. For that reason, I would think that a global variable may be the best option here. I would recommend using it in addition to Producer/Consumer loop architecture. With the use of variables you want to first be in command of any potential race conditions and check whether multiple sources write to the variable. If you're only writing to the variable in one part of the block diagram (yes in this case), using a global variable shouldn't cause any issues and we don't need to worry about locking 'critical' sections of code. You would want to write the data (and stop button value) to the global variable, and then read it back in your rather funky-iconed sub VI, as well as add in a loop to do that continuously.

 

diagrams_bd.png

 

pro_con_bd.png

 

The bottom part of the block diagram first gets a reference to the sub VI (using application directory to look in the same location) and runs the VI - you must set the Wait Until Done flag to false so the sub VI operates continuously. Use an event structure to display the front panel while the button (on the front panel) is pressed. Remember to destroy the reference at the end!

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

Download All
0 Kudos
Message 7 of 11
(5,974 Views)

Also just realised your original code was saved in LabVIEW 8.5 -- I've saved the code back to the previous version so you can work from the source code.

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

0 Kudos
Message 8 of 11
(5,967 Views)
Solution
Accepted by Faris_Elasha

I talked about race conditions and then forgot to initialise the stop variable myself! You would want to write a false value to the stop variable before going into any of the loops to ensure none of them read "true" from the previous run of the application before the producer loop sets the value to false. Required modification:

 

initialise.png

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

Download All
Message 9 of 11
(5,963 Views)

This exactly what I need, thanks alot Imtiaz now the popup window working perfectly. realy this great help

 

 

0 Kudos
Message 10 of 11
(5,941 Views)