01-24-2024 07:43 AM
Is there any way you can show us what you've done so far? I think if we SEE what you've have already, we can better understand what kind of stop mechanisms you can use. Package up all your VIs and your project file in a ZIP file and send it to us.
If not, can you give us an example of how you have it structured? Seeing what you've done can tell us SO MUCH MORE than words can.
01-24-2024 09:29 AM
@1984 wrote:
You certainly shouldn't need to send multiple AppStop, then you have some bad design. If VIs are serial it's easy enough to send out a Stopped boolean or simply set an error "User stopped" that'll prevent the following VIs to run.
As for parallell tasks, a Notifier or Event solves it well.
As I wrote above my VIs use event structures. If during the execution of VI#1 the event occurs it stops VI#1, but then VI#2 again registers the event (or I roll the dynamic event terminal from VI to VI) as the event is alreay fired it just stay there.
I could query the notifier status periodically but right in the original post I mentioned that I'd like to avoid continously polling something in the timeout of the event structure. As this would be a very simple latching notifier I wouldn't even bother using it cause I could use a latching FGV.
Stop boolean? Sure it might work if you have four VIs, not when you have hundreds. Plus of course does not work with events.
An error could be used, thats true. Its not the holy grail thoughas at a certain point I need to differentiate between "non-critical" and "app stop" type errors which again introduces a new coding "must do".
Passing from one event structure to another is not really an ideal architecture, especially if those event structures are being used for application control.
There's a few ways you can tackle this. Quickly off the top of my head, a basic way would be to use a simple state machine inside the timeout case of your event structure to execute these VIs in sequence. A stop event occurring in between iterations will trigger the stop case to run instead.
01-25-2024 09:15 AM
@1984 wrote:
An error could be used, thats true. Its not the holy grail thoughas at a certain point I need to differentiate between "non-critical" and "app stop" type errors which again introduces a new coding "must do".
That's what custom error codes are for. I use these custom error codes in one of my larger programs.
5000 Safe Operating Limit Trip
5001 Find Instrument Fail
5002 EOT Shutdown
5003 User Abort
5004 Emergency Stop
5005 Application Closed
5000 and 5004 instantly disable all power sources, turn off all high current DC switches, and initiates a buffer dump of measurements taken at 100mS intervals of the 10 seconds prior to the error trip.
5001 Just throws an error message and allows the end user to try again or exit
5002 Shuts everything down and exits
5003 and 5005 askes the use if they want to leave the UUT powered or shutdown then exits
01-25-2024 10:16 AM - edited 01-25-2024 10:21 AM
If not, can you give us an example of how you have it structured? Seeing what you've done can tell us SO MUCH MORE than words can.
Sure, see the BD below.
How does it work:
(there is nothing in the other case of the case structures just passing thru the inputs)
(Generating the event once is a problem which I have described earlier in my posts so the most actual version of this VI (not attached) generates an event everytime its executed and an error occured, meaning that AppExit event is generated multiple times)
This VI is used in two ways:
01-26-2024 03:52 AM
@1984 wrote:
You certainly shouldn't need to send multiple AppStop, then you have some bad design. If VIs are serial it's easy enough to send out a Stopped boolean or simply set an error "User stopped" that'll prevent the following VIs to run.
As for parallell tasks, a Notifier or Event solves it well.
As I wrote above my VIs use event structures. If during the execution of VI#1 the event occurs it stops VI#1, but then VI#2 again registers the event (or I roll the dynamic event terminal from VI to VI) as the event is alreay fired it just stay there.
Thus the comment about serial VI's. When the 1st gets cancelled it should send out a boolean that it's cancelled or set an error so the following ones don't register.
01-26-2024 03:58 AM
I'd do something like this:
01-26-2024 07:09 AM
@1984 wrote:
Gonna bust your boys a bit here...next time, upload the VI instead of embedding an image. We can't debug images.
01-26-2024 12:05 PM
Cool, mate! Let me bust back bit: if the concept is not clear from the screenshot and detailed explanation then attaching a more complex structure would not go thru either. I can't really attach the VI anyways due to the high number of dependent VIs.
And just to pre-emt a doublebust: I've been on these forums for 15+ years, and never - not even once - I saw an example of somebody receiving effective help based on attaching an entire project. People have no time to understand the concept of others (understandable) and if somebody does attach a project then the conversation immediately deters unrelated nuances of the code (not understandable).
No offense (and non taken on my side) and I appreciate your efforts trying to answer my question!