Environment¶
AbstractEnvironment¶
-
abstract AbstractEnvironment
Parent type for event processing environments.
An implementation must at least provide the means to access the current time of the environment (see now
), to process events (see step
and peek
) and to give a reference to the active process (see active_process
).
The class is meant to be subclassed for different execution environments. For example, SimJulia defines a Environment
for simulations with a virtual time.
-
run
(env::AbstractEnvironment) → nothing¶
Executes the step
function until there are no further events to be processed.
-
run
(env::AbstractEnvironment, until::Float64) → nothing
Executes the step
function until the environment’s time reaches until.
-
run
(env::AbstractEnvironment, until::AbstractEvent) → Any
Executes the step
function until the until event has been triggered and will return its value.
-
stop_simulation
(env::AbstractEnvironment, value=nothing)¶
Stops the simulation, optionally providing an alternative return value to the run
function.
Environment¶
-
Environment <: AbstractEnvironment
Execution environment for a simulation. The passing of time is simulated by stepping from event to event.
-
Environment
(initial_time::Float64=0.0) → Environment¶
Constructor of Environment
. An initial_time for the environment can be specified. By default, it starts at 0.0
.
-
now
(env::Environment) → Float64¶
Returns the current simulation time.
-
active_process
(env::Environment) → Process¶
Returns the active process. If no process is active throws a NullException
.