12-24-2018 04:17 PM
Well I know my subject title is probably too long, but that's an attempt to really explain the problem.
First, I had a non-entrant vi that I call asynchronously with flag 80 to fire and forget. Works OK as long as the vi is non-rentrant. (Open vi reference -FP Open- Async call - Close)
Now enter re-entrant: I set execution for the same vi described above to pre-allocated re-entrant" and combine flags 40 and 80.
The code seems to run but no front panel shows up. (All error in and out indicate no problems) and the cloned reference is valid.
So what do I need to differently or in addition for the re-entrant case?
Note my objective is to have multiple instances of this single vi running; each with its own dedicated front panel simultaneously accessible. Pretty much like multi-threading I guess.
12-24-2018 08:32 PM
BlessedK,
I've done something similar. I'm monitoring some behavioral experiments, and have 24 "stations" that contain a video camera and a measuring instrument generating a graph of behavior (recording session lasts 2 hours). I have a Station VI that calls a Camera VI and an Instrument VI -- Station, Camera, and Instrument are all Clones (pre-allocated reentrant VIs). Station is called with Start Asynchronous, while Camera and Instrument are sub-VIs within Station. Camera and Instrument have Front Panels (Camera displays the current Video Frame, while Instrument displays a Graph showing behavior over the two-hour testing period). Rather than having multiple Front Panel displays on my Main, I have a pair of Panels that can show the Camera and Instrument Front Panels of a selected Station.
[Sorry, it's a little complicated ...]. Suppose I'm running 24 Stations, and choose Station 1 to view. I have references to the Front Panels of the 24 Camera and 24 Instrument Clones, so I choose Camera 1 and Instrument 1 and insert their References in the Camera and Instrument sub-Panel. When I want to view Station 10, I get the references for those Camera and Instruments and update the sub-Panel References. In your case, if you have multiple sub-Panels, you can view multiple Clones at the same time (instead of one-at-a-time, as I am doing). All you need is the VI References to the Clones whose Front Panels you wish to view.
Bob Schor
12-25-2018 12:41 AM - edited 12-25-2018 12:42 AM
I think I get what you mean “ by having multiole sub panels. I will try that and get back to you with my results. In the meantime, may I ask: Can subpanels be created programmatically. I am asking because the program can not proactively pre-determine the number of instances that would run simultaneously. As an alternative I am thinking of having another re-entrant Vi for display purposes that would have a sub panel, so if I wire the reference(s) to this subpanel within this re-entrant vi, I can have multiple cloned instances showing up simultaneously. Not sure if that’s reasonable but anyway let me try somethings around the “multiple sub panels” you suggested and let you know.
12-25-2018 05:59 AM
BK,
A few clarifications and (possibly not 100% correct, but "I think this is right") comments:
Bob "Silly" Schor
12-25-2018 01:18 PM
Hahaha, yeah the KISS principle is universal 🙂 Will definitely consider your suggestions. The other thing I am concerned about ( still haven’t implemented test cases for the subpanels) going by your statement that subpanels are “relatively static and like indicators” is that my front panel for each of these clones contains all controls (no indicators ) which the user can change and expect certain responses. Does this still seem in alignment with what a subpanel can do?
12-25-2018 02:00 PM
Glad you have a Sense of Humor! Plus a Thank You for reminding me that sub-Panels can actually "present" the sub-VI's Front Panel to its Caller (not unlike a Modal Dialog Box) so that you can, indeed, interact with the Controls [I just wrote myself a 2-VI test system with two Stop Buttons, one in the sub-VI that I pushed "through" the sub-Panel on the caller VI, the other to stop the Caller. Needless to say, it worked like a charm].
So, I'd have to say "Yes, if you write a single sub-Panel and a "Selector" that chooses which Clone has its Front Panel displayed in the sub-Panel, the Clones should be able to do almost anything they want and have the Main be able to interact with all the (Visible) Controls."
Here's a Trick that you might find useful for getting the Front Panels of your Clones to "match" the size of your sub-Panel. Do you know about OpenG, the set of Tools available from LAVA (the LabVIEW Advanced Virtual Architects group)? If not installed, open VIPM, go find OpenG Toolkit, and install it. [You need to have TCP/IP enabled in your LabVIEW Development Environment -- Tools, Options, VI Server tab]. There's an OpenG Application Control called "Fit VI Window to Largest Dec" which you put at the beginning of the Clone. You then go to your Clone's Front Panel and put a Decoration (I use a Frame) around what you want to show as your Front Panel. I recommend making it "fit" on the Grid Lines and making all your Clones have the same size Decoration. Make the sub-Panel also the same size. Now when your Clone runs, it will run this sub-VI, snap its Front Panel down to the Decoration (keep the Error Clusters outside, since who needs to see them?), and everything nicely fits!
A few more notes:
Good luck.
Bob Schor