water_benchmark_hub.gym
water_benchmark_hub.gym.scenario_control_env
Module provides a base class for control environments.
- class water_benchmark_hub.gym.scenario_control_env.ScenarioControlEnv(scenario_config: epyt_flow.simulation.ScenarioConfig, autoreset: bool = False, **kwds)
Bases:
BenchmarkResource,ABCBase class for a control environment challenge.
- Parameters:
scenario_config (
ScenarioConfig) – Scenario configuration.autoreset (bool, optional) –
If True, environment is automatically reset if terminated.
The default is False.
- property autoreset: bool
True, if environment automatically resets after it terminated.
- Returns:
True, if environment automatically resets after it terminated.
- Return type:
bool
- close() None
Frees all resources.
- reset() epyt_flow.simulation.ScadaData
Resets the environment (i.e. simulation).
- Returns:
Current SCADA data (i.e. sensor readings).
- Return type:
ScadaData
- set_node_quality_source_value(node_id: str, pattern_id: str, qual_value: float) None
Sets the quality source at a particular node to a specific value – e.g. setting the chlorine concentration injection to a specified value.
- Parameters:
node_id (str) – ID of the node.
pattern_id (str) – ID of the quality pattern at the specific node.
qual_value (float) – New quality source value.
- set_pump_speed(pump_id: str, speed: float) None
Sets the speed of a pump.
- Parameters:
pump_id (str) – ID of the pump for which the pump speed is set.
speed (float) – New pump speed.
- set_pump_status(pump_id: str, status: int) None
Sets the status of a pump.
- Parameters:
pump_id (str) – ID of the pump for which the status is set.
status (int) –
New status of the pump – either active (i.e. open) or inactive (i.e. closed).
Must be one of the following constants defined in
ActuatorConstants:EN_CLOSED = 0
EN_OPEN = 1
- set_valve_status(valve_id: str, status: int) None
Sets the status of a valve.
- Parameters:
valve_id (str) – ID of the valve for which the status is set.
status (int) –
New status of the valve – either open or closed.
Must be one of the following constants defined in
ActuatorConstants:EN_CLOSED = 0
EN_OPEN = 1
- abstract step(*actions) tuple[epyt_flow.simulation.ScadaData, float, bool] | tuple[epyt_flow.simulation.ScadaData, float]
Performs the next step by applying an action and observing the consequences (SCADA data, reward, terminated).
Note that terminated is only returned if autoreset=False otherwise only the current SCADA data and reward are returned.
- Returns:
Triple or tuple of observations (
ScadaData), reward (float), and terminated (bool).- Return type:
(
ScadaData, float, bool) or (ScadaData, float)