citylearn.agents.rbc module

class citylearn.agents.rbc.BasicBatteryRBC(env: CityLearnEnv, **kwargs: Any)[source]

Bases: BasicRBC

A hour-of-use rule-based controller that is designed to take advantage of solar generation for charging.

The actions are optimized for electrical storage (battery) such that the agent charges the controlled storage system(s) by 11.0% of its maximum capacity every hour between 06:00 AM and 02:00 PM, and discharges 6.7% of its maximum capacity at every other hour. Cooling device is set to 70.0% of nominal power between between 06:00 AM and 02:00 PM and 30.0% at every other hour. Heating device is to 30.0% of nominal power between between 06:00 AM and 02:00 PM and 70.0% at every other hour

Parameters:
  • env (CityLearnEnv) – CityLearn environment.

  • **kwargs (Any) – Other keyword arguments used to initialize super class.

property action_map: List[Mapping[str, Mapping[int, float]]]
class citylearn.agents.rbc.BasicRBC(env: CityLearnEnv, **kwargs: Any)[source]

Bases: HourRBC

A hour-of-use rule-based controller for heat-pump charged thermal energy storage systems that charges when COP is high.

The actions are designed such that the agent charges the controlled storage system(s) by 9.1% of its maximum capacity every hour between 10:00 PM and 08:00 AM, and discharges 8.0% of its maximum capacity at every other hour. Cooling device is set to 40.0% of nominal power between between 10:00 PM and 08:00 AM and 80.0% at every other hour. Heating device is to 80.0% of nominal power between between 10:00 PM and 08:00 AM and 40.0% at every other hour.

Parameters:
  • env (CityLearnEnv) – CityLearn environment.

  • **kwargs (Any) – Other keyword arguments used to initialize super class.

property action_map: List[Mapping[str, Mapping[int, float]]]
class citylearn.agents.rbc.HourRBC(env: CityLearnEnv, action_map: List[Mapping[str, Mapping[int, float]]] | Mapping[str, Mapping[int, float]] | Mapping[int, float] = None, **kwargs: Any)[source]

Bases: RBC

A hour-of-use rule-based controller.

Parameters:
  • env (CityLearnEnv) – CityLearn environment.

  • action_map (Union[Mapping[int, float], Mapping[str, Mapping[int, float]], List[Mapping[str, Mapping[int, float]]]], optional) – A 24-hour action map for each controlled device where the key is the hour between 1-24 and the value is the action. For storage systems, the value is negative for discharge and positive for charge where it ranges between [0, 1]. Whereas, for cooling or heating devices, the value is positive for proportion of nominal power to make available and ranges between [0, 1]. The action map can be parsed as a dictionary of hour keys mapped to action values (Mapping[int, float]). Alternatively, it can be parsed as a dictionary of devices (Mapping[str, Mapping[int, float]]) with their specific hour key to action value mapping (Mapping[int, float]). Finally, the action map can be defined for each agent especially in decentralized setup as a list of device dictionary where each device dictionary (Mapping[str, Mapping[int, float]]) is for a specific decentralized (or centralized) agent. The HourRBC will return random actions if no map is provided.

  • **kwargs (Any) – Other keyword arguments used to initialize super class.

property action_map: List[Mapping[str, Mapping[int, float]]]
predict(observations: List[List[float]], deterministic: bool = None) List[List[float]][source]

Provide actions for current time step.

Parameters:
  • observations (List[List[float]]) – Environment observations

  • deterministic (bool, default: False) – Wether to return purely exploitatative deterministic actions.

Returns:

actions – Action values

Return type:

List[List[float]]

class citylearn.agents.rbc.OptimizedRBC(env: CityLearnEnv, **kwargs: Any)[source]

Bases: BasicRBC

A hour-of-use rule-based controller that is an optimized version of citylearn.agents.rbc.BasicRBC where control actions have been selected through a search grid.

The actions are designed such that the agent discharges the controlled storage system(s) by 2.0% of its maximum capacity every hour between 07:00 AM and 03:00 PM, discharges by 4.4% of its maximum capacity between 04:00 PM and 06:00 PM, discharges by 2.4% of its maximum capacity between 07:00 PM and 10:00 PM, charges by 3.4% of its maximum capacity between 11:00 PM to midnight and charges by 5.532% of its maximum capacity at every other hour.

Cooling device makes available 70.0% of its nominal power every hour between 07:00 AM and 03:00 PM, 60.0% between 04:00 PM and 06:00 PM, 80.0% between 07:00 PM and 10:00 PM, 40.0% between 11:00 PM to midnight and 20.0% other hour.

Heating device makes available 30.0% of its nominal power every hour between 07:00 AM and 03:00 PM, 40.0% between 04:00 PM and 06:00 PM, 60.0% between 07:00 PM and 10:00 PM, 70.0% between 11:00 PM to midnight and 80.0% other hour.

Parameters:
  • env (CityLearnEnv) – CityLearn environment.

  • **kwargs (Any) – Other keyword arguments used to initialize super class.

property action_map: List[Mapping[str, Mapping[int, float]]]
class citylearn.agents.rbc.RBC(env: CityLearnEnv, **kwargs: Any)[source]

Bases: Agent

Base rule based controller class.

Parameters:
  • env (CityLearnEnv) – CityLearn environment.

  • **kwargs (Any) – Other keyword arguments used to initialize super class.