Closed ga72kud closed 2 years ago
@ga72kud please provide a minimum working example code for what you are doing so as to best help.
@hdavid16, thank you for answering. I try a fictive example that might not work or make no sense to clarify the issue.
The idea of following a minimal example is that I have a simulation where the simulation will run 5 seconds and an event to call a function sample_number every Ts (sample time).
The question is if there is a possibility to reduce 5 seconds of simulation when in sample_number some condition is fulfilled? For example, in my simulations, I simulate an autonomous vehicle, which might take 50 seconds, but when there is a collision, the simulation should stop. I am not sure if the package DiscreteEvents is providing something. I know that there are possibilities from JuliaLang.
@event sample_number(c) DiscreteEvents.every Ts
@run! c 5s (running 5 seconds)
If it is not available, this might be a feature request...
So it sounds like you want to interrupt events. In your example, if a collision event occurs, then interrupt the main event. Right?
https://pbayer.github.io/DiscreteEventsCompanion.jl/dev/examples/queue_mmc_srv_fail/
The link above might help setting up an interruption (failure)
Yes
I currently had no time to read the example, but I guess this will work
Is there any possibility to finish all events by a condition?
For example, I have a variable TMAX to finish all events after, let's say, 5 seconds. But if an agent completes the task in my simulation, the simulation should stop before TMAX has ended.