Discrete Event Control¶
This module contains the definition of a discrete event simulation control. It has the definition of the DiscreteEventControl, that allows control simulations.
Example
Creating a discrete-event control:
...
dynamic_system = some_discrete_event_dynamic_system
simulator = DiscreteEventSimulationEngine(dynamic_system, DefaultReport())
simulation_strategy = ThreadControl()
event_control = DiscreteEventControl(simulator, simulation_strategy)
Simulating a discrete-event simulation:
event_control.start(stop_time=10)
-
class
gsf.control.controls.discrete_event_control.
DiscreteEventControl
(simulator: DiscreteEventSimulationEngine, simulation_strategy: SimulationStrategy, event_bus: EventBus = None)¶ Bases:
gsf.control.core.base_control.BaseControl
Control that executes the discrete-event simulation
Allows the control of discrete-event simulations,
-
_time
¶ current clock time of the simulation.
- Type
Time
-
_execute
(frequency: decimal.Decimal, wait_time: decimal.Decimal, stop_time: decimal.Decimal)¶ Executes the simulation loop number of seconds.
- Parameters
frequency (Time) – Frequency of the simulation computation.
wait_time (Time) – Delay execution for a given.
stop_time (Time) – Duration of the simulation.
-
_finish_simulation
()¶ Finishes the simulation.
-
init
()¶ Initializes the clock and the simulator.
-
next_step
(time: Optional[decimal.Decimal] = None)¶ Executes the next step of the simulation
- Parameters
time (Time) – time of the next step. If it is None, takes the time of the next event.
-
pause
()¶ Pauses the simulation
-
start
()¶ Starts the simulation
- Parameters
start_input – Input of the dynamic system.
frequency (Time) – Frequency of the simulation computation.
stop_time (Time) – Time of the simulation
wait_time (Time) – Delay execution for a given number of seconds.
-
stop
()¶ Stops the simulation
-
property
time
¶ Current clock time of the simulation
-
wait
(timeout: Optional[decimal.Decimal] = None)¶ Waits for the simulation process. :param timeout: time to wait. :type timeout: Time
-