Base Simulator

This module contains the abstract definition of a simulator. It has the definition of BaseSimulator, that should be extended, implementing its abstract methods.

Example

Creating a simulator:

class NewSimulator(BaseSimulator):

    def compute_next_state(self, input):
        self._dynamic_system.state_transition(input)

    def compute_output(self):
        return self._dynamic_system.get_output()
class gsf.simulation.core.base_simulator.BaseSimulator(dynamic_system: gsf.dynamic_system.core.base_dynamic_sytem.BaseDynamicSystem, base_generator: gsf.reports.core.base_report.BaseReport, event_bus: Optional[event_bus.bus.EventBus] = None)

Bases: object

Abstract simulator engine.

An simulator engine executes the state transition function of the dynamic system, computes the output and reports it.

_dynamic_system

Dynamic system to be simulated.

Type

BaseDynamicSystem

_is_output_up_to_update

Indicates if the output was computed for that iteration.

Type

bool

_report_generator

Current report generator where engine saves the outputs.

Type

BaseReport

_event_bus

Event bus of the module.

Type

EventBus

abstract compute_next_state(*args, **kwargs)

Compute the next state of the dynamic system.

Parameters
  • *args

  • **kwargs

abstract compute_output()

Compute the output of the dynamic system if it has not computed yet

init()

Initializes the simulator properties