LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modulable timeout in event structure

Hello everybody , I would like to add a timeout to an events/messages handling loops system, but I want to change the timeout value as a function of the event case. Moreover  the events I have to deal with are of different types (strings, booleans, numerical values).
Many thanks in advance for your help!

0 Kudos
Message 1 of 10
(228 Views)

Keep the timeout in a shift register and modify it in the events as needed.

0 Kudos
Message 2 of 10
(220 Views)

You can use Wovalab Utilities to get more flexible control over timeout.

Screenshot 2025-02-13 16.41.48.png

Message 3 of 10
(209 Views)

Hi,

thanks a lot for your quick answer but I must confess that I'm not sure to understand how to implement your suggestion.
If I add a shift register to the while loop, how can I set a different time value for each event case?

Tibe68_0-1739466735516.png

(I feel so stupid...😞)

0 Kudos
Message 4 of 10
(177 Views)

@Tibe68 wrote:

Hi,

thanks a lot for your quick answer but I must confess that I'm not sure to understand how to implement your suggestion.
If I add a shift register to the while loop, how can I set a different time value for each event case?


So easy:

snippet.png

0 Kudos
Message 5 of 10
(171 Views)

@Tibe68 wrote:

Hi,

thanks a lot for your quick answer but I must confess that I'm not sure to understand how to implement your suggestion.
If I add a shift register to the while loop, how can I set a different time value for each event case?

Tibe68_0-1739466735516.png

(I feel so stupid...😞)


Andrey may have answered your question, but the way you word things here leads me to think that maybe he hasn't answered it exactly because you might not be understanding what the "timeout" case actually does.

 

The timeout case DOES NOT affect the currently running case.  It is not a way to force the contents of a given case to end early if they get "stuck".

 

The way the timeout case works is that if no other case has an event occur, the structure waits until the timeout has been reached, and then runs the "Timeout" case for that event structure, of which there can only be one.

 

So you asking "how can I set a different time value for each event case?" seems wrong.  You can make it so that running one event case means that the next loop has a different timeout, in the way that Andrey shows, but the question exactly as asked is invalid because event cases don't have a "timeout"... the whole structure does, and having one per case is not how any of this works.

 

I made this posts a few years ago that has more detail about event structures and might help clear things up:

https://forums.ni.com/t5/LabVIEW/Struggling-with-Event-Structures/m-p/4086346#M1176175

 

0 Kudos
Message 6 of 10
(159 Views)

@Kyle97330 wrote:
The timeout case DOES NOT affect the currently running case.  It is not a way to force the contents of a given case to end early if they get "stuck".

Common sense dictates that any event case need to complete quickly and without user interaction, so I did not even consider the (maybe misunderstood) requirements of the sparse question. My solution will change the timeout time of the timeout event, that can sometimes be useful.

 

I often do the final calculation and indicator updates in the timeout case and all events that require it, will set the timeout to a very small value. In the timeout case, I set the timeout back to -1 (i.e. infinite), so the program idly waits again for user interactions that trigger any of the other events, followed by another single timeout.

 

to the OP: Once you show us some code and explain the perceived problem you are trying to solve in detail, we can give more specific advice.

0 Kudos
Message 7 of 10
(148 Views)

Hello,
thank you all for your help and valuable explanations. Indeed, I should have explained my case better, but I am also struggling with the language barrier 🙂. Only some of the cases in the "Event Structure" I am using require a timeout. For example, I send a command to a PLC to turn on a device and wait for the PLC's response to confirm that the device is indeed on. If the waiting time is too long, there is a problem, and the program needs to intervene.

So my question is: how can I ensure that only certain cases are subject to the timeout while others are not? I understand that this may not be possible.

0 Kudos
Message 8 of 10
(106 Views)

Based on your description above, I have a strong feeling that the State Machine design pattern will be much better suited rather than the Event Structure (which can be easily combined with SM as well).

Message 9 of 10
(99 Views)

I agree. You cannot use the timeout of an event structure for any of that, because it may bever execute (for example any other even will break the timeout). An event structure is mostly for the user interface.

 

Maybe take a step back and explain the functional requirements in more general terms. Tell us "what" you want to do, not "how" you want to do it!

0 Kudos
Message 10 of 10
(62 Views)