commonpower.control.runners.DeploymentRunner
- class DeploymentRunner(sys: ~commonpower.core.System, global_controller: ~commonpower.control.controllers.OptimalController | None = None, alg_config: ~commonpower.control.configs.algorithms.SB3MetaConfig | ~commonpower.control.configs.algorithms.MAPPOBaseConfig | None = None, wrapper: ~gymnasium.core.Wrapper | None = None, horizon: ~datetime.timedelta = datetime.timedelta(days=1), dt: ~datetime.timedelta = datetime.timedelta(seconds=3600), continuous_control: bool = True, history: ~commonpower.modeling.history.ModelHistory | None = None, solver: ~pyomo.opt.base.solvers.OptSolver = <pyomo.solvers.plugins.solvers.gurobi_direct.GurobiDirect object>, seed: int | None = None, normalize_actions: bool = True)[source]
Bases:
BaseRunnerRunner for the deployment of multiple heterogeneous controllers (RL, optimal control).
- Parameters:
sys (System) – power system to be controlled
global_controller (OptimalController) – instance of controller taking over control of all nodes that have not yet been assigned a controller. Mostly used to balance the system using a market node or a generator. Defaults to OptimalController(“global”).
alg_config (Union[SB3MetaConfig, MAPPOBaseConfig]) – configuration for the RL algorithm and policy to be trained
wrapper (gym.Wrapper) – wrapper for the environment that handles the RL agents during training (used for example for single-agent RL control).
horizon (timedelta) – amount of time that the controller looks into the future
dt (timedelta) – control time interval
continuous_control (bool) – whether to use an infinite control horizon
history (ModelHistory) – logging
solver (OptSolver) – solver for optimization problem
seed (int) – seed for the global random number generator of numpy (we use np.random.seed(seed) instead
generator) (of instantiating our own)
normalize_actions (bool) – whether or not to normalize the action space
- Returns:
DeploymentRunner
Methods
finish_runTerminates run.
Prepare the deployment by initializing the system and its controllers.
runSimulates the scenario for a given number of time steps.
set_start_timeSet start time from external.
system_feasibleCheck whether the current system set-up is feasible.
- _run(n_steps: int = 24)[source]
Runs the deployment of multiple heterogeneous controllers for a given number of time steps.
- Parameters:
n_steps (int) – number of time steps to run the system for
- Returns:
None
- prepare_run()[source]
Prepare the deployment by initializing the system and its controllers. Assigns a global controller that takes over control of all entities which require inputs and have not been assigned a controller by the system’s set-up. Sets the operation mode of all RL controllers within the system to ‘deployment’.
Returns: