LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timeout event case how stop it

Solved!
Go to solution

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 Forum1.jpg2.jpg

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 1 of 8
(3,286 Views)
Solution
Accepted by topic author QMESAR

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.

0 Kudos
Message 2 of 8
(3,277 Views)

Where is this Event Structure in relation to the state machine?  It might help if you attached your actual code instead of pictures.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(3,272 Views)
Solution
Accepted by topic author QMESAR

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:

Timeout.png

 

Bob Schor

0 Kudos
Message 4 of 8
(3,266 Views)

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 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 5 of 8
(3,255 Views)

@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"

 

Benastonished.gif

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 8
(3,250 Views)

@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

Message 7 of 8
(3,215 Views)

@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


bath.gif

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 8
(3,209 Views)