# Central Heating Cost Optimization for Smart-Homes with Fuzzy Logic and a Multi-Agent Architecture
## 5 Results and Discussion
### Fuzzy Control System  
The other great contribution of this work is the proposed fuzzy system in charge of controlling the behavior of the system. The aim was to design a new controller that could be able to reduce the use of fuel and therefore to reduce the cost for the citizens. So, the results shown by the fuzzy control system will be explained in this subsection. Firstly, once the simulation is done, it will be interesting to compare how the fuzzy controller works related to the original controller. Both controllers want to control the temperature inside the building, so it could be interesting to observe that variable. Hence, Figure 4 shows how this variable is controlled by both controllers:  
The previous figure shows the temperature variation. The original controller (non-fuzzy) shows a more changeable behavior. This type of behavior may have bad consequences for the system's users' health due to the quick changes in temperature. On the other hand, the proposed system does not vary at all when there are people inside the house. This characteristic facilitates the users' comfort. In Figure 4 we can also observe that the fuzzy controller also has a temperature loss during some specific moments. This behavior can be linked to a bad performance of the controller, however, in Figures 5 and 6 it can be seen that this temperature loss is due to the case in which there are no people inside the building/house. Figure 4: Temperature variation with the different controllers. Figure 5 also shows that the fuzzy controller does not achieve the desired temperature, however, the error is stable, and the difference does not have a significant impact on users' comfort. Therefore, we can conclude that the fuzzy controller works stably and that it does not compromise the comfort of the users. Figure 5: Fuzzy inputs variation. Figure 6: Humidity fuzzy input variation. Another important characteristic when applying a new proposal is to reduce the cost or decrease the emissions of the system. In the evaluated system, these two concepts are linked since the fuel necessary to heat the system's water is the one responsible for gas emissions, while at the same time it is also the one responsible for the cost waste. So, it is important to evaluate the impact on the cost that the system has. This cost is obtained with the amount of fuel consumed and the price established in the baseline. To answer this question, Figure 7 is presented. In it, we can see that in just 50 h of continuous performance of the system, the proposal reduces significantly the cost of this type of system. Hence, the ROI (Return on Investment) is guaranteed. In addition, to better illustrate the total cost of both simulations, Table 5 is included. It shows the total cost of each simulation and the average temperature over the simulation. As can be seen, the proposed system decreases the cost by $10.84. The total cost is obtained by multiplying the fuel consumption by a fixed price (0.3002 $/l) defined again by the MATLAB Simulink model. However, the mean temperature is a bit lower because of the behavior explained before where the temperature decreases when there are no people in the building. That temperature is the average temperature during the entire simulation. In the proposal, the average temperature decreases when there are no people in the house, the heating system is turned off. During those moments, the temperature inside declines. Therefore, it is normal that these moments are reflected in the calculation of the average temperature. However, during the rest of the situations in which the heating is on, the temperature remains stable. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Simulation** & **Variable** & **Value** \\ \hline \multirow{2}{*}{Non-fuzzy} & Mean temperature & 23.20 \({}^{\circ}\)C \\  & Cost & 65.35 \$ \\ \hline \multirow{2}{*}{Fuzzy} & Mean temperature & 20.76 \({}^{\circ}\)C \\  & Cost & 54.51 \$ \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Simulations comparation. Figure 7: Cost evolution.