Models#
smart_control.models.base_building
#
Base class that extends functionality outside of the building.
The base class should be extended by the simulation and actual buildings.
BaseBuilding
#
Base class for a controllable building for reinforcement learning.
current_timestamp
abstractmethod
property
#
Lists the current local time of the building.
devices
abstractmethod
property
#
Lists the devices that can be queried and/or controlled.
num_occupants
abstractmethod
property
#
Returns the number of occupants in building.
reward_info
abstractmethod
property
#
Returns a message with data to compute the instantaneous reward.
time_step_sec
abstractmethod
property
#
Returns the amount of time between time steps.
zones
abstractmethod
property
#
Lists the zones in the building managed by the RL agent.
is_comfort_mode
abstractmethod
#
Returns True if building is in comfort mode.
request_action
abstractmethod
#
Issues a command to the building to change one or more setpoints.
request_observations
abstractmethod
#
request_observations(
observation_request: ObservationRequest,
) -> smart_control_building_pb2.ObservationResponse
Queries the building for its current state.
request_observations_within_time_interval
abstractmethod
#
request_observations_within_time_interval(
observation_request: ObservationRequest,
start_timestamp: Timestamp,
end_timestamp: Timestamp,
) -> Sequence[smart_control_building_pb2.ObservationResponse]
Queries the building for observations between start and end times.
reset
abstractmethod
#
Resets the building, throwing an RuntimeError if this is impossible.
smart_control.models.base_energy_cost
#
Base class for energy cost and carbon, for use in reward function.
BaseEnergyCost
#
Class that returns a cost for energy consumed over a time interval.
carbon
abstractmethod
#
Returns the mass of carbon emitted from the energy consumption.
The energy-to-carbon emission is source specific. Assuming a constant rate of energy consumption (W) of the time interval bounded by start_time and end_time, we can estimate total energy use (J). The type of source will convert energy into carbon mass (kg).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time
|
Timestamp
|
starting local time for the energy use. |
required |
end_time
|
Timestamp
|
ending local time for the energy use. |
required |
energy_rate
|
float
|
constant-rate power in Watts consumed over the interval. |
required |
Returns: carbon mass (kg) emitted
cost
abstractmethod
#
Computes cost in USD for energy consumed from start_time to end_time.
Fundamentally, energy cost is computed as: energy_consumed [J] = energy_rate [W] * (end_time - start_time) [s] energy_cost = energy_consumed [J] * energy_price [USD/J]
Most utilities use different units for their pricing, such as kWh, Btu/hr, cubic feet per minute, etc., so implementations will have to perform all necessary conversions internally.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time
|
Timestamp
|
starting local time for the energy use. |
required |
end_time
|
Timestamp
|
ending local time for the energy use. |
required |
energy_rate
|
float
|
constant-rate power in Watts consumed over the interval. |
required |
Returns: cost in USD of the energy consumed over the interval.
smart_control.models.base_normalizer
#
Defines observation and action normalizer base classes.
BaseActionNormalizer
#
Translates native agent action values into normalized setpoint values.
agent_value
abstractmethod
#
Returns the normalized setpoint_value as an agent action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setpoint_value
|
float
|
Value in native units. |
required |
get_array_spec
abstractmethod
#
Returns array_spec for the action.
This informs the agent how many values to output, which will get transformed into a single value for the setpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Name to pass to the ArraySpec |
None
|
setpoint_value
abstractmethod
#
Returns value to apply to building given agent action values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_action
|
ndarray
|
Values returned directly from agent, compatible with array_spec. |
required |
smart_control.models.base_occupancy
#
Defines an occupancy model that returns the average number of occupants.
Occupancy refers to the average number of people in a zone within a specified period of time. Concrete classes can either simulate the occupancy or estimate the occupancy from Calendar or motion sensors in the buildings.
The occupancy signal is an input to the agent's reward function.
BaseOccupancy
#
Provides the RL agent information about how many people are in a zone.
average_zone_occupancy
abstractmethod
#
Returns the occupancy within start_time, end_time for the zone.
If the zone is not found, implementations should raise a ValueError.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zone_id
|
str
|
specific zone identifier for the building. |
required |
start_time
|
Timestamp
|
local time w/ TZ for the beginning of the interval. |
required |
end_time
|
Timestamp
|
local time w/ TZ for the end of the interval. |
required |
Returns:
Type | Description |
---|---|
float
|
average number of people in the zone for the interval. |
smart_control.models.base_reward_function
#
Base class for smart buildings reward function.