Scheduler¶
This module contains the definition of a scheduler. It has the definition of the Scheduler that allows schedule events and execute them using the FEL paradigm·
Example
Creating an scheduler:
scheduler = Scheduler()
Scheduling an event:
scheduler.schedule(model, Time(2))
# or
model.schedule(Time(2))
Deleting an scheduled event:
scheduler.unschedule(model)
# or
model.unschedule()
Get a set of imminent events:
next = scheduler.get_next_models()
Get a set of imminent events and removes them from the FEL:
next = scheduler.pop_next_models()
-
class
gsf.dynamic_system.future_event_list.scheduler.
Scheduler
¶ Bases:
object
It executes the autonomous events of discrete-event models.
-
_future_event_list
¶ Collection of scheduled models. It is used as a min-heap.
- Type
List[ScheduledModel]
-
get_future_event_list
()¶ Returns the future event list
-
get_next_models
()¶ Gets the next models that will execute an autonomous event
-
get_time_of_next_event
()¶ Gets the time of the next event
-
pop_next_models
()¶ Gets the next models that will execute an autonomous event and removes it from the heap
-
schedule
()¶ Schedule an event at the specified time.
- Parameters
model (DiscreteEventModel) – DiscreteEventModel with an autonomous event scheduled
time (Time) – Time to execute an autonomous event
-
unschedule
()¶ Drop a model from schedule.
- Parameters
model (DiscreteEventModel) – DiscreteEventModel with an autonomous event scheduled.
-
update_time
()¶ Updates the time of the events
- Parameters
delta_time (Time) – Time that has passed since the last update
-