# Central Heating Cost Optimization for Smart-Homes with Fuzzy Logic and a Multi-Agent Architecture
## 4 Case Study
### Baseline  
In order to compare the results obtained with the proposed method it is essential to equate it with a common solution of the problem. Consequently, a baseline is required. Additionally, to test and validate the proposal and possible changes in the system, the simulations will be run in a virtual environment rather than in a real one. MATLAB's Simulink toolbox [62] has been used for this purpose. There is a Simulink model that simulates the behavior of the house heating system [63]. The model mimics the behavior of a simple house heating system. It has a heater, a basic controller typically used in this kind of installations, and a house with four rooms and one radiator in every one of them. Each path inside the heating system is simulated as a combination of thermal convection, thermal conduction, and the thermal mass. The controller implemented in the baseline is a proportional control that evaluates the actual temperature of the house regarding the aimed temperature, with an error of \(\pm\) 2 \({}^{\circ}\)C, a 4 \({}^{\circ}\)C hysteresis. Hence if the actual temperature is higher than the aim one plus 2 \({}^{\circ}\)C, the controller does not open the gas valve; otherwise, if the actual temperature is lower than the aimed one minus 2 \({}^{\circ}\)C, it opens the valve. Equation (3) describes the controller behavior. As can be seen, the control seems to be very simple, but it is effective. Many heating controllers use this kind of controllers to satisfy the requirements of a house or building:  
\[V_{g}(t)=\left\{ \begin{array}{ll}1,&T_{c}<T_{a}-2\\ 0,&T_{c}>T_{a}+2\end{array} \right. \tag{3}\]  
where \(V_{g}(x)\) is the state of the valve at moment \(t\), \(T_{c}\) is the current temperature, and \(T_{a}\) is the aimed temperature. The heater of the system receives the fuel that the valve, regulated by the aforementioned control, supplies, and the water inside the thermal system and returns the same water but hotter thanks to the boiler effect. The boiler acts under constant circumstances of humidity and air. It can transfer the heat generated by the combustion to the water thanks to a heat exchanger [64]. So, the water that leaves the heater is much hotter than the one that enters it. As mentioned before, the model of the house has four rooms, with one radiator in each one of them. These rooms receive the influence of the outside temperature that changes over time. In this approach, the external temperature is simulated using Equation (4):  
\[T(t)=A\cdot\sin(F\cdot t+P)+b \tag{4}\]  
where \(T\) is the temperature obtained at a specific time \(t\), \(A\) is the amplitude of the \(\sin\) function, \(F\) is the frequency (rad/s), \(P\) the phase (rad), and \(b\) the bias applied to the function. To obtain the temperature values, the amplitude was defined to 6, the frequency to \(\frac{2\cdot T}{12.3600}\), the phase to 0, and the bias to 5. The radiators of the rooms transfer the heat in the water to the air. The model's rate of heat transfer is proportional to the temperature difference between the air and the fluid, the heat transfer coefficient (100 W/m\({}^{2}\) k), and the surface area in contact with the liquid (5 m\({}^{2}\)). Every radiator in the system shares these properties. The convective heat transfer is defined in Equation (5). Furthermore, each room exchanges heat with its environment through its exterior walls, roof, and windows. In this model, it is assumed that rooms do not exchange heat between each other. The rooms have six different types of heat transfer: roof-atmosphere convection, roof-atmosphere leakage, air-roof convection, wall-atmosphere convection, wall-atmosphere leakage, wall-roof convection, window-atmosphere convection, window-atmosphere leakage, and window-roof convection. The heat transfer is additionally defined by Equation (5) However, in this case, some considerations must be taken into account.