citylearn.building module

class citylearn.building.Building(energy_simulation: citylearn.data.EnergySimulation, weather: citylearn.data.Weather, observation_metadata: Mapping[str, bool], action_metadata: Mapping[str, bool], episode_tracker: citylearn.base.EpisodeTracker, carbon_intensity: Optional[citylearn.data.CarbonIntensity] = None, pricing: Optional[citylearn.data.Pricing] = None, dhw_storage: Optional[citylearn.energy_model.StorageTank] = None, cooling_storage: Optional[citylearn.energy_model.StorageTank] = None, heating_storage: Optional[citylearn.energy_model.StorageTank] = None, electrical_storage: Optional[citylearn.energy_model.Battery] = None, dhw_device: Optional[Union[citylearn.energy_model.HeatPump, citylearn.energy_model.ElectricHeater]] = None, cooling_device: Optional[citylearn.energy_model.HeatPump] = None, heating_device: Optional[Union[citylearn.energy_model.HeatPump, citylearn.energy_model.ElectricHeater]] = None, pv: Optional[citylearn.energy_model.PV] = None, name: Optional[str] = None, maximum_temperature_delta: Optional[float] = None, observation_space_limit_delta: Optional[float] = None, demand_observation_limit_factor: Optional[float] = None, simulate_power_outage: Optional[bool] = None, stochastic_power_outage: Optional[bool] = None, stochastic_power_outage_model: Optional[citylearn.power_outage.PowerOutage] = None, **kwargs: Any)[source]

Bases: citylearn.base.Environment

Base class for building.

Parameters
  • energy_simulation (EnergySimulation) – Temporal features, cooling, heating, dhw and plug loads, solar generation and indoor environment time series.

  • weather (Weather) – Outdoor weather conditions and forecasts time sereis.

  • observation_metadata (dict) – Mapping of active and inactive observations.

  • action_metadata (dict) – Mapping od active and inactive actions.

  • episode_tracker (EpisodeTracker, optional) – citylearn.base.EpisodeTracker object used to keep track of current episode time steps for reading observations from data files.

  • carbon_intensity (CarbonIntensity, optional) – Carbon dioxide emission rate time series.

  • pricing (Pricing, optional) – Energy pricing and forecasts time series.

  • dhw_storage (StorageTank, optional) – Hot water storage object for domestic hot water.

  • cooling_storage (StorageTank, optional) – Cold water storage object for space cooling.

  • heating_storage (StorageTank, optional) – Hot water storage object for space heating.

  • electrical_storage (Battery, optional) – Electric storage object for meeting electric loads.

  • dhw_device (Union[HeatPump, ElectricHeater], optional) – Electric device for meeting hot domestic hot water demand and charging dhw_storage.

  • cooling_device (HeatPump, optional) – Electric device for meeting space cooling demand and charging cooling_storage.

  • heating_device (Union[HeatPump, ElectricHeater], optional) – Electric device for meeting space heating demand and charging heating_storage.

  • pv (PV, optional) – PV object for offsetting electricity demand from grid.

  • name (str, optional) – Unique building name.

  • observation_space_limit_delta (float, default: 0.0) – +/- buffer for observation space limits after they have been dynamically calculated.

  • maximum_temperature_delta (float, default: 10.0) – Expected maximum absolute temperature delta above and below indoor dry-bulb temperature in [C].

  • demand_observation_limit_factor (float, default: 1.15) – Multiplier for maximum cooling/heating/dhw demand observations when setting observation limits.

  • simulate_power_outage (bool, default: False) – Whether to allow time steps when the grid is unavailable and loads must be met using only the building’s downward flexibility resources.

  • stochastic_power_outage (bool, default: False) – Whether to use a stochastic function to determine outage time steps otherwise, citylearn.building.Building.energy_simulation.power_outage time series is used.

  • stochastic_power_outage_model (PowerOutage, optional) – Power outage model class used to generate stochastic power outage signals.

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

property action_metadata: Mapping[str, bool]

Mapping od active and inactive actions.

property action_space: gym.spaces.box.Box

Agent action spaces.

property active_actions: List[str]

Actions in action_metadata with True value i.e. indicates which storage systems are to be controlled during simulation.

property active_observations: List[str]

Observations in observation_metadata with True value i.e. obeservable.

apply_actions(cooling_device_action: Optional[float] = None, heating_device_action: Optional[float] = None, cooling_storage_action: Optional[float] = None, heating_storage_action: Optional[float] = None, dhw_storage_action: Optional[float] = None, electrical_storage_action: Optional[float] = None)[source]

Update cooling and heating demand for next timestep and charge/discharge storage devices.

The order of action execution is dependent on polarity of the storage actions. If the electrical storage is to be discharged, its action is executed first before all other actions. Likewise, if the storage for an end-use is to be discharged, the storage action is executed before the control action for the end-use electric device. Discharging the storage devices before fulfilling thermal and non-shiftable loads ensures that the discharged energy is considered when allocating electricity consumption to meet building loads. Likewise, meeting building loads before charging storage devices ensures that comfort is met before attempting to shift loads.

Parameters
  • cooling_device_action (float, default: np.nan) – Fraction of cooling_device nominal_power to make available for space cooling.

  • heating_device_action (float, default: np.nan) – Fraction of heating_device nominal_power to make available for space heating.

  • cooling_storage_action (float, default: 0.0) – Fraction of cooling_storage capacity to charge/discharge by.

  • heating_storage_action (float, default: 0.0) – Fraction of heating_storage capacity to charge/discharge by.

  • dhw_storage_action (float, default: 0.0) – Fraction of dhw_storage capacity to charge/discharge by.

  • electrical_storage_action (float, default: 0.0) – Fraction of electrical_storage capacity to charge/discharge by.

autosize_cooling_device(**kwargs)[source]

Autosize cooling_device nominal_power to minimum power needed to always meet cooling_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to cooling_device autosize function.

autosize_cooling_storage(**kwargs)[source]

Autosize cooling_storage capacity to minimum capacity needed to always meet cooling_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to cooling_storage autosize function.

autosize_dhw_device(**kwargs)[source]

Autosize dhw_device nominal_power to minimum power needed to always meet dhw_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to dhw_device autosize function.

autosize_dhw_storage(**kwargs)[source]

Autosize dhw_storage capacity to minimum capacity needed to always meet dhw_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to dhw_storage autosize function.

autosize_electrical_storage(**kwargs)[source]

Autosize electrical_storage capacity to minimum capacity needed to store maximum solar_generation.

Parameters

**kwargs (dict) – Other keyword arguments parsed to electrical_storage autosize function.

autosize_heating_device(**kwargs)[source]

Autosize heating_device nominal_power to minimum power needed to always meet heating_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to heating_device autosize function.

autosize_heating_storage(**kwargs)[source]

Autosize heating_storage capacity to minimum capacity needed to always meet heating_demand.

Parameters

**kwargs (dict) – Other keyword arguments parsed to heating_storage autosize function.

autosize_pv(**kwargs)[source]

Autosize PV nominal_pwer to minimum nominal_power needed to output maximum solar_generation.

Parameters

**kwargs (dict) – Other keyword arguments parsed to electrical_storage autosize function.

property carbon_intensity: citylearn.data.CarbonIntensity

Carbon dioxide emission rate time series.

property cooling_demand: numpy.ndarray

Space cooling demand to be met by cooling_device and/or cooling_storage time series, in [kWh].

property cooling_device: citylearn.energy_model.HeatPump

Electric device for meeting space cooling demand and charging cooling_storage.

property cooling_electricity_consumption: numpy.ndarray

cooling_device net electricity consumption in meeting cooling demand and cooling_storage energy demand time series, in [kWh].

property cooling_storage: citylearn.energy_model.StorageTank

Cold water storage object for space cooling.

property cooling_storage_electricity_consumption: numpy.ndarray

cooling_storage net electricity consumption time series, in [kWh].

Positive values indicate cooling_device electricity consumption to charge cooling_storage while negative values indicate avoided cooling_device electricity consumption by discharging cooling_storage to meet cooling_demand.

property demand_observation_limit_factor: float

Multiplier for maximum cooling/heating/dhw demand observations when setting observation limits.

property dhw_demand: numpy.ndarray

Domestic hot water demand to be met by dhw_device and/or dhw_storage time series, in [kWh].

property dhw_device: Union[citylearn.energy_model.HeatPump, citylearn.energy_model.ElectricHeater]

Electric device for meeting hot domestic hot water demand and charging dhw_storage.

property dhw_electricity_consumption: numpy.ndarray

dhw_device net electricity consumption in meeting domestic hot water and dhw_storage energy demand time series, in [kWh].

property dhw_storage: citylearn.energy_model.StorageTank

Hot water storage object for domestic hot water.

property dhw_storage_electricity_consumption: numpy.ndarray

dhw_storage net electricity consumption time series, in [kWh].

Positive values indicate dhw_device electricity consumption to charge dhw_storage while negative values indicate avoided dhw_device electricity consumption by discharging dhw_storage to meet dhw_demand.

property downward_electrical_flexibility: float

Available distributed energy resource capacity to satisfy electric loads while considering power outage at current time step.

It is the sum of solar generation and any discharge from electrical storage, less electricity consumption by cooling, heating, dhw and non-shfitable load devices as well as charging electrical storage. When there is no power outage, the returned value is np.inf.

property electrical_storage: citylearn.energy_model.Battery

Electric storage object for meeting electric loads.

property electrical_storage_electricity_consumption: numpy.ndarray

Energy supply from grid and/or PV to electrical_storage time series, in [kWh].

property energy_from_cooling_device: numpy.ndarray

Energy supply from cooling_device to building time series, in [kWh].

property energy_from_cooling_device_to_cooling_storage: numpy.ndarray

Energy supply from cooling_device to cooling_storage time series, in [kWh].

property energy_from_cooling_storage: numpy.ndarray

Energy supply from cooling_storage to building time series, in [kWh].

property energy_from_dhw_device: numpy.ndarray

Energy supply from dhw_device to building time series, in [kWh].

property energy_from_dhw_device_to_dhw_storage: numpy.ndarray

Energy supply from dhw_device to dhw_storage time series, in [kWh].

property energy_from_dhw_storage: numpy.ndarray

Energy supply from dhw_storage to building time series, in [kWh].

property energy_from_electrical_storage: numpy.ndarray

Energy supply from electrical_storage to building time series, in [kWh].

property energy_from_heating_device: numpy.ndarray

Energy supply from heating_device to building time series, in [kWh].

property energy_from_heating_device_to_heating_storage: numpy.ndarray

Energy supply from heating_device to heating_storage time series, in [kWh].

property energy_from_heating_storage: numpy.ndarray

Energy supply from heating_storage to building time series, in [kWh].

property energy_simulation: citylearn.data.EnergySimulation

Temporal features, cooling, heating, dhw and plug loads, solar generation and indoor environment time series.

property energy_to_electrical_storage: numpy.ndarray

Energy supply from electrical_device to building time series, in [kWh].

property energy_to_non_shiftable_load: numpy.ndarray

Energy supply from grid, PV and battery to non shiftable loads, in [kWh].

property episode_tracker: citylearn.base.EpisodeTracker

citylearn.base.EpisodeTracker object used to keep track of current episode time steps for reading observations from data files.

estimate_action_space() gym.spaces.box.Box[source]

Get estimate of action spaces.

Find minimum and maximum possible values of all the actions, which can then be used by the RL agent to scale the selected actions.

Returns

action_space – Action low and high limits.

Return type

spaces.Box

Notes

The lower and upper bounds for the cooling_storage, heating_storage and dhw_storage actions are set to (+/-) 1/maximum_demand for each respective end use, as the energy storage device can’t provide the building with more energy than it will ever need for a given time step. . For example, if cooling_storage capacity is 20 kWh and the maximum cooling_demand is 5 kWh, its actions will be bounded between -5/20 and 5/20. These boundaries should speed up the learning process of the agents and make them more stable compared to setting them to -1 and 1.

estimate_observation_space(include_all: Optional[bool] = None, normalize: Optional[bool] = None) gym.spaces.box.Box[source]

Get estimate of observation spaces.

Parameters
  • include_all (bool, default: False,) – Whether to estimate for all observations as listed in observation_metadata or only those that are active.

  • normalize (bool, default: False) – Whether to apply min-max normalization bounded between [0, 1].

Returns

observation_space – Observation low and high limits.

Return type

spaces.Box

estimate_observation_space_limits(include_all: Optional[bool] = None, periodic_normalization: Optional[bool] = None) Tuple[Mapping[str, float], Mapping[str, float]][source]

Get estimate of observation space limits.

Find minimum and maximum possible values of all the observations, which can then be used by the RL agent to scale the observations and train any function approximators more effectively.

Parameters
  • include_all (bool, default: False,) – Whether to estimate for all observations as listed in observation_metadata or only those that are active.

  • periodic_normalization (bool, default: False) – Whether to apply sine-cosine normalization to cyclic observations including hour, day_type and month.

Returns

observation_space_limits – Observation low and high limits.

Return type

Tuple[Mapping[str, float], Mapping[str, float]]

Notes

Lower and upper bounds of net electricity consumption are rough estimates and may not be completely accurate hence, scaling this observation-variable using these bounds may result in normalized values above 1 or below 0. It is also assumed that devices and storage systems have been sized.

get_metadata() Mapping[str, Any][source]

Returns general static information.

static get_periodic_observation_metadata() Mapping[str, int][source]

Get periodic observation names and their minimum and maximum values for periodic/cyclic normalization.

Returns

periodic_observation_metadata – Observation low and high limits.

Return type

Mapping[str, int]

property heating_demand: numpy.ndarray

Space heating demand to be met by heating_device and/or heating_storage time series, in [kWh].

property heating_device: Union[citylearn.energy_model.HeatPump, citylearn.energy_model.ElectricHeater]

Electric device for meeting space heating demand and charging heating_storage.

property heating_electricity_consumption: numpy.ndarray

heating_device net electricity consumption in meeting heating demand and heating_storage energy demand time series, in [kWh].

property heating_storage: citylearn.energy_model.StorageTank

Hot water storage object for space heating.

property heating_storage_electricity_consumption: numpy.ndarray

heating_storage net electricity consumption time series, in [kWh].

Positive values indicate heating_device electricity consumption to charge heating_storage while negative values indicate avoided heating_device electricity consumption by discharging heating_storage to meet heating_demand.

property hvac_mode_switch: bool

If HVAC has just switched from cooling to heating or vice versa at current time_step.

property indoor_dry_bulb_temperature: numpy.ndarray

dry bulb temperature time series, in [C].

This is the temperature when cooling_device and heating_device are controlled.

property indoor_dry_bulb_temperature_set_point: numpy.ndarray

dry bulb temperature set point time series, in [C].

property maximum_temperature_delta: float

Expected maximum absolute temperature delta above and below indoor dry-bulb temperature in [C].

property name: str

Unique building name.

property net_electricity_consumption: numpy.ndarray

Net electricity consumption time series, in [kWh].

property net_electricity_consumption_cost: numpy.ndarray

net_electricity_consumption cost time series, in [$].

property net_electricity_consumption_cost_without_storage: numpy.ndarray

net_electricity_consumption_without_storage cost time series, in [$].

property net_electricity_consumption_cost_without_storage_and_pv: numpy.ndarray

net_electricity_consumption_without_storage_and_pv` cost time series, in [$].

property net_electricity_consumption_emission: numpy.ndarray

Carbon dioxide emmission from net_electricity_consumption time series, in [kg_co2].

property net_electricity_consumption_emission_without_storage: numpy.ndarray

Carbon dioxide emmission from net_electricity_consumption_without_storage time series, in [kg_co2].

property net_electricity_consumption_emission_without_storage_and_pv: numpy.ndarray

Carbon dioxide emmission from net_electricity_consumption_without_storage_pv time series, in [kg_co2].

property net_electricity_consumption_without_storage: numpy.ndarray

net electricity consumption in the absence of flexibility provided by storage devices time series, in [kWh].

Notes

net_electricity_consumption_without_storage = net_electricity_consumption - (cooling_storage_electricity_consumption + heating_storage_electricity_consumption + dhw_storage_electricity_consumption + electrical_storage_electricity_consumption)

property net_electricity_consumption_without_storage_and_pv: numpy.ndarray

Net electricity consumption in the absence of flexibility provided by storage devices, and self generation time series, in [kWh].

Notes

net_electricity_consumption_without_storage_and_pv = net_electricity_consumption_without_storage - solar_generation

next_time_step()[source]

Advance all energy storage and electric devices and, PV to next time_step.

property non_shiftable_load: numpy.ndarray

Electricity load that must be met by the grid, or PV and/or electrical_storage if available time series, in [kWh].

property non_shiftable_load_device: citylearn.energy_model.ElectricDevice

Generic electric device for meeting non_shiftable_load.

property non_shiftable_load_electricity_consumption: numpy.ndarray

non_shiftable_load_device net electricity consumption in meeting non_shiftable_load energy demand time series, in [kWh].

property observation_metadata: Mapping[str, bool]

Mapping of active and inactive observations.

property observation_space: gym.spaces.box.Box

Agent observation space.

property observation_space_limit_delta: float

+/- buffer for observation space limits after they have been dynamically calculated.

observations(include_all: Optional[bool] = None, normalize: Optional[bool] = None, periodic_normalization: Optional[bool] = None) Mapping[str, float][source]

Observations at current time step.

Parameters
  • include_all (bool, default: False,) – Whether to estimate for all observations as listed in observation_metadata or only those that are active.

  • normalize (bool, default: False) – Whether to apply min-max normalization bounded between [0, 1].

  • periodic_normalization (bool, default: False) – Whether to apply sine-cosine normalization to cyclic observations including hour, day_type and month.

Returns

observation_space – Observation low and high limits.

Return type

spaces.Box

Notes

Lower and upper bounds of net electricity consumption are rough estimates and may not be completely accurate hence, scaling this observation-variable using these bounds may result in normalized values above 1 or below 0.

property occupant_count: numpy.ndarray

Building occupant count time series, in [people].

property power_outage: bool

Whether there is power outage at current time step.

property power_outage_signal: numpy.ndarray

Power outage signal time series, in [Yes/No].

property pricing: citylearn.data.Pricing

Energy pricing and forecasts time series.

property pv: citylearn.energy_model.PV

PV object for offsetting electricity demand from grid.

property random_seed: int

Pseudorandom number generator seed for repeatable results.

reset()[source]

Reset Building to initial state.

reset_data_sets()[source]

Resets time series data start_time_step and end_time_step with respect to current episode’s time step settings.

reset_dynamic_variables()[source]

Resets data file variables that change during control to their initial values.

reset_power_outage_signal() numpy.ndarray[source]

Resets power outage signal time series.

Resets to zeros if simulate_power_outage is False otherwise, resets to a stochastic time series if stochastic_power_outage is True or the time series defined in energy_simulation.power_outage.

Returns

power_outage_signal – Power outage signal time series.

Return type

np.ndarray

property simulate_power_outage: bool

Whether to allow time steps when the grid is unavailable and loads must be met using only the building’s downward flexibility resources.

property solar_generation: numpy.ndarray

PV solar generation (negative value) time series, in [kWh].

property stochastic_power_outage: bool

Whether to use a stochastic function to determine outage time steps otherwise, citylearn.building.Building.energy_simulation.power_outage time series is used.

property stochastic_power_outage_model: citylearn.power_outage.PowerOutage

Power outage model class used to generate stochastic power outage signals.

update_cooling_demand(action: float)[source]

Update space cooling demand for current time step.

update_cooling_storage(action: float)[source]

Charge/discharge cooling_storage for current time step.

Parameters

action (float) – Fraction of cooling_storage capacity to charge/discharge by.

update_dhw_storage(action: float)[source]

Charge/discharge dhw_storage for current time step.

Parameters

action (float) – Fraction of dhw_storage capacity to charge/discharge by.

update_electrical_storage(action: float)[source]

Charge/discharge electrical_storage for current time step.

Parameters

action (float) – Fraction of electrical_storage capacity to charge/discharge by.

update_energy_from_cooling_device()[source]

Update cooling device electricity consumption and energy tranfer for current time step’s cooling demand.

update_energy_from_dhw_device()[source]

Update dhw device electricity consumption and energy tranfer for current time step’s dhw demand.

update_energy_from_heating_device()[source]

Update heating device electricity consumption and energy tranfer for current time step’s heating demand.

update_heating_demand(action: float)[source]

Update space heating demand for current time step.

update_heating_storage(action: float)[source]

Charge/discharge heating_storage for current time step.

Parameters

action (float) – Fraction of heating_storage capacity to charge/discharge by.

update_non_shiftable_load()[source]

Update non shiftable loads electricity consumption for current time step non shiftable load.

update_variables()[source]

Update cooling, heating, dhw and net electricity consumption as well as net electricity consumption cost and carbon emissions.

property weather: citylearn.data.Weather

Outdoor weather conditions and forecasts time series.

class citylearn.building.DynamicsBuilding(*args: Any, cooling_dynamics: citylearn.dynamics.Dynamics, heating_dynamics: citylearn.dynamics.Dynamics, ignore_dynamics: Optional[bool] = None, **kwargs: Any)[source]

Bases: citylearn.building.Building

Base class for temperature dynamic building.

Parameters
  • *args (Any) – Positional arguments in citylearn.building.Building.

  • cooling_dynamics (Dynamics) – Indoor dry-bulb temperature dynamics model for cooling mode.

  • heating_dynamics (Dynamics) – Indoor dry-bulb temperature dynamics model for heating mode.

  • ignore_dynamics (bool, default: False) – Wether to simulate temperature dynamics at any time step.

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

apply_actions(**kwargs)[source]

Update cooling and heating demand for next timestep and charge/discharge storage devices.

The order of action execution is dependent on polarity of the storage actions. If the electrical storage is to be discharged, its action is executed first before all other actions. Likewise, if the storage for an end-use is to be discharged, the storage action is executed before the control action for the end-use electric device. Discharging the storage devices before fulfilling thermal and non-shiftable loads ensures that the discharged energy is considered when allocating electricity consumption to meet building loads. Likewise, meeting building loads before charging storage devices ensures that comfort is met before attempting to shift loads.

Parameters
  • cooling_device_action (float, default: np.nan) – Fraction of cooling_device nominal_power to make available for space cooling.

  • heating_device_action (float, default: np.nan) – Fraction of heating_device nominal_power to make available for space heating.

  • cooling_storage_action (float, default: 0.0) – Fraction of cooling_storage capacity to charge/discharge by.

  • heating_storage_action (float, default: 0.0) – Fraction of heating_storage capacity to charge/discharge by.

  • dhw_storage_action (float, default: 0.0) – Fraction of dhw_storage capacity to charge/discharge by.

  • electrical_storage_action (float, default: 0.0) – Fraction of electrical_storage capacity to charge/discharge by.

property cooling_demand_without_partial_load: numpy.ndarray

Total building space ideal cooling demand time series in [kWh].

This is the demand when cooling_device is not controlled and always supplies ideal load.

get_dynamics_input()[source]
property heating_demand_without_partial_load: numpy.ndarray

Total building space ideal heating demand time series in [kWh].

This is the demand when heating_device is not controlled and always supplies ideal load.

property indoor_dry_bulb_temperature_without_partial_load: numpy.ndarray

Ideal load dry bulb temperature time series in [C].

This is the temperature when cooling_device and heating_device are not controlled and always supply ideal load.

property net_electricity_consumption_cost_without_storage_and_partial_load: numpy.ndarray

net_electricity_consumption_without_storage_and_partial_load cost time series, in [$].

property net_electricity_consumption_cost_without_storage_and_partial_load_and_pv: numpy.ndarray

net_electricity_consumption_without_storage_and_partial_load_and_pv` cost time series, in [$].

property net_electricity_consumption_emission_without_storage_and_partial_load: numpy.ndarray

Carbon dioxide emmission from net_electricity_consumption_without_storage_and_partial_load time series, in [kg_co2].

property net_electricity_consumption_emission_without_storage_and_partial_load_and_pv: numpy.ndarray

Carbon dioxide emmission from net_electricity_consumption_without_storage_and_partial_load_pv time series, in [kg_co2].

property net_electricity_consumption_without_storage_and_partial_load

Net electricity consumption in the absence of flexibility provided by storage devices and partial load cooling and heating devices time series, in [kWh].

property net_electricity_consumption_without_storage_and_partial_load_and_pv: numpy.ndarray

Net electricity consumption in the absence of flexibility provided by storage devices, partial load cooling and heating devices and self generation time series, in [kWh].

Notes

net_electricity_consumption_without_storage_and_partial_load_and_pv = net_electricity_consumption_without_storage_and_partial_load - solar_generation

next_time_step()[source]

Advance all energy storage and electric devices and, PV to next time_step.

reset()[source]

Reset Building to initial state and sets dynamics.

reset_dynamic_variables()[source]

Resets data file variables that change during control to their initial values.

Resets cooling demand, heating deamand and indoor temperature time series to their initial value at the beginning of an episode.

set_dynamics() citylearn.dynamics.Dynamics[source]

Resets and returns cooling_dynamics if current time step HVAC mode is off or cooling otherwise, resets and returns heating dynamics.

property simulate_dynamics: bool

Whether to predict indoor dry-bulb temperature at current time_step.

update_indoor_dry_bulb_temperature()[source]
class citylearn.building.LSTMDynamicsBuilding(*args, cooling_dynamics: citylearn.dynamics.LSTMDynamics, heating_dynamics: citylearn.dynamics.LSTMDynamics, **kwargs)[source]

Bases: citylearn.building.DynamicsBuilding

Class for building with LSTM temperature dynamics model.

Parameters
  • *args (Any) – Positional arguments in citylearn.building.Building.

  • cooling_dynamics (Dynamics) – Indoor dry-bulb temperature dynamics model for cooling mode.

  • heating_dynamics (Dynamics) – Indoor dry-bulb temperature dynamics model for heating mode.

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

get_dynamics_input() numpy.ndarray[source]
property simulate_dynamics: bool

Whether to predict indoor dry-bulb temperature at current time_step.

update_cooling_demand(action: float)[source]

Update space cooling demand for current time step.

Sets the value of citylearn.building.Building.energy_simulation.cooling_demand for the current time_step to the ouput energy of the cooling device where the proportion of its nominal power made available is defined by action. If citylearn.building.Building.energy_simulation.hvac_mode at the next time step is = 0, i.e., off, or = 1, i.e. cooling mode, the demand is set to 0.

Parameters

action (float) – Proportion of cooling device nominal power that is made available.

Notes

Will only start controlling the heat pump when there are enough observations fo the LSTM lookback until then, maintains ideal load. This will imply that the agent does not learn anything in the initial timesteps that are less than the lookback. Taking this approach as a ‘warm-up’ because realistically, there will be no preceding observations to use in lookback.

update_heating_demand(action: float)[source]

Update space heating demand for current time step.

Sets the value of citylearn.building.Building.energy_simulation.heating_demand for the current time_step to the ouput energy of the heating device where the proportion of its nominal power made available is defined by action. If citylearn.building.Building.energy_simulation.hvac_mode at the next time step is = 0, i.e., off, or = 1, i.e. cooling mode, the demand is set to 0.

Parameters

action (float) – Proportion of heating device nominal power that is made available.

Notes

Will only start controlling the heat pump when there are enough observations fo the LSTM lookback until then, maintains ideal load. This will imply that the agent does not learn anything in the initial timesteps that are less than the lookback. Taking this approach as a ‘warm-up’ because realistically, there will be no preceding observations to use in lookback.

update_indoor_dry_bulb_temperature()[source]

Predict and update indoor dry-bulb temperature for current time_step.

This method will first apply min-max normalization to the model input data where the input data is made up of building and district level observations including the predicted citylearn.building.Building.energy_simulation.indoor_dry_bulb_temperature with all input variables having a length of citylearn.dynamics.LSTMDynamics.lookback. asides the indoor_dry_bulb_temperature whose input includes all values from time_step - (lookback + 1) to time_step - 1, other input variables have values from time_step - lookback to time_step. The indoor_dry_bulb_temperature for the current time_step is then predicted using the input data and current hidden_state and the predicted values replaces the current time_step value in citylearn.building.Building.energy_simulation.indoor_dry_bulb_temperature.

Notes

LSTM model only uses either cooling/heating demand not both as input variable. Use citylearn.building.Building.energy_simulation.hvac_mode to specify whether to consider cooling or heating demand at each time_step.