Showing results for 
Search instead for 
Did you mean: 

Empty buffer every defined time


Hello everyone, I would like to simulate piles of materials that are moved in the factory every X hours or at defined hours during the day. I tried to use an exit method with the "waituntil" function to unlock the exit of the Pile buffers at a defined time until the buffer is empty. In the example below, I would like to empty this buffer and morve the parts at 12:00:00. 


waituntil timeOfDay(Ereignisverwalter.absZeit)-str_to_time("12:00:00.0")=0
    ?.exitlocked := false
    waituntil ?.empty
    ?.exitlocked := true


However, the waituntil function does not work. Is there a better way to do it? What am I missing?

Thank you in advance for your help.


Re: Empty buffer every defined time

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
you could try a generator (see help)
Steffen Bangsow
freelance simulation specialist  

Re: Empty buffer every defined time

Valued Contributor
Valued Contributor

Hello cferry,


I would advice you to use the Generator, as Steffen_B said above, or the Trigger depending on your schedules. While the first one is easier to set up, the Trigger allows you to define a more complex schedule, and the both of them can be repeated periodically. If you have further questions about how to use them, they are well explained in the user's help.

In any case, you will have to define a method which will be executed at the desired time. This method could be something like the following:


myBuffer.exitLocked:= false

waituntil myBuffer.Empty = true

myBuffer.exitLocked:= true


Your example will not work due to different factors. The first one is that you can not watch the EventController simulation time. Even if that was possible, you will execute the method every time a part is exiting the buffer, thus creating and overload of suspended methods which may be executed without your control.


I always try to minimize the number of methods that will be executed at any time in the simulaton in order to make it more understandeble, easier to track and error-proof.


I hope it was helpful.

Re: Empty buffer every defined time


Thanks guys, I tried the generator and it works for me!