07-25-2018 07:06 AM
Hi All,
I want to ask if it is possible to clear/stop the Timeout event if a condition is full filled or how do you handle this Timeout event correctly?
In my application I have a plant that needs a certain start sequence and as shown in the attached picture the Power up State of the state machine check whether LED is switched on(this LED is controlled by PSU ) if the PSU did not initialize correctly the PSU LED will remain OFF and in this case a Timeout should occur and reset the system.if the PSU initialized correctly the LED will be ON and the State Machine will move on to the Next state after it executed the sequence structure.
To come back to my uncertainty if I use a Timeout event to fire after 2 sec and the LEd is still of it can reset the system however when the PSU initialized and I do not want the timeout to fire now can you stop it clear it ,
I am not sure how to handle this,It is also not possible to post the VI because of its size and IP contractual agreements.
Thanks again as always for the help of this Forum
Solved! Go to Solution.
07-25-2018 07:26 AM
Two options:
1) remove events and modify state machine: add time checking. If the initialization has passed, go to control state. If the time is up, go to reset state.
2) add a user event. Then in the structure will be a timeout and this event, each with its own logic.
The first option is more logical in my opinion.
07-25-2018 07:30 AM
Where is this Event Structure in relation to the state machine? It might help if you attached your actual code instead of pictures.
07-25-2018 07:44 AM
An Event Structure is almost never "naked" (without a surrounding While loop). If you wire -1 to the "Time-to-fire" input of the Timeout, you will effectively turn it off (it may actually fire when 2^32 milliseconds, just over 7 weeks, elapses, but I think you don't need to worry about that).
Instead of wiring a constant (2000) to the Time-to-Fire terminal, wire a Shift Register from the surrounding While to it and pass the wire through the Event loop. Initialize it (outside the While) with 2000. When you detect the Event that says "Turn off the Timeout", wire -1 to the wire leading out of the Event. To turn it back on, use an Event and wire 2000.
Note that if you don't have a Front Panel Event set to fire for these conditions, you can program a User Event (perhaps "Timeout", with True meaning "Make it 2000" and False meaning "Make it -1"). If you aren't familiar with User Events, look them up in LabVIEW Help. Here's also a Snippet showing how you might do this:
Bob Schor
07-25-2018 08:00 AM - edited 07-25-2018 08:01 AM
Hi All
Thank you very much for the advise it is truly helpful !
The picture of the event structure is purely a indication of the 2000 connected it it is at the moment not part of the code it was used only for the purpose of my question,
Bob Thank you for your time and effort in showing me some directions, thank you to Artem as well for your input
07-25-2018 08:07 AM
@Bob_Schor wrote:
An Event Structure is almost never "naked" (without a surrounding While loop). ...
Bob Schor
I use a naked event structure in pop-up dialogs quite often. The event structures generally are registered for only the "Enter" of "Cancel" buttons. The fields entered by the users are read in that event case.
"No spinning required"
Ben
Ben
07-25-2018 11:24 AM
@Ben wrote:
I use a naked event structure in pop-up dialogs quite often.
As do I (but on rare occasions). I do, however, sometimes blush when this occurs ...
Bob Schor
07-25-2018 12:14 PM
@Bob_Schor wrote:
@Ben wrote:
I use a naked event structure in pop-up dialogs quite often.As do I (but on rare occasions). I do, however, sometimes blush when this occurs ...
Bob Schor