*3.1. Energy Management Components*

The following list describes the different EMCs that govern home energy management, as well as some of the relationships between them:


Usually, these devices will be the most critical ones in DR strategies such as flexibility management.

5. *Home Energy Controller (HEC)*: in charge of control and optimisation. It can make use of different strategies and techniques, from semantic reasoning to the use of traditional optimisation methods or artificial intelligence. Its purpose is to deal with and mediate between components, ensuring that the energy budget is optimised and providing useful high-level information to be shared with others, such as HAS (1) and HEG (3).

It is worth mentioning at this point that EMCs are not single or individual instances. Different device components could be designed for a washing machine and an electric vehicle charger. Conversely, components do not have to be implemented in a single final unit; for example the HEC could be split into different software modules in charge of energy brokering, total energy consumption forecasting and deciding different strategies for DR.

#### *3.2. Knowledge Base*

As depicted in Figure 3, we propose an architecture centred around the KB. Components are capable of realising their goals as well as interacting and cooperating by using the Knowledge Base (KB), where all the information of the system is stored.

The information stored in the KB includes meta-information regarding different aspects, such as data typing and ontological links to the represented concepts. This "enriched" information is called *context* in our system.

The structure and semantic roots of context in our proposal and the mechanisms to interact with it, are further described in Section 3.5. The components responsible for its management are first described in Section 3.3. Finally, the KB is also used as a means for coordination and orchestration among EMCs in the system, leveraging its publish/subscribe nature and flexible data model. This is further described in Section 3.7.

#### *3.3. Functional Architecture*

The functional architecture of our proposed HEMS consists of three layers (Figure 4) and a transversal security layer, in which the different components are structured as follows:

**Figure 4.** Layered architecture of the Smart Home Energy Management System.


as well as the provider of means to search, access and update that context. Its specific characteristics and details regarding the communication between components, the ontological foundation and the structure of the information model are described. This layer also holds the historic component, responsible for storing selected historical information (used for forecasting and data analysis) and making it available to EMCs. Both the CB and the historic component can be instantiated from the many already available implementations of FIWARE Generic Enablers, promoting re-usability.

