# Central Heating Cost Optimization for Smart-Homes with Fuzzy Logic and a Multi-Agent Architecture
## 3 Proposed System
### Devices Module  
The devices module is one of the two modules in which this proposed architecture is formed. This module contains the sensors' agents. Every module inside this architecture will be connected to a specific sensor through the specific protocol. The number of devices agents will depend on the number of circumstances that the central system wants to control or measure. In the current proposal, the system will have four different device sensors. These four sensors are listed below. * Outside temperature agent: the proposed system will include a temperature sensor located outside the home or building to obtain the temperature in the closest possible environment to the building. The use of a crawler agent and a crawler module were considered in obtaining the outside temperature. This module would connect itself to the Internet to obtain the temperature. However, usually the sensors that different webpages use are located outside the cities. Hence, temperature values could not be as reliable as expected. * Inside temperature agent: the system will also include a temperature sensor inside the house to know if the control system achieves the comfort temperature. There could be as many temperature sensors as the user wanted (for example, one per room). However, in this case, the mean temperature of all rooms will be considered. It is important to obtain the inside temperature since the control system will determine its action taking into account this value as we will see. * Outside humidity agent: another aspect that is important to consider when a control system wants to maximize the user's comfort is the humidity. Since the user is going to be inside the building, the proposed system will only consider the outside humidity; inside humidity will depend on the aimed temperature. * People counter agent: the control system will also be informed if there are people or not inside the building, so no energy is wasted at all. The control system will consider this information and will only turn on the system when there are people inside the building. Different kinds of sensors can be used for this purpose, from simple ones like PIR (Passive InfraRed sensor) sensors or presence sensors to more sophisticated sensors like thermal sensors or optical sensors. Furthermore, we can collect the total number of people inside the house or just if there is someone inside the building. The definition of this sensor could change, depending on the circumstances evaluated in the study case. However, the result will be the same, to know if there are people or not inside a building. All these agents work in very similar ways. As it is logical, each one of them will be connected to a different sensor, but its operation is practically identical. All of them have a cyclic behavior in which they obtain the current data that the sensor is measuring. Depending on this value, the agent will act in an intelligent way and will determine the most convenient action, even changing its behavior. All the agents share a common characteristic; they have a small temporary memory that stores the last n values measured by the sensor and collected by the agent. The value of the variable n is totally configurable; for this proposal, we have selected a value of \(n=50\). This temporary memory will be used with two purposes: (I) to check that the current measured value is not an extreme value (Equation (1) isused for this purpose) and (II) to check that the current measured value is not equal to the last \(n/25\) values available in the temporary memory. If the purpose (I) is fulfilled, the value is automatically discarded, and it is not saved in the system database, the agent temporary memory, nor sent to the fuzzy agent. Once checked (I), if it is also fulfilled (II) the agent intelligently increases the waiting time to take the next value, understanding that the values are stable, and it is not necessarily a constant consultation to the sensor. In this way its activity and energy reduces consumption.