sustaingym.envs.cogen#

Submodules#

Package Contents#

Classes#

CogenEnv

This environment's API is known to be compatible with Gymnasium v0.28, v0.29.

MultiAgentCogenEnv

Multi-agent version of CogenEnv following the PettingZoo API (v1.24.1).

class sustaingym.envs.cogen.CogenEnv(renewables_magnitude: float = 0.0, ramp_penalty: float = 2.0, supply_imbalance_penalty: float = 1000, constraint_violation_penalty: float = 1000, forecast_horizon: int = 3, forecast_noise_std: float = 0.0)[source]#

Bases: gymnasium.Env

This environment’s API is known to be compatible with Gymnasium v0.28, v0.29.

Actions:

Type: Dict(Box(1), Discrete(2), Discrete(2), Box(1),
           Box(1), Discrete(2), Discrete(2), Box(1),
           Box(1), Discrete(2), Discrete(2), Box(1),
           Box(1), Box(1), Discrete(12, start=1))
Action                        Min                 Max
GT1_PWR (MW)                  41.64               168.27
GT1_PAC_FFU (binary)          0                   1
GT1_EVC_FFU (binary)          0                   1
HR1_HPIP_M_PROC (klb/hr)      403.16              819.57
GT2_PWR (MW)                  41.49               168.41
GT2_PAC_FFU (binary)          0                   1
GT2_EVC_FFU (binary)          0                   1
HR2_HPIP_M_PROC (klb/hr)      396.67              817.35
GT3_PWR (MW)                  46.46               172.44
GT3_PAC_FFU (binary)          0                   1
GT3_EVC_FFU (binary)          0                   1
HR3_HPIP_M_PROC (klb/hr)      439.00              870.27
ST_PWR (MW)                   25.65               83.54
IPPROC_M (klb/hr)             -1218.23            -318.05
CT_NrBays (int)               1                   12

Observation:

Type: Dict(Box(1), Action_Dict,
           Box(forecast_horizon + 1), Box(forecast_horizon + 1),
           Box(forecast_horizon + 1), Box(forecast_horizon + 1),
           Box(forecast_horizon + 1), Box(forecast_horizon + 1),
           Box(forecast_horizon + 1))
Observation                   Min                 Max
Time (fraction of day)        0                   1
Previous action (dict)        see above           see above
Temperature forecast (F)      32                  115
Pressure forecast (psia)      14                  15
Humidity forecast (fraction)  0                   1
Target net power (MW)         0                   700
Target process steam (klb/hr) 0                   1300
Electricity price ($/MWh)     0                   1500
Natural gas price ($/MMBtu)   0                   7
Parameters:
  • renewables_magnitude (float) – wind generation capacity

  • ramp_penalty (float) – magnitude of penalty for generator ramping

  • supply_imbalance_penalty (float) – magnitude of penalty for energy/steam supply-demand imbalance

  • constraint_violation_penalty (float) – magnitude of penalty for other constraint violations

  • forecast_horizon (int) – number of forecast steps to include in observation

  • forecast_noise_std (float) – standard deviation of noise on future forecast steps

reset(*, seed: int | None = None, options: dict[str, Any] | None = None) tuple[dict[str, Any], dict[str, Any]][source]#

Initialize or restart an episode.

Parameters:
  • seed (int | None) – optional seed vaue for controlling seed of np.random attributes

  • return_info – determines if returned observation includes additional info or not (not implemented)

  • options (dict[str, Any] | None) – includes optional settings like reward type (not implemented)

Returns:
  • obs – initial state

  • info – initial info dict

Return type:

tuple[dict[str, Any], dict[str, Any]]

step(action: dict[str, Any]) tuple[dict[str, Any], float, bool, bool, dict[str, Any]][source]#

Run one timestep of the Cogen environment’s dynamics.

Parameters:

action (dict[str, Any]) – an action provided by the environment

Returns:
  • obs – new state

  • reward – reward

  • terminated – termination flag

  • truncated – always False, since there is no intermediate stopping condition

  • info – info dict

Return type:

tuple[dict[str, Any], float, bool, bool, dict[str, Any]]

class sustaingym.envs.cogen.MultiAgentCogenEnv(renewables_magnitude: float = 0.0, ramp_penalty: float = 2.0, supply_imbalance_penalty: float = 1000, constraint_violation_penalty: float = 1000, forecast_horizon: int = 12, forecast_noise_std: float = 0.1)[source]#

Bases: pettingzoo.utils.env.ParallelEnv

Multi-agent version of CogenEnv following the PettingZoo API (v1.24.1).

Parameters:
  • renewables_magnitude (float) –

  • ramp_penalty (float) –

  • supply_imbalance_penalty (float) –

  • constraint_violation_penalty (float) –

  • forecast_horizon (int) –

  • forecast_noise_std (float) –

metadata: dict[str, Any]#
step(actions: dict[str, dict[str, numpy.ndarray]]) tuple[dict[str, numpy.ndarray], dict[str, float], dict[str, bool], dict[str, bool], dict[str, dict]][source]#

Run one timestep of the Cogen environment’s dynamics.

Parameters:
  • action – an action provided by the environment

  • actions (dict[str, dict[str, numpy.ndarray]]) –

Returns:
  • obss – dict mapping agent_id to observation

  • rewards – dict mapping agent_id to reward

  • terminateds – dict mapping agent_id to terminated

  • truncateds – dict mapping agent_id to truncated

  • infos – dict mapping agent_id to info

Return type:

tuple[dict[str, numpy.ndarray], dict[str, float], dict[str, bool], dict[str, bool], dict[str, dict]]

reset(seed: int | None = None, options: dict | None = None) tuple[dict[str, numpy.ndarray], dict[str, dict[str, Any]]][source]#

Resets the environment.

Parameters:
  • seed (int | None) –

  • options (dict | None) –

Return type:

tuple[dict[str, numpy.ndarray], dict[str, dict[str, Any]]]

render() None[source]#

Render environment.

Return type:

None

close() None[source]#

Close the environment.

Return type:

None

observation_space(agent: str) gymnasium.spaces.Box[source]#
Parameters:

agent (str) –

Return type:

gymnasium.spaces.Box

action_space(agent: str) gymnasium.spaces.Dict[source]#
Parameters:

agent (str) –

Return type:

gymnasium.spaces.Dict