# Central Heating Cost Optimization for Smart-Homes with Fuzzy Logic and a Multi-Agent Architecture
## 4 Case Study
### Evaluated Proposal
#### 4.2.2 Control's Design
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Input**} & \multirow{2}{*}{\begin{tabular}{c} **Input** \\ **Universe** \\ \end{tabular} } & \multirow{2}{*}{**Input Intervals**} & \multirow{2}{*}{\
\begin{tabular}{c} **Membership** \\ **Functions’ Type** \\ \end{tabular} } \\ \hline \multirow{3}{*}{Temperature gap} & \multirow{3}{*}{\([-10,10]\)} & Negative & \([-10,-8,-2,-0.5]\) & Trapezoidal \\  & & Zero & \([-1,0,1]\) & Triangular \\  & & Positive & \([0.5,2,8,10]\) & Trapezoidal \\ \hline \multirow{3}{*}{
\begin{tabular}{c} Outside \\ temperature \\ \end{tabular} } & \multirow{3}{*}{\([-46.25,74]\)} & Very cold & \([-46.25,-15,5]\) & Triangular \\  & & Cold & \([3,9,14]\) & Triangular \\  & & Warm & \([14,17,20]\) & Triangular \\  & & Hot & \([19,23,27]\) & Triangular \\  & & Very hot & \([26,50,74]\) & Triangular \\ \hline \multirow{3}{*}{Humidity} & \multirow{3}{*}{\([-41.67,140]\)} & Low & \([-41.67,0,30]\) & Triangular \\  & & Medium & \([20,40,60,80]\) & Trapezoidal \\  & & High & \([70,100,140]\) & Triangular \\ \hline \multirow{3}{*}{People} & \multirow{3}{*}{\([0,15]\)} & Zero & \([0,0,1]\) & Triangular \\  & & Few & \([0,3,6]\) & Triangular \\ \cline{1-1}  & & Medium & \([4,5,7,8]\) & Trapezoidal \\ \cline{1-1}  & & Lot & \([7,10,13]\) & Triangular \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Input membership functions definition. triangular functions are selected for shorter intervals. To illustrate this information better, Figure 3 shows the definition of the membership functions:  
As shown in the previous figure, these fuzzy groups represent the membership functions of the system and they define when a value is of one type or another. These fuzzy groups, combined with a series of rules, will define the behavior of the fuzzy system. Rules will evaluate the values of the measured variables and their belonging to any of the membership functions so they can obtain the output of the system. The rules defined for the current case study are defined below. They try to summarize a logic behavior based on the user's experience and knowledge:  
1. IF \"temperature gap\" IS \"negative\" OR \"temperature gap\" IS \"zero\" THEN 0
2. IF \"temperature gap\" IS \"positive\" AND \"people\" IS \"zero\" THEN 0
3. IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"very cold\" THEN 1
4. IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"cold\" THEN 1
5. IF \"temperature gap\" IS \"positive\" AND \"people\" IS \"few\" AND \"outside temperature\" IS \"warm\" THEN 1
6. IF \"temperature gap\" IS \"positive\" AND \"people\" IS \"medium\" AND \"outside temperature\" IS \"warm\" THEN 1
7. IF \"temperature gap\" IS \"positive\" AND \"people\" IS \"lot\" AND \"outside temperature\" IS \"warm\" THEN 0
8. IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"warm\" AND \"humidity\" IS \"high\" THEN 1
9. IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"warm\" AND \"humidity\" IS \"medium\" THEN 1  
Figure 3: Membership functions. (**a**) Temperature gap’s membership functions, (**b**) outside temperature’s membership functions, (**c**) humidity’s membership functions, (**d**) people’s membership functions. 10 IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"warm\" AND \"humidity\" IS \"low\" THEN 1
11 IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"hot\" THEN 0
12 IF \"temperature gap\" IS \"positive\" AND \"outside temperature\" IS \"very hot\" THEN 0  
In the previous list, 0 and 1 represent the output of the control system that is going to be applied to the physical system, off and on, respectively. With these rules, the control system infers the normal actions that users could take in their homes and buildings to promote sustainable use of central heating systems. In fuzzy control systems, the rules are usually implemented by experts; in this case study, the experts are the users of the system.