Simulation¶
The Simulation class orchestrates the time-step loop over the energy system horizon.
For each step, it obtains a control action, advances the system, performs grid balancing,
and stores the resulting step data.
The detailed simulation flow is documented in the user guide section Simulation Flow.
Simulation
¶
Simulation(
energy_system: EnergySystem,
controller: Optional[ControllerABC] = None,
)
The Simulation iterates over all simulation time steps of the EnergySystem, asks
the controller for an action, applies the action through the
EnergySystem, balances any remaining power via the grid builder, and
stores one SimulationStepResult per step.
For a detailed sequence diagram and step-by-step explanation of the simulation flow, see the user guide section "Simulation Flow".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy_system
|
EnergySystem
|
The EnergySystem to simulate. |
required |
controller
|
Optional[ControllerABC]
|
The |
None
|
nrgise.Simulation.register_hook
¶
register_hook(func: SimulationHook) -> None
Register a function to be executed after each completed simulation step (aka. hook). A hook can be used to inject custom logic into the simulation loop.
Required function signature:
def function_defining_the_hook(simulation: Simulation, step_result: SimulationStepResult) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
SimulationHook
|
Hook function matching |
required |
nrgise.Simulation.run
¶
run() -> pd.DataFrame
Run the simulation by looping through the energy system time index.
For each time step, this method:
- queries the controller for a control action by passing the current
State, - advances the
EnergySystemby one step by applying the action, - balances remaining power via the grid builder,
- records the resulting
SimulationStepResult, and - executes registered simulation hooks.
- updates the
Statefor the next time step.
Returns:
| Type | Description |
|---|---|
DataFrame
|
Simulation results as a Pandas DataFrame indexed by |