11-26-2009 05:52 AM
Hello
I have used state diagram which has a flat sequence in one of it's states.
The VI should be stopped by a emergency stop button. But it can not exit the sequence suddenly.
How should use emergency stop.
Tanks alot,
Bafarani
11-26-2009 05:59 AM
Bafarani,
this is one reasson not to use the sequence structure at all. You have to rework the codedesign to a proper architecture capable of exiting ongoing tasks right away.
Another possible solution would be: Let the algorithm go on, but every time the algorithm tries to access outputs, prohibit this by usage of an "emergency flag".
hope this helps,
Norbert
11-26-2009 07:13 AM
Totally agree with Norbert.
Try to stay away from Flat and (especially) Stacked Sequence Structures.
As for an Emergency Shutdown, you can implement that as part of the code using an Event Structure (preferred) or a State Machine. You do not need (or want) to kill the VI which is running. You should always shut-down gracefully. However, you can immediately stop the process that you want to stop by hitting the emergency stop button.
What process are you trying to stop? curious..
11-26-2009 07:36 AM
In my structure a control signal is sending for an ICE. I want to reset it to zero whenever I push emergency stop.
I can’t remove sequence or use another solution because the procedure should be done sequentially.
In my structure a control signal is sending for an ICE. I want to reset it to zero whenever I push emergency stop.
I can’t remove sequence or use another solution because the procedure should be done sequentially
11-26-2009 07:58 AM
Flat or Sequence Structures do not ensure sequential flow of what is inside the frame.
To ensure sequential flow, you need to make sure that data flows in the proper sequence. This is done using the wires.
And yes, you can implement a solution using either an Event Structure (which will respond to operator input or other set events) or a State Machine (or better yet, a combination of both in producer consumer architecture).
11-26-2009 08:52 AM
True, but keeping it in a single loop. You dynamically set the timeout of the event structure and then each of your sequential frames (or even parts of frames) would be its own state in the statemachine. You then interleave each part of what your execution with a visit to the event structure, this way if the user hits the 'emerency' stop, you can process that stop and do whatever you need.
-p
11-26-2009 08:57 AM
Well, before everyone gets too deep into assumptions and different (possible) solutions, a very, very, very important question:
Is your emergency stop really "emergent"?
This means:
Do you have the requirement to deterministically react on the action "pressing the emergency button" within a given time? Is the emergency button a hardwarebutton or is it an user interface component?
All possible solutions depend on these two questions. If you do not answer them, further postings of solutions is (at least in my opinion) only posting assumptions and "could be's"......
Norbert
11-26-2009 11:27 AM
You're absolutely right Norbert..
I fell into the "assumption" trap, didn't I? 😉
12-14-2009 09:00 AM
Dear Norbert;
It is an user interface component. In fact, it's a HIL test. So I have to stop the software by emergency stop button and consequently hardware should be stopped.
12-14-2009 09:19 AM
Ok, do you have a certain timing requirement for the hardware to stop?
If not, you can simply change your architecture for something like a state machine (as suggested by Ray and Paul).
If you need to meet a special requirement, you possibly cannot do this using software (depending of the "size" of the time). You would need to disconnect the stop button from the normal software flow and define a stop routine for every possible functionality. When the stop button is hit, each running module would have to terminate within the given time.
Remember that Windows is no deterministic OS.....
Norbert