Cancel
Showing results for 
Search instead for 
Did you mean: 

Waituntil, but wait maximum X amount of time

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hi,

 

I want to use a waituntil statement but be able to ignore it and continue regardless if it is fulfilled or not when it have waited for a certain time.

 

So I had an idea to use something like this

waituntil (Buffer.numMu > 0 and Station.occupied = false) or timer = 0


But I can't figure out a way to create a functional timer.

 

 

Another thought I had was something like this:

var timer := 10:00
var stopTime := eventcontroller.simtime + timer
waituntil (Buffer.numMu > 0 and Station.occupied = false) or eventcontroller.simtime > stoptime

But you can't watch the eventcontroller, so this doesn't work. 

 

Any other ideas?

6 REPLIES

Re: Waituntil, but wait maximum X amount of time

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

the second variant should work, you can observe simTime (see example --> exit control station)

 

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Waituntil, but wait maximum X amount of time

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

That's interesting. I get this error when I try it:

 

cont_watch_eventcontroller.PNG

 

 

Any idea why?

Re: Waituntil, but wait maximum X amount of time

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
Are you in the class library? EventController is a global attribute of the frame and returns the active EventController of the model, you could try to address the eventcontroller directly (absolute address)
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Waituntil, but wait maximum X amount of time

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

The value of the command "eventcontroller" was linked to the correct eventcontroller in my model. When I changed it to "root.eventcontroller" I still got the same value, but I did not get the error in my image above. 

 

So this "root." solved the issue somehow. Thanks for the help!

Re: Waituntil, but wait maximum X amount of time

Genius
Genius

Hello,

 

juste in case you don't see that

 

waituntil condition [prio number] [wait timespan:time]
stopuntil condition [prio number] [wait timespan:time]

waituntil have a new param named "wait" to waituntil a condition or a time.

 

Regards,

 

rpinon

Re: Waituntil, but wait maximum X amount of time

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

I had completely missed that, thanks for the input!