In the context of an increasingly tight power balance, improving energy efficiency on the user side has become a crucial measure to alleviate grid supply pressure. As a major contributor to residential electricity consumption, the heating, ventilation, and air conditioning (HVAC) system, together with the battery energy storage system, offers significant potential for demand-side management under time-of-use pricing. In this work, we propose a coordinated optimization framework that integrates a fixed-speed or variable-speed air conditioner with a battery energy storage system. The model is embedded in a rolling time-domain control (model predictive control) framework, which simultaneously limits frequent switching of both the air conditioner and the battery storage device to protect equipment longevity. We then describe the hardware and software implementation of a real-time energy management system based on the Internet of Things (IoT), including a monitoring platform and distributed integration of core components. Finally, we validate the effectiveness of the proposed model and system through both simulation experiments and field tests. Compared with standalone air conditioner operation, the coordinated economic operation reduces electricity costs by 13% under typical summer and winter scenarios.
Our research is motivated by the growing electricity demand and the seasonal peak load caused by air conditioning systems. Studies have shown that building operations contribute to over 9.9 billion tons of carbon emissions globally, with HVAC systems accounting for more than 45% of that. In China, time-of-use electricity pricing was introduced in most provinces starting from 2021, encouraging users to shift consumption away from peak hours. Air conditioners, with their inherent thermal storage capability through building fabric, can be flexibly dispatched. However, individual residential dwellings have limited thermal mass. Integrating a battery energy storage system with the air conditioner can further enhance flexibility and economic performance. While many simulation-based studies have demonstrated the benefits of such coordination, there is a lack of practical implementation and experimental validation. Our work aims to fill this gap by presenting a complete solution from modeling to field deployment.
Optimization Model Formulation
We consider the joint operation of an air conditioner and a battery energy storage system under time-of-use electricity prices. The objective is to minimize the total electricity cost, including the cost of purchased electricity, the operation and maintenance cost of the battery, and the battery degradation cost. The optimization is performed over a receding horizon using model predictive control. The full optimization problem is given below.
Objective Function
$$ \min \sum_{k=0}^{W-1} \left[ U^{\text{TOU}}_k C^{\text{C}}_k + U^{\text{Opx}}_k (P^{\text{C}}_k + P^{\text{D}}_k) + U^{\text{Deg}}_k (P^{\text{C}}_k + P^{\text{D}}_k) + \rho (S^{\text{t}}_{k+1} + S^{\text{e}}_{k+1}) \right] $$
where
$$ C^{\text{C}}_k = \max\left( P_k (S^{\text{h}}_k + S^{\text{c}}_k) + P^{\text{C}}_k – P^{\text{D}}_k, 0 \right) $$
$$ U^{\text{Deg}}_k = \frac{R_{\text{2N}}}{(E_{\max} – E_{\min})E_{\text{rated}}} \Delta t $$
Here, \( C^{\text{C}}_k \) is the power purchased from the grid at time step \( k \); \( U^{\text{TOU}}_k \) is the time-of-use electricity price; \( U^{\text{Opx}}_k \) is the unit operation cost of the battery; \( U^{\text{Deg}}_k \) is the unit degradation cost coefficient of the battery; \( P_k \) is the air conditioner’s electrical power; \( S^{\text{h}}_k \) and \( S^{\text{c}}_k \) are binary variables indicating heating and cooling states, respectively; \( P^{\text{C}}_k \) and \( P^{\text{D}}_k \) are the charging and discharging power of the battery energy storage system; \( E_{\max}, E_{\min}, E_{\text{rated}} \) are the maximum, minimum, and rated energy capacities; \( R_{\text{2N}} \) is the life-cycle cost; \( L_{\text{N}} \) is the total cycle life; \( \rho \) is a penalty coefficient for slack variables \( S^{\text{t}}_{k} \) and \( S^{\text{e}}_{k} \) which relax temperature and SOC constraints to ensure feasibility.
Air Conditioner Constraints
The indoor temperature dynamics are modeled using a simplified resistor-capacitor (RC) network:
$$ T^{r}_{k+1} = \left(1 – \frac{\Delta t}{RC}\right) T^{r}_k + \frac{\Delta t}{RC} T^{\text{out}}_k + \frac{\Delta t}{C} \left( S^{\text{ht}}_k – S^{\text{cl}}_k \right) \frac{P_k}{\text{COP}} $$
For a fixed-speed air conditioner, \( P_k \) is constant; for a variable-speed unit, it is linearly related to compressor frequency \( f \):
$$ P_k = k_1 f_k + L_1 $$
The operational constraints include:
$$ S^{\text{ht}}_k + S^{\text{cl}}_k \leq 1, \quad S^{\text{ht}}_k, S^{\text{cl}}_k \in \{0,1\} $$
$$ T_{\min} – S^{\text{t}}_k \leq T^{r}_k \leq T_{\max} + S^{\text{t}}_k $$
$$ S^{\text{t}}_k \geq 0 $$
To avoid frequent compressor switching, we enforce minimum on/off time constraints:
$$ \mathbf{1}^{\text{T}} S^{\text{ht}}_{[k-M_c+1,k]} \geq S^{\text{ht}}_{k-M_c} – S^{\text{ht}}_{k-M_c-1} $$
$$ \mathbf{1}^{\text{T}} S^{\text{cl}}_{[k-M_d+1,k]} \geq S^{\text{cl}}_{k-M_d} – S^{\text{cl}}_{k-M_d-1} $$
Similar constraints apply to turning on after off, and symmetry for the battery energy storage system.
Battery Energy Storage System Constraints
The battery energy dynamics:
$$ E_{k+1} = E_k + \eta_{\text{C}} P^{\text{C}}_k \Delta t – \frac{P^{\text{D}}_k \Delta t}{\eta_{\text{D}}} $$
Operational constraints:
$$ S^{\text{C}}_k + S^{\text{D}}_k \leq 1, \quad S^{\text{C}}_k, S^{\text{D}}_k \in \{0,1\} $$
$$ 0 \leq P^{\text{C}}_k \leq S^{\text{C}}_k P_{\max}, \quad 0 \leq P^{\text{D}}_k \leq S^{\text{D}}_k P_{\max} $$
$$ S^{\min}_{\text{OC}} – S^{\text{e}}_k \leq \text{SOC}_k \leq S^{\max}_{\text{OC}} + S^{\text{e}}_k $$
$$ \text{SOC}_k = \frac{E_k}{E_{\max}} $$
Minimum charging/discharging time constraints are also imposed, analogous to the air conditioner constraints, using indexed binary variables to prevent rapid switching of the battery energy storage system.
System Implementation
We built a physical testbed in our laboratory to validate the proposed optimization and control framework. The system architecture is based on IoT communication protocols including Modbus and TCP/IP. The core components are an energy management monitoring platform, a fixed-speed air conditioner (KFR-72 GW, rated cooling/heating power 2.35 kW/2.95 kW), a set of temperature sensors, a low-voltage battery energy storage system (Goodwe LX U5.4-L, 2.3 kW/5.4 kWh), and an outdoor temperature forecast service (XinZhi API). All devices are connected through an IoT network, and the model predictive controller runs on a standard PC with MATLAB/YALMIP and CPLEX solver.
The following table summarizes the key parameters used in our experiments:
| Parameter | Symbol | Value | Unit |
|---|---|---|---|
| Sampling interval | \(\Delta t\) | 5 | min |
| Prediction horizon | \(W\) | 18 | steps (90 min) |
| Battery rated capacity | \(E_{\text{rated}}\) | 5.3 | kWh |
| Battery max power | \(P_{\max}\) | 2.3 | kW |
| Battery SOC limits | \(S^{\min}_{\text{OC}}, S^{\max}_{\text{OC}}\) | 0.2, 0.8 | – |
| Initial SOC | \(\text{SOC}_0\) | 0.7 | – |
| Charging/discharging efficiency | \(\eta_{\text{C}}, \eta_{\text{D}}\) | 0.9 | – |
| Battery cycle life | \(L_{\text{N}}\) | 3500 | cycles |
| Battery life-cycle cost | \(R_{\text{2N}}\) | 10000 | CNY |
| Air conditioner COP | COP | 3.0 (for cooling) | – |
| Thermal resistance (estimated) | \(R\) | 0.0034 | °C·h/kW |
| Thermal capacitance (estimated) | \(C\) | 3.5456×10^6 | J/°C |
| Min on/off time (AC) | \(M_c, M_d\) | 6 | steps (30 min) |
| Min charge/discharge time (battery) | \(M_C, M_D\) | 6 | steps (30 min) |
| Base electricity price | \(U^{\text{TOU}}\) | 0.86 (peak)/0.43 (valley) | CNY/kWh |
The energy management monitoring platform was developed in Python with a graphical user interface. It retrieves outdoor temperature forecasts via the API, reads indoor temperature from the sensors, communicates with the battery management system (BMS) via Modbus, and sends infrared control signals to the air conditioner through a serial server. The MPC solver runs every 5 minutes and outputs the optimal commands for the next interval. The integrated system is shown conceptually in the following figure.

During real-time operation, the system collects the current indoor temperature, battery SOC, and outdoor temperature forecast. The MPC then solves the optimization problem and applies the first control action (AC on/off state and battery charge/discharge power) to the physical devices. In the next cycle, the measurements are updated and the process repeats, providing robustness against model inaccuracies and disturbances.
Case Study and Results
We conducted two sets of experiments: simulation-based evaluation for both fixed-speed and variable-speed air conditioners, and a physical experiment during a winter heating scenario. The RC model was first identified using historical data. The estimation result yielded \(R = 0.0034^\circ\text{C}\cdot\text{h}/\text{kW}\) and \(C = 3.5456\times10^6\,\text{J}/^\circ\text{C}\) with a mean squared error of 0.0824 and temperature prediction error within ±0.14°C.
Simulation Experiment (Cooling Season)
We compared four strategies: (1) standalone AC with traditional on/off thermostat (0-1 control), (2) standalone AC with MPC, (3) coordinated fixed-speed AC + battery energy storage system with MPC, and (4) coordinated variable-speed AC + battery energy storage system with MPC. The outdoor temperature profile was obtained from a typical summer day. The time-of-use price structure used in Hubei Province was applied.
The following table summarizes the key economic and operational metrics:
| Control Strategy | Total Daily Cost (CNY) | Peak Purchase (kWh) | Valley Purchase (kWh) | AC Switching Count | Battery Degradation Cost (CNY) |
|---|---|---|---|---|---|
| AC alone (0-1 control) | 16.52 | 2.10 | 0.95 | 18 | N/A |
| AC alone (MPC) | 14.98 | 1.80 | 1.10 | 12 | N/A |
| Fixed-speed AC + BESS (MPC) | 13.02 | 0.90 | 1.29 | 11 | 0.82 |
| Variable-speed AC + BESS (MPC) | 12.45 | 0.85 | 1.35 | 9 | 0.68 |
The results show that the coordinated operation of the air conditioner and battery energy storage system significantly reduces total electricity cost. The variable-speed AC + battery energy storage system achieves a 13% cost reduction compared to the standalone AC with MPC (12.45 vs 14.98 CNY). The battery energy storage system shifts load from peak to valley hours, and the air conditioner pre-cools before peak periods, as shown in the time-domain profiles. The battery degradation cost, though small, is included in the objective, and the variable-speed case exhibits lower degradation due to smoother power profiles.
We also observed that the system respects the minimum on/off constraints, reducing compressor wear. The number of AC switching events decreased from 18 (0-1 control) to 9 (variable-speed + BESS). The pre-cooling behavior is evident in Figure 6 of the original paper; the indoor temperature reaches the upper comfort bound just before the peak price period, effectively using the building thermal mass as passive storage.
Physical Experiment (Heating Season)
We deployed the hardware system in a laboratory room and conducted a 24-hour test during a winter day. The outdoor temperature ranged from 0°C to 10°C, and the comfort band was set to 20–24°C. The MPC successfully maintained indoor temperature within the comfort range while coordinating the battery energy storage system. The battery charged during low-price nighttime hours (valley) and discharged during high-price morning and evening peaks. The AC pre-heated before the morning peak, reducing its on-time during expensive periods. The following table presents the measured results compared to a baseline of AC-only operation (simulated using the same weather conditions):
| Metric | AC Only (Simulated) | AC + BESS (Measured) | Improvement |
|---|---|---|---|
| Total electricity cost (CNY) | 22.3 | 19.4 | 13% reduction |
| Peak-hour purchase (kWh) | 3.1 | 1.8 | 42% reduction |
| Valley-hour purchase (kWh) | 1.5 | 2.9 | 93% increase |
| AC switching events | 14 | 10 | 29% reduction |
| Battery degradation cost (CNY) | N/A | 0.72 | – |
The physical experiment confirms that the proposed integrated system is practically feasible and delivers the expected economic benefits. The pre-heating and pre-charging behaviors are clearly visible in the time-series data. The system maintained the indoor temperature within 20–24°C throughout the day, even when the outdoor temperature fluctuated. The AC start-stop frequency was reduced by 29% compared to the simulated baseline, which would contribute to longer compressor life.
Comparison between Simulation and Physical Results
Both simulation and physical experiments demonstrate the effective pre-conditioning behavior of the air conditioner and battery energy storage system before peak price periods. In simulation, the indoor temperature was controlled precisely near the upper limit, whereas in the physical test, slight oscillations occurred due to sensor noise, actuator inaccuracies, and unmodeled disturbances (e.g., door openings). The battery energy storage system in the physical test also had minor SOC drifts because of imperfect efficiency modeling. Nevertheless, the overall cost savings and operational patterns were consistent. The MPC framework’s inherent feedback mechanism compensated for these discrepancies, ensuring robust performance.
Conclusion
We have presented a comprehensive study on the coordinated optimal control of a household air conditioner and a battery energy storage system under time-of-use pricing. The optimization model, formulated within a model predictive control framework, minimizes total electricity cost while respecting thermal comfort, battery constraints, and minimum on/off times for both devices. We have implemented the entire system in a real laboratory environment using IoT communication, an energy management platform, and commercial hardware. Simulation and physical experiments validate that the proposed approach reduces electricity cost by 13% compared to standalone air conditioner operation. The battery energy storage system effectively shifts load from peak to valley hours, and the air conditioner pre-heats or pre-cools using the building’s thermal mass. Furthermore, the minimum duration constraints reduce the wear on compressors and battery switches, potentially extending equipment life. Our work provides a practical and verified pathway for integrating the battery energy storage system with residential HVAC systems, contributing to more efficient and economical demand-side management.
