DiscreteEventsLite.DiscreteEventsLiteModule

API:

  • Scheduler: scheduler object
  • Event: event object
  • run!: run simulation
  • remove_event!: remove event
  • stop!: stop simulation
  • register!: add event to scheduler
  • reset!: reset scheduler
  • replay_events: print out completed events
  • when types: now, at, after, every

Use help for more information, e.i.

] register!
DiscreteEventsLite.EventType
Event <: AbstractEvent
  • fun: a function
  • time: time of function call
  • id: an event id
  • type: type of event
  • description: a description of the event
DiscreteEventsLite.SchedulerType

Scheduler <: AbstractScheduler

  • events: a priority queue of events
  • time: current time of the system
  • running: simulation can run if true
  • trace: will print out the events if true
  • store: will store a vector of completed events if true
  • complete_events: an optional vector of completed events
DiscreteEventsLite.SchedulerMethod

Constructor for Scheduler with default keyword values:

Scheduler(;event=Event, time=0.0, running=true, trace=false, store=false)
DiscreteEventsLite.register!Method
register!(scheduler, fun, when, t, args...; id="", description="", kwargs...)

An interface for adding events to the scheduler.

Arguments

  • scheduler: an event scheduler
  • fun: a function to execute
  • when: timing for the execution of fun. Options: at, now, every, after
  • t: time value associated with when
  • args...: optional positional arguments for fun
  • id: optional id string
  • description: optional description

Keywords

  • kwargs...: option keyword arguments for fun
DiscreteEventsLite.remove_events!Function

remove_events!: remove events by id -s: scheduler

  • until: run until
  • f: removal function. Defaults to exact match.

Function signiture:

remove_events!(scheduler, id, f=(x,id)->x.first.id == id)
DiscreteEventsLite.reset!Method
reset!(scheduler)

Resets time to 0 and empties event queue

Arguments

  • scheduler: an event scheduler
DiscreteEventsLite.run!Function
run!(s::AbstractScheduler, until=Inf)

Run simulation until specified time

Arguments

  • scheduler: an event scheduler
  • until: time at which simulation ends