# Simplified Energy Model and Multi-Objective Energy Consumption Optimization of a Residential House
## 2 Materials and Methods
### Mathematical Model
#### 2.1.3 Heating and Cooling Subsystem  
Both heating and cooling are connected to the weather forecast. The model takes into account the desired temperature indoors and the forecasted data. The inside temperature is considered to change dynamically. Such dynamics are defined by a constant mass M, which describes heat accumulation. The energy balance is described by the discrete-time differential equation of the simplified zone thermal model [37; 38]:  
\[\mathrm{P_{heating}(k-1)+P_{Sun}(k-1)-P_{cooling}(k-1)=K\cdot(T_{inside}(k-1)-T_{ outside}(k-1))+M\cdot(T_{inside}(k)-T_{inside}(k-1))/T_{s}}, \tag{2}\]  
where  
\(\mathrm{k}\) is the current time step;  
Figure 1: Diagram of the residential house model structure. \(\mathrm{P_{heating}}\) is the heating power, W;  
\(\mathrm{P_{Sun}}\) is the heating power of the Sun, W;  
\(\mathrm{P_{cooling}}\) is the cooling power, W;  
\(\mathrm{T_{outside}}\) is the outside temperature, \({}^{\circ}\)C;  
\(\mathrm{T_{inside}}\) is the inside temperature, \({}^{\circ}\)C;  
M is a constant that consists of mass and specific heat;  
\(\mathrm{T_{s}}\) is the sampling period, s.  
Constants M and K were chosen to reflect experience in a real house; Moreover, the thermal loss coefficient K would change as a function of solar radiation, and convection due to wind speed and conduction. The simplified zone thermal model provides a simple way for modeling the house (especially in the case of simulation of a large aggregate of buildings) for which more detailed and complicated models cannot be used for real-time optimization. However, more complex methods such as ASHRAE [39] would be more suitable, for example, for comfort evaluations and for the sizing of the HVAC system in the presence of more thermal zones. There are also software programs, such as TRNSYS, that provide the possibility to have detailed simulations. However, the main idea behind this paper was to consider the parts of the model that might affect the resulting energy demands the most. In order to achieve the desired temperature inside the home, a PI controller was implemented into the model. It was considered that a controller would be present in the building so that the effects of changing the desired temperature could be seen. The PI controller used in the model is described by:  
\[\mathrm{u(k)}=\mathrm{u(k\text{-}1)}+\mathrm{k_{P}}\cdot(1+\mathrm{T_{s}}/ \mathrm{T_{ij}})\cdot\mathrm{e(k)}-\mathrm{k_{P}}\cdot\mathrm{e(k\text{-}1)}, \tag{3}\]  
where  
\(\mathrm{u}\) is the control output for heating or cooling, \(W\);  
\(\mathrm{k}\) is the current timestep;  
\(\mathrm{k_{P}}\) is the proportional gain of the controller;  
\(\mathrm{T_{s}}\) is the sampling period, s;  
\(\mathrm{T_{i}}\) is the integration time constant, s;  
\(\mathrm{e}\) is the control error, \({}^{\circ}\)C.  
The controller's output \(\mathrm{u}\) is calculated in each timestep, defined by the sampling period, from the control error \(\mathrm{e}\), which is the difference between the desired indoor temperature and the actual indoor temperature. The control error used in the PI controller is formulated as:  
\[\mathrm{e(k)}=\mathrm{w_{T}(k)}-\mathrm{T_{inside}(k)}, \tag{4}\]  
where  
\(\mathrm{w_{T}}\) is the desired indoor temperature, \({}^{\circ}\)C;  
\(\mathrm{T_{inside}}\) is the measured indoor temperature, \({}^{\circ}\)C.  
The calculated control output is then used as the heating or cooling power needed for the current time step in order to follow the desired indoor temperature in the next time step. Both heating and cooling have a defined maximal power consumption and efficiency of transforming electrical energy into heating or cooling power, so the control output cannot be infinite but is bounded. In the first step of the simulation, the actual indoor temperature is considered to be equal to the desired temperature unless the heating or cooling maximal power is exceeded.