# Central Heating Cost Optimization for Smart-Homes with Fuzzy Logic and a Multi-Agent Architecture
## 3 Proposed System
### Communications between Agents  
In these subsections, the behavior of the system will be explained. How agents communicate with each other will be explained in detail. The proposed architecture is based on different modules, and every one of them is specialized to a different task or goal. However, the proposal is also based on the communication between the different modules, so they can share the results of their objectives to solve the common problem together. The communication between agents and modules is also a basic behavior of MAS. Once the system is deployed, the first agent that starts working is the supervisor agent. Once the supervisor agent is started, its first task is to start the rest of the agents of the system. These agents include sensor agents and AI agents. Once the rest of the agents are initiated, they will begin to work as defined by their behavior. Meanwhile, the agent supervisor will periodically check that the rest of the agents are alive. If some of them have failed and have stopped being active, the agent supervisor will be in charge of activating that agent/s again. On the other hand, the sensor agents will work in the way defined in the previous section, recovering the measured values and evaluating this value to determine their action or if they should change their behavior. When the action is to send the measured values, these will be sent to the fuzzy agent. Here, the fuzzy agent will be listening to the messages that can come from the sensor agents to obtain the values that will determine the control action to be done. If not all the values are obtained after a considerable time, the last values stored in the database will be used and the supervisor agent will be warned that something may have happened with some sensor agent. When all the values are received, the blurred control system will be initialized. The rules and membership functions will depend on the study case. Therefore, in Section 4, rules and membership functions will be explained and analyzed. Consequently, once the output is defined, the fuzzy agent will send another message to the control agent. This agent will apply the output to the physical system and once it is done, it will inform the supervisor agent through a message. This process will be repeated as many times as desired. The most interesting approach is to run this process every, for example, five minutes to check if the environmental circumstances have changed since the last control action was performed and therefore, the control action has also changed. With this approach, the computational cost, as well as the impact on a real distributed sensor network, will be minimized since sensors will not be constantly sending data. This strategy will also reduce energy consumption since agents can sleep while this window of time is closed, decreasing the consumption of said agents as well as sensors. A lower interval is possible; however, the energy consumption of the system and sensors will increase. A higher interval is also possible, although the measured values may change during that time as it might affect the users' comfort. Consequently, it is considered that the appropriate interval should be set to five minutes. The whole process is illustrated in Figure 2 for a better understanding. Figure 2: Communication behavior. This communication between agents also leads us to evaluate the computational cost that the proposed system has.