02-24-2020 10:42 AM
You'll have to show us the hole (relevant) program.
If you use a static VI reference, and than a Open VI Reference with the name, you can use the "Abort" method to stop it. You can do this on start of the program.
A better approach is to have a graceful close of the VI. Send it a signal (a queue or a user event).
Yet another approach is to start the VI dynamically, to close the ref automatically when running it, and not use a close to close the reference. The VI will be closed (and stopped) when the caller stops. This is tricky, though.
02-26-2020 08:23 AM
Shure,
So in my main program, I will have 4 parallel while loops, and send some queue data across them. I am using the queue to also stop that while loops (that works okay):
I have another loop that understands some behaviors, and when I push a button for opening the new VI it works. Also in that new opened VI I have an event that when I close the VI or push the Close button of this VI, send an update status for the main VI. So I open the new VI with this:
In the main loop of the main program, I am checking for the Stop button or Close windows, to proceed with stoping the program running:
Close Opened Display VI block:
The only problem occurs when I push the Stop button with the new VI opened. It closes and stop the program, but when I start again the program, the status of the new opening VI is being monitored (with the following diagram), and I get "Run top level" when I really should be "idle". As I mentioned, it works fine if i close the new VI, the status is getting update, but when I stop the main program, it closes the new opened VI and the status is not updated when I start the program again. This debug of the new opening VI is monitored inside of one of my loops.
02-26-2020 10:34 AM
Posting blurry pictures of parts of block diagrams is useless.
02-27-2020 03:21 AM
Sorry about that...
Attached is the program that I am building.
02-27-2020 04:43 AM
@PMSilva wrote:
The only problem occurs when I push the Stop button with the new VI opened. It closes and stop the program, but when I start again the program, the status of the new opening VI is being monitored (with the following diagram), and I get "Run top level" when I really should be "idle". As I mentioned, it works fine if i close the new VI, the status is getting update, but when I stop the main program, it closes the new opened VI and the status is not updated when I start the program again. This debug of the new opening VI is monitored inside of one of my loops.
FP.Close doesn't stop the VI, it closes the front panel. Use the Abort method to stop it (and FP.Close to close it's panel).
A better approach it to make a graceful shutdown. For instance with a user event... If the parallel process is, for example, saving a file, the abort will very likely corrupt the file.
02-27-2020 04:55 AM
Thank you so much. This really work without crashing the app.
What is the best approach to send data to another VI? I am using something like this (and works)
02-27-2020 05:05 AM
@PMSilva wrote:
Thank you so much. This really work without crashing the app.
What is the best approach to send data to another VI? I am using something like this (and works)
That passes the cluster. But once it's (data) is passes, you won't be able to change it.
If you pass the queue reference, the VI you started and the VI that started it will be able to communicate over that queue.
Other option are (a non-comprehensive list):
+ user events
+ notifiers
+ control references (you can use VI server to get a VI's controls, and than set it's value)
+ (functional) globals to pass values
+ (functional) globals to pass user events, queues, notifiers, etc.
02-28-2020 02:49 AM
That option gives me an idea for the future.
In this application, I only need to pass the data to the other VI and process it there.
Thank you for your support.
02-28-2020 03:02 AM
Do you have an example of how to pass queue reference from one VI to another one?
03-01-2020 12:27 PM
@PMSilva wrote:
Do you have an example of how to pass queue reference from one VI to another one?
Make a queue reference indicator. Copy paste it on a (new) VI, and change it to a control. Then connect it to the connector pane.
A queue reference isn't different form any other type.