LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controls that trigger event structure timeout case

Solved!
Go to solution

In an event structure, we can relate controls to the timeout event. But if we do it this way, we don't get event data node related to the controls. I don't know whether this is a good practice and whether there are potention issues. Please comment. Thanks.

0 Kudos
Message 1 of 11
(6,727 Views)

I don't understand the statement or the question.  The Timeout Event "fires" when the indicated Time elapses with no other Event firing.  You can do anything you want in that Event (or, if you don't need it, you can leave it out of the Event Structure altogether).

 

I would have a much easier time understanding your question if you posted some code (please, attach a VI, not just a picture, so we can see the entire Event Structure, i.e. all of the Events, and can even "try it out").

 

Bob Schor

0 Kudos
Message 2 of 11
(6,719 Views)

I never needed to use a control together with a Timeout case of an Event Structure. I cannot imagine why it is needed for you. Could you explain why you need this?

0 Kudos
Message 3 of 11
(6,715 Views)

@Blokk wrote:

I never needed to use a control together with a Timeout case of an Event Structure. I cannot imagine why it is needed for you.


That was my immediate thought.  Still haven't thought of a good reason to do this.


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 4 of 11
(6,701 Views)

My guess is let's say instead of -1 keep maybe some timeout value 100ms and manipulate the control values regularly after 100ms?

-If that is the case, the timeout event is not connected any specific control instead to entire Application. So you might do extra processing to get the values of controls indirectly in case of timeout(Like getting the values of controls programatically).

-Well as others asked it might be the question why matters to give better explanation of what you are thinking or trying to achieve.

Thanks
uday
0 Kudos
Message 5 of 11
(6,694 Views)

I have an "auto test" button, when then button is false, we have -1 to the timeout terminal; when the button is pressed, I want the program to go through timeout case. Of course I can create another case for the "auto test" button value change, but this case will not do much, just send the 100 to the timeout terminal. 

0 Kudos
Message 6 of 11
(6,688 Views)
Solution
Accepted by topic author guangdew1

@guangdew1 wrote:

In an event structure, we can relate controls to the timeout event. But if we do it this way, we don't get event data node related to the controls. I don't know whether this is a good practice and whether there are potention issues. Please comment. Thanks.


A "practice" is what you do. You are talking about a limitation (or feature). Event data nodes only show items that are common to all events of that particular event case, so e.g. "old/new val" is not available if there is also a timeout assigned. If you don't need them, it does not matter if they are there or not.

This is often not a problem because you typically only need the new value and you can get that by placing the control terminal inside that event.

If you need the specific event data node, create an otherwise empty dedicated event case for the control and fire the timeout event by temporarily setting the timeout to zero via a shift register. Set the timeout back to zero in the timeout event case. If the new value is also needed in the timeout event, leave the terminal inside the timeout event use the newval from the event data node in the specific case.

Message 7 of 11
(6,674 Views)

I have the feeling you could do much easier with a proper State Machine. I guess you try to program all required functionality with a simple Event Structure in a While loop? If so, I advise you to have a look how a proper State Machine works (either using a single While loop with cases where the Event structure is in one "Check GUI" case, or the Producer/Consumer (Events) design is also very useful).

0 Kudos
Message 8 of 11
(6,673 Views)

@guangdew1 wrote:

I have an "auto test" button, when then button is false, we have -1 to the timeout terminal; when the button is pressed, I want the program to go through timeout case. Of course I can create another case for the "auto test" button value change, but this case will not do much, just send the 100 to the timeout terminal. 


Sorry, I did not see your post here. Yes, there is no problem adding specific control events to the timeout event. You don't need to add specific events just to trigger the timeout unless you need the specific event data node.

A few versions ago, having specific events was more important to add code to prevent accumulation of stale events in the event queue, but now we can set the queue size.

Message 9 of 11
(6,663 Views)

altenbach, thanks for the explanation which made feel assured that this is an okay way, even though it's not a very common practice. As you mentioned, I don't get the new value from the data node, but if I have the control or local variable inside of the case, I get the new value. 

0 Kudos
Message 10 of 11
(6,623 Views)