08-12-2023 12:13 PM
I have a issue in running subvi in main vi in real time in labview. Basically when I open main vi in running condition then if I try to go into subvi by clicking the subvi button provided in main vi then main vi stops and subvi front panel opens in running state. I want that if I once start the main vi then all the subvi inside should also get started to store data, and if I try to look into the subvi by clicking it from main vi then main vi should not stop. I am attaching a zip file containing some parts mainly main project 3.0 is important and other are subvis , please run the exe (i4.0) file to see the problem then please guide me the changes I need to make in the vis .
08-12-2023 01:13 PM
Thank you for providing a compressed view of your Project folder. However, there appear to be many sub-VIs that you call which are not in the Project Library, making it difficult to look at the code and understand your issue.
I was a little confused what you meant by running the subVI in "real-time in LabVIEW". Am I correct that you mean "at the same time my main VI is running", and not "on a second processor, such as a cRIO, running a LabVIEW Real-Time Operating System"?
You need to code your sub-VI so that it can run semi-independently and concurrently with your Main program. You also need to be able to view its Front Panel (and potentially place it where it doesn't cover up, or "sit behind", other stuff you are viewing). You can do some of this by changing the Windows properties of the sub-VI, for example turning on "View Front Panel while Running", and deciding on its Run-Time Position (including putting it on a second monitor). You can also run it from a sub-Panel within your main VI's Front Panel.
Why don't you try writing two little Proof-of-Concept "Demo Routines", one that does 5% of what your Main does (it just needs to "be there" and, perhaps, interact/start/stop the sub-VI) and one that "looks like" the sub-VI, with a Front Panel and controls? Do it as a separate "Demo Project" (so you'll have much less to send us to look at), no fancy I/O, just something to illustrate what you want the Main and the sub-VI to sort-of "look like" and how you want them to interact (include buttons on Main to Start/Stop sub-VI, and buttons on sub-VI to also do "meaningful things"). Don't worry if you can't "get it to work" -- make it so we can look at it, say "Oh, now I know what you want to do, here are three ways to do it ...".
Bob Schor
08-12-2023 01:39 PM
Thank you so much for replying, see I am not professional in LabView so it is hard for me to get what you want to say, But is it possible to do those some changes in the sub vi and main vi that can help me to do changes accordingly in my file. It would be really helpful. I you want complete project then I can share it you by gmail or something. It is really urgent because I need to submit this in 2 days
08-12-2023 10:06 PM
OK. I wrote a tiny little VI that opens another tiny little sub-VI and runs them both on your screen (possibly overlapping, but just start them separated).
Main (shown on the left) is basically an Event Structure with a Stop Command -- all the Event Structure does is to transfer a number entered into the control Main VI # to an indicator, From Main, and to stop the Event Structure when the Stop button is pushed. It also has the Sub-VI (shown with an Icon that looks like a While Loop, something I call a "Loop" VI, or "Run until I tell you to stop") -- the Green Pipe going into it is a Tag Channel Wire that lets the Main tell the Sub-VI to stop.
The Sub-VI, on the right, is a similarly trivial routine. It has a U8 indicator that gets changed into an Array of Booleans "just to look at". It has its own Stop button, as well. Notice the Stop Tag? That's where the Tag Channel from Main is wired -- its Channel Reader is inside the Timeout Case of the Event Loop, checked 10 times a second. When the Main Stop is pressed, it sends the Stop value to the Sub-VI, which stops the sub-VI.
So why is the sub-VI "visible"? Most LabVIEW sub-VIs are "invisible", right? Open the sub-VI, and read its Description (which I wrote), which tells you how to make this sub-VI "Show Front Panel when Called".
Bob Schor