Space Heating
Space heating, implemented as a smart thermostat, is a key component of residential energy systems, especially in cold climates where heating needs contribute significantly to Demand Response (DR). The Model Predictive Control (MPC) formulation for heating optimizes the temperature in multiple thermal zones of a dwelling, ensuring occupant comfort while respecting grid power constraints. This section presents the heating MPC formulation, which considers thermal dynamics, occupancy schedules, and external disturbances such as weather conditions. By prioritizing occupied zones and limiting power peaks, the formulation enhances DR and integrates seamlessly with Home Energy Management Systems (HEMS).
The formulation relies on a multi-zone thermal model that captures the interactions between heat inputs, internal temperatures, and external factors like outdoor temperature and solar radiation. The objective combines a comfort penalty for temperature deviations and a penalty for the maximum deviation in occupied zones, weighted by user-defined priorities and occupancy status. The use of a linear thermal model and continuous power control ensures computational efficiency, making this approach suitable for real-time optimization on embedded devices. This approach was chosen to balance thermal model precision and feasibility of large-scale implementation in a residential context.
Optimization Formulation
The heating MPC formulation optimizes the power allocated to baseboard heaters across thermal zones over a prediction horizon , with time steps of duration (e.g., 10 minutes). The objective minimizes a combination of the squared temperature deviations across all zones and the maximum absolute deviation in occupied zones, both weighted by priorities and occupancy status. The power allocation cost is included in the overall MPC objective, while the comfort term is specific to heating.
The comfort penalty is formulated as follows:
where:
- is the priority weight for thermal zone .
- is the occupancy status (0 or 1) for zone at time .
- is the desired temperature (setpoint) for zone at time .
- is the actual temperature of zone at time .
- is the normalization factor (e.g., 10°C, generally the interval between minimum and maximum setpoints).
The thermal dynamics of heating across all zones are modeled by:
where:
- is the state vector of temperatures in all zones at time .
- is the heating power vector applied to heaters at time .
- is the vector of external disturbances (e.g., outdoor temperature, solar radiation) at time .
- , , are matrices representing the thermal model for internal states, heating inputs, and external disturbances, respectively.
Constraints ensure that heating operates within physical and operational limits:
- Temperature Limits:
where and are the minimum and maximum temperature setpoints for zone .
- Power Limits:
where is the power of baseboard heater at time , and is the total number of baseboard heaters, with a global limit of 16 kW distributed equally. 16 kW limit set for an average house in Quebec.
- Power Variation Constraints:
to limit abrupt variations for operational stability.
- Initial Condition:
where is the initial temperature vector for all zones.
The power allocation for heating, which contributes to the global power constraint, is given by:
Justification of the Formulation
The heating formulation prioritizes occupant comfort by minimizing temperature deviations in occupied zones, with an additional penalty on the maximum deviation to ensure critical zones remain within acceptable limits. The use of occupancy status () allows the controller to focus energy allocation on occupied zones, improving efficiency during DR events. The multi-zone thermal model, with matrices , , , captures complex interactions between zones and external conditions, ensuring accurate predictions. The constraint on power variation limits rapid fluctuations, protecting equipment and ensuring grid stability. Continuous power control and linear dynamics enable efficient optimization, making the formulation suitable for real-time applications on embedded devices. The fixed power limit per baseboard heater (16 kW divided by the number of baseboard heaters) reflects the characteristics of an average Quebec house, while dynamic setpoints allow flexible user customization.
Variable Definitions
Variables and parameters specific to the heating formulation are summarized in the following table.
Variable/Parameter | Description | Units |
---|---|---|
Power allocated to heater at time | kW | |
Total power allocated to heating at time | kW | |
Temperature of thermal zone at time | °C | |
Desired temperature (setpoint) for zone at time | °C | |
Priority weight for thermal zone | - | |
Occupancy status (0 or 1) for zone at time | - | |
Normalization factor (e.g., 10°C) | °C | |
Thermal model matrix for internal states | - | |
Thermal model matrix for heating inputs | - | |
Thermal model matrix for external disturbances | - | |
Vector of external disturbances (e.g., outdoor temperature) at time | Variable | |
Minimum temperature setpoint for zone | °C | |
Maximum temperature setpoint for zone | °C | |
Initial temperature vector for all zones | °C | |
Number of thermal zones | - | |
Number of heaters | - |
Classes
This module defines the SpaceHeatingMPC
class, which models a space heating system for MPC.
It extends the abstract DeviceMPC
class, providing a concrete implementation for formulating the optimization problem specific to controlling electric heaters in thermal zones. This includes defining objectives related to maintaining indoor temperature within comfort bounds and incorporating constraints such as heater power limits and thermal dynamics based on a state-space model.
SpaceHeatingMPC
Represents a space heating system (e.g., smart thermostats) for the MPC.
This class models the thermal behavior of one or more building zones controlled by electric heaters. It uses a state-space thermal model to predict temperature evolution and formulates an optimization problem to control the heaters' power output. The goal is to maintain the indoor temperature close to the desired setpoints while respecting comfort boundaries and system constraints.
Methods
__init__(devices: List[Dict[str, Any]])
Initializes the SpaceHeatingMPC
.
Args:
devices
: A list of dictionaries, where each dictionary contains the configuration and parameters of a space heating device (thermal zone).
create_mpc_formulation(start: datetime, stop: datetime, steps_horizon_k: int, interval: int = 10, norm_factor: int = 10)
Creates the optimization formulation for the space heating system.
This method constructs a CVXPY optimization problem based on a linear state-space model of the building's thermal dynamics. The objective function penalizes deviations from temperature setpoints, weighted by occupancy and user-defined priorities. The constraints include:
- The state-space thermal balance equation.
- Temperature comfort bounds (min and max setpoints).
- Maximum power output of the heaters.
- Ramping limits on heater power to prevent rapid cycling.
Args:
start
: The start time of the optimization horizon.stop
: The end time of the optimization horizon.steps_horizon_k
: The number of time steps in the horizon.interval
: The duration of each time step in minutes.norm_factor
: A normalization factor for the objective function.
Returns:
- A tuple containing the objective terms, constraints, and the dispatch variable for the CVXPY optimization problem.