Design and Implementation of an Interoperable Architecture for Integrating Building Legacy Systems into Scalable Energy Management Systems

: The building sector is responsible for a signiﬁcant amount of energy consumption and greenhouse gas (GHG) emissions. Thus, the monitoring, control and optimization of energy consumption in buildings will play a critical role in the coming years in improving energy efﬁciency in the building sector and in reducing greenhouse gas emissions. However, while there are a signiﬁcant number of studies on how to make buildings smarter and manage energy through smart devices, there is a need for more research on integrating buildings with legacy equipment and systems. It is therefore vital to deﬁne mechanisms to improve the use of energy efﬁciency in existing buildings. This study proposes a new architecture (PHOENIX architecture) for integrating legacy building systems into scalable energy management systems with focus also on user comfort in the concept of interoperability layers. This interoperable and intelligent architecture relies on Artiﬁcial Intelli-gence/Machine Learning (AI/ML) and Internet of Things (IoT) technologies to increase building efﬁciency, grid ﬂexibility and occupant well-being. To validate the architecture and demonstrate the impact and replication potential of the proposed solution, ﬁve demonstration pilots have been utilized across Europe. As a result, by implementing the proposed architecture in the pilot sites, 30 apartments and four commercial buildings with more than 400 devices have been integrated into the architecture and have been communicating successfully. In addition, six Trials were performed in a commercial building and ﬁve key performance indicators (KPIs) were measured in order to evaluate the robust operation of the architecture. Work is still ongoing for the trials and the KPIs’ analysis after the implementation of PHOENIX architecture at the rest of the pilot sites.


Introduction
Climate change is accelerating the need for action to reduce energy demand in buildings, as the building sector accounts for approximately 33% of global GHG emissions and consumes 40% of total energy [1]. Given that a large proportion of the EU's buildings are old and energy inefficient, a full-scale refurbishment would be unrealistic in terms of feasibility and cost [2]. This problem is compounded by the wide variability of energy-related technologies integrated within existing buildings. Hence, retrofitting while maintaining legacy systems is a necessity but needs extra effort, because their interoperability is of critical importance. IEEE Std 2030-2011 defined a Smart Grid Interoperability Reference model (SGIRM), where three Interoperability Architectural Perspectives (IAP) are presented [3]: the power systems IAP, the communications technology IAP and the information technology IAP. Each perspective constitutes a sub-discipline, or an industry in itself, with a wide variety of standards and expectations. The concept of the smart grid integrates those perspectives in the cyber-physical domain, where the actions of one perspective influence the other. Additionally, in the IEEE Std 2030-2011, the various actors and entities of the three perspectives are presented and arranged in domains, such as system operators, markets, large organizations or end-user devices [3]. The communications technology perspective offers interconnection between these domains, and this is where interoperability issues with legacy systems may start to appear. In a similar but slightly different approach, the Smart Grid Reference Architecture (SGRA) developed by CEN-CENELEC [4] overlays several interoperability layers onto the physical domains. This is key to the successful implementation and adoption of interoperability standards since these layers span from the hardware to the business context or the regulatory and policy implications of the application. This interoperability of layers has also been highlighted by the IEA International Smart Grid Action Network (Annex 6), as it is argued that often the problem is not the lack of technical standards but the lack of a governance process [5]. The PHOENIX architecture presented in this paper is based on the IEEE SGIRM and CEN-CENELEC SGRA approaches, in the sense that the different domains involved interact through several information layers.
Cyber-security is also a significant concern, as various legacy systems can have wildly different security capabilities, owning a "large attack surface" [6,7]. It is recommended that legacy systems are protected in certain ways, so that they do not compromise the security of the whole architecture. The methods of achieving that aim include communication channel segregation; device hardening, such as deactivating unneeded interfaces; and redundancy [6].
When it comes to the interoperability of data, the IEC Technical Committee 57 (IEC TC 57) Common Information Model (CIM) (IEC 61970) [8] and IEC 61968 standards [9] offer a level of harmonization of the data structures and definitions, although there is no guarantee that legacy systems comply with information models and standards. The ontologies of smart grid and energy-related systems, including Building Management Systems (BMS), have been developed [10], allowing the standardization of the way information is shared across the cyber-physical domains.
The development of smart grid Information and Communication Technologies (ICT) has brought significant developments from the very basic BMS to sophisticated approaches based on the IoT and AI. Multi-agent systems (MAS) in particular have been increasingly used in energy-centred applications, including BMS [11,12]. Legacy systems are practically integrated into such advanced schemes, usually by implementing middleware nodes, which offer the abstraction of the legacy technologies and contribute towards creating a scalable and generic BMS [13].
Novel approaches to BMS bring new challenges, such as cyber-security, as discussed above, but also great opportunities. Enhanced sustainability, resilience and flexibility are some of those potential benefits [14]. In this way, BMS offers the control of the indoor environment, while contributing to a wider scalable smart grid architecture [11]. AI techniques, such as Fuzzy Logic [15] or neural networks, offer forecasting of energy production and consumption and allow the optimization of energy management schedules in order to enhance buildings' energy efficiency in terms of cost savings and environmental impact [15]. Additionally, AI techniques can transfer the extracted knowledge on energy consumption between buildings with different levels of maturity with regards to their IoT deployments [16]. While the essence and definitions of resilience in power systems [17,18] and interdependent infrastructure systems [19] are still under development, the resilience benefits of such AI-based BMS architectures can be foreseen. The platforms that host the implementations of such multi-agent systems can vary from industrial ones to embedded devices [20]. These agent-based approaches often implement transactive energy manage-ment system concepts, where consumers are actively participating in the operation of the grid, often referred to as prosumers [21]. This paper presents an interoperable architecture for the successful integration of legacy systems often found within buildings, while maintaining the scalability of the smart grid architectures discussed above, as described in Section 2 below. The PHOENIX architecture implementation at a pilot scale and the related tests in realistic trials are described in Section 3, using an agent-based approach. Finally, Section 4 offers an in-depth discussion of the results, and Section 5 shows the conclusions drawn and lessons learned.
Detailed abbreviations and definitions used in the paper are listed in Table 1.

Contributions to Knowledge
The proposed architecture provides novel modular tools (i.e., Knowledge Graph (KG) with semantic representation powered by ML) for creating building/energy knowledge, based on homogenized data through analytic modules, to upgrade the smartness of the buildings. In particular, the architecture includes knowledge techniques and semantic annotations to build a background KG. The KG contains information about the typical numerical representatives of the different devices. The developed KG is based on standardized semantic representation and models, such as Smart Applications REFerence (SAREF) ontology, Brick, NGSI-LD Data Model, ASHRAE standards, ENTROPY Semantic Models and the W3C Web Data Annotation. The KG implementation enables automatically semantic annotations to be assigned to legacy data by using ML methods, such as clustering and classification.
The KG provides an abstraction layer that provides segregation, improving cybersecurity, in line with recommendations in [13] but with additional functionality compared to the technologies considered in that paper. In addition, the ML and agent-based technologies provide advanced functionality, such as a blackout ride-through for the end-users, maintaining the benefits of such approaches as these are seen in the literature described above. Most importantly, the above technologies are demonstrated to be operational in practice, through several real-world trials.

Materials and Methods
To address the gaps of integrating buildings with legacy systems into advanced platforms with or without BMS, this paper proposes a novel architecture-called PHOENIX architecture-that was developed through the Commission-funded H2020 project PHOENIX (https://eu-phoenix.eu/, accessed on 1 September 2022). A 10-step methodology, presented in Figure 1, was followed in the project with the aim of creating an integration process applicable to any kind of building.
(PoC) takes place. The PoC contributes to the definition of the architecture by evaluat technical solutions and identifying the concepts required for its design. In Step 2, the K needed for the evaluation of the architecture are defined, mostly targeting energy opti zation and users' acceptance. The subsequent Steps 3-7 are essentially the proposed chitecture for integrating legacy systems and are analysed in the following subsecti Steps 8-10 are used for the validation of the architecture which-for the needs of the p ject-are implemented apart from the PoC in four different pilot locations.

PHOENIX Architecture
To address the integration of legacy equipment into advanced platforms, accomm dating the monitoring and control of buildings' services, the PHOENIX architecture p poses a grid of interoperability layers consisting of five horizontal and one vertical The approach, as illustrated in Figure 2, shows the flow of data and information (col tion, process and use) from building premises to the point of interaction with the e users. Following a bottom-up perspective, the layers are developed as follows: In Step 1, the selection of a demonstration building that is used as a Proof of Concept (PoC) takes place. The PoC contributes to the definition of the architecture by evaluating technical solutions and identifying the concepts required for its design. In Step 2, the KPIs needed for the evaluation of the architecture are defined, mostly targeting energy optimization and users' acceptance. The subsequent Steps 3-7 are essentially the proposed architecture for integrating legacy systems and are analysed in the following subsection. Steps 8-10 are used for the validation of the architecture which-for the needs of the project-are implemented apart from the PoC in four different pilot locations.

PHOENIX Architecture
To address the integration of legacy equipment into advanced platforms, accommodating the monitoring and control of buildings' services, the PHOENIX architecture proposes a grid of interoperability layers consisting of five horizontal and one vertical [2]. The approach, as illustrated in Figure 2, shows the flow of data and information (collection, process and use) from building premises to the point of interaction with the end users. Following a bottom-up perspective, the layers are developed as follows: and provided to the end-users in order to optimize building energy consumption (through energy saving schemes, demand response and self-consumption services) and increase occupants' well-being (optimize health, comfort and convenience). This layer implements an adaptable dashboard to gather user behavioural characteristics and preferences related to energy consumption and indoor conditions. These services are provided through user-friendly interfaces both for technical and non-technical users, such as occupants and building managers. (E) Business layer, which constitutes the area of interaction with end-users. At this layer all innovations deployed are further exploited by analysing technical and business aspects of implemented solutions in real demo-sites and the interaction with occupants, building managers and stakeholders.
In parallel with these horizontal layers, a vertical one is established to ensure the privacy protection through the development of security mechanisms. The protection layer is a necessary part of this architecture as, due to its interoperable nature, all data collected and processed in all stages of the aforementioned layers have to be protected, taking into consideration privacy and trust mechanisms as well as security and protection processes. To achieve this, the protection layer incorporates multiple privacy and security by-design techniques to enable machine-to-machine authentication, data encryption, privacy preserving, user management and services access control.
To validate the proposed architecture, five real demonstration sites (including the PoC pilot) were selected across Europe, in which the implementation of the methodology takes place. The work presented here focuses mainly on the PoC for which tangible results are already available; as for the rest of the pilot sites, the implementation of the architecture is in early stages. erations (usually operated manually by building managers), as well as various external data sources, which provide weather forecasts and future energy tariffs, are also integrated. As there are various Internet protocols and data formats used to integrate heterogeneous data coming from devices and external sources, this layer follows the standardized approach of Industrial Data Space (IDS) that implements multiple IDS agents to support communication with different industrial and IoT protocols (i.e., MQTT, REST, COAP, etc.) to ensure the successful interoperability. (C) Knowledge layer, in which data are processed and homogenized to create the necessary knowledge for building management. To this end, ontology data models, such as SAREF and ETSI, are applied to a collection of entities that create building KGs through the development of AI-based algorithms. These algorithms are used to improve energy performance in buildings, as they have the capability of self-learning and providing automated decisions for energy saving and occupant well-being in different scenarios.

Description of Pilots and Implementation of PHOENIX Architecture
The practical application of the methodology is very important to demonstrate that the proposed architecture is indeed valid and can contribute positively to the transformation of buildings towards their energy upgrade. From this perspective, five demonstration sites across Europe were selected due to their varied location and type of use (residential and commercial), so as to demonstrate the robustness of the proposed architecture. One of these pilot sites was used as PoC, meaning that PHOENIX architecture was finalized based on the received feedback and defined requirements of this pilot, as defined in Step 1 (Figure 1) of the developed methodology.
The demonstration sites are distributed as follows: two pilot sites in Spain (one of which is the PoC), one pilot site in Greece, one pilot site in Ireland and one pilot site in Sweden. The facilities of the demonstration sites include apartments, shopping malls, offices and lecture halls; more details about the PoC and the rest of the pilot sites are provided in the following sections.

PoC Pilot-Spain
The PoC pilot site is located in the Computer Faculty at the University of Murcia. The main building where the PoC takes place is called Pleiades and consists of five floors, in addition to the ground floor, with a total area of 10,983 m 2 . The monitored areas include offices, laboratories, lecture halls and libraries. The main objective of the PoC is to improve the energy management of the university facilities while maintaining the comfort of the students, lecturing personnel and other users. Therefore, energy management optimization considers the power needs of the building, including both reducing energy consumption and shifting power peaks. To measure the effectiveness of technological applications in the monitored areas and in line with the objectives of this work, a list of KPIs is proposed and presented in Table 2. In PoC premises, there is a BMS available, based on the IoT platform "OpenData", which provides a SCADA-based multi-user web technology to collect information from the sensors (such as humidity, temperature, room occupancy and lighting) placed at various positions. Sensors and BMS data are accessible via two software adapters of the built and developed FIWARE platform. The Orion Context Broker (OCB) processes all sensor readings which are stored in a data repository through the COMET enabler. In addition, BMS provides REST/JSON APIs to exchange real-time data from sensors and actuators, with the OCB, as well as to retrieve historical data from the COMET repository.
To enable integration and data exchange between the BMS system and the PHOENIX platform, two middleware components have been implemented to translate the data format from both BMS APIs to the platform's NGSI-LD interface.
The PoC pilot accommodates a wide range of legacy devices ( Figure 3) related to building's energy consumption, but they were neither monitored nor controlled.   Depending on the technology used by each device, the different types of middleware and gateways were employed for a seamless connection with the PHOENIX platform. Thus, to achieve communication between connected TCP/RTU devices with Modbus, Zwave gateways and the SCADA system, a set of agents was integrated using custom-built middleware ( Figure 4).  To ensure and support the deployment of the intervention and to validate the successful demonstration of the PoC's KPIs, a trial plan was defined (Table 3).  In addition, the integration of external weather data sources is imposed for real-time data and the weather forecast from the well-proven weather data source called Weatherbit [22] in JSON format, using latitude and longitude coordinates. Moreover, energy information about tariffs and grid network are integrated by means of external EU data sources, such as EU ENTSO-E, which is the European association for the cooperation of Transmission System Operators (TSOs) for electricity. To this end, two middleware agents were developed to allow access to data source APIs and send this information to the PHOENIX platform using an MQTT/SSL interface.
To ensure and support the deployment of the intervention and to validate the successful demonstration of the PoC's KPIs, a trial plan was defined (Table 3). Trial No1 (Demand Response (DR) strategy for flexibility extraction-tariff scheme) concerns triggering the heating, ventilation and air conditioning (HVAC) set points to shift consumption from periods of high demand to periods of low demand. In addition, this trial examines people's reaction to these kinds of changes. Trial No2 (DR strategy for flexibilityrenewable generation) concerns triggering the HVAC set point to shift consumption from periods of high emissions to periods of low emissions, taking into account the generation of renewables on a national level. In addition, this trial examines people's reaction to this kind of change.
Trial No3 (DR strategy for energy saving) focuses also on energy saving issues but without involving the occupants. The concept is that on days where high consumption is expected, possibly with peak demands, an actuation is sent to the thermostats; this action can either modify the HVAC's set point or disable the system for short periods of time. Trial No4 (Occupants' feedback) evaluates the user acceptance of the proposal and is particularly related to the load shifting trials (Trial No1 and Trial No2). Evaluation takes place directly via questionnaires during the trial period. Trial No5 (Ventilation control) concerns the air quality of the offices; when high concentrations of CO 2 are detected, the mechanical ventilation is turned on. In addition, the real-time CO 2 measurements are available to endusers, allowing the trial to be within occupants' awareness. In trial No6 (Crowdsensing), occupants are involved by voting for the temperature set point they prefer on the platform. Then, the desired-by the users-average temperature is sent to the thermostats. At the end of the trial, the acceptance of the method is evaluated through questionnaires.
The results from the performed trials, as well as the lessons learned from the process of implementing the PHOENIX architecture in PoC pilot site are thoroughly discussed in Section 4.

Four Large Scale European Pilots
As mentioned previously, in order to validate the proposed architecture in real-life scenarios, four additional pilot sites were selected: one in Greece, one in Ireland, one in Spain and one in Sweden. Figure 5, below, shows an abstract description of the type of use and of some basic information regarding the available equipment. on residents' commitment to emerging sustainable technologies. The commercial buildi is a repurposed boiler room and provides a good test bed for optimizing a building w a BMS and a range of energy consuming and generating equipment. The Spanish pilot site includes an office building, in which the corporate premis are monitored, consisting of offices and conference rooms, and a residential building co sisting of four apartments of approximately 125 m 2 each. Its objectives are focused on i proving intelligence and energy efficiency in buildings, while allowing the user to becom a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commerci and its goals are focused on saving energy, maintaining comfort and convenience for o cupants, and improving final energy costs. It has eight apartments and a commercial ar on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living spa The building has apartments which have up to five rooms each and there is a comm area for socializing and a communal laundry. In addition, there is a BMS that manage t energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate t impact of the PHOENIX architecture implementation. Table 4 presents the list of the pr posed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemente Self-sufficiency achievement in the order of 30-50% Blackout support for specific loads with over 90% reliability Energy cost reduction of over 30%

Increased residents' satisfaction
Increase usage of EV charging point of over 10% compared to baseline scenario Total target energy saving 20-30% User acceptance of smart controls and demand response The Greek pilot site is a two-storey resident building of eight apartments approximately 80 m 2 each. The main objectives of the Greek pilot are focused on two main streams to bring added value to the facilities; these are to increase the energy efficiency of the building and to optimize residents' comfort. In both cases, the reduction of energy costs for households is also considered.
The Irish pilot site consists of one commercial and two residential buildings. Its objectives focus on improving energy management in the various buildings of the pilot-taking into account the improvement of occupant's comfort-, as well as improving DR events and flexibility for network optimization. Ten apartments have been selected based on residents' commitment to emerging sustainable technologies. The commercial building is a repurposed boiler room and provides a good test bed for optimizing a building with a BMS and a range of energy consuming and generating equipment.
The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented Self-sufficiency achievement in the order of 30-50% on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented Blackout support for specific loads with over 90% reliability on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented Self-sufficiency achievement in the order of 30-50% Blackout support for specific loads with over 90% reliability cupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented sisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements. The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented Self-sufficiency achievement in the order of 30-50% Blackout support for specific loads with over 90% reliability The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented Self-sufficiency achievement in the order of 30-50% Blackout support for specific loads with over 90% reliability Energy cost reduction of over 30%

Increased residents' satisfaction
Increase usage of EV charging point of over 10% compared to baseline scenario Total target energy saving 20-30% User acceptance of smart controls and demand response Regarding the field devices that reside in the pilot sites, they are distinguished in two main categories. The first category is the legacy equipment that has no intelligence level, and in order for it to communicate with the PHOENIX platform, it is necessary to inset new smart devices (e.g., smart meters, smart actuators, etc.). The second category relates to existing devices that already use communication protocols, such as Modbus TCP/IP, so no further adaptation was necessary in order for them to communicate with the PHOENIX platform. Apart from the above, there is also the case of BMS existence in two pilot sites, the Irish and Swedish, so in these cases middleware is implemented to reach BMS's communication with the PHOENIX platform. Figure 6 below presents the total amount of devices (existing and newly added) that are communicating with the PHOENIX platform.
s 2022, 5, FOR PEER REVIEW 11 Regarding the field devices that reside in the pilot sites, they are distinguished in two main categories. The first category is the legacy equipment that has no intelligence level, and in order for it to communicate with the PHOENIX platform, it is necessary to inset new smart devices (e.g., smart meters, smart actuators, etc.). The second category relates to existing devices that already use communication protocols, such as Modbus TCP/IP, so no further adaptation was necessary in order for them to communicate with the PHOE-NIX platform. Apart from the above, there is also the case of BMS existence in two pilot sites, the Irish and Swedish, so in these cases middleware is implemented to reach BMS's communication with the PHOENIX platform. Figure 6 below presents the total amount of devices (existing and newly added) that are communicating with the PHOENIX platform. As in the PoC pilot site, a series of trials are performed to validate the successful demonstration of the rest of the pilot's KPIs. Table 5 presents the list of the proposed trials and indicates the pilots in which they are demonstrated.
The successful integration of all devices is confirmed and validated through Trial No1 (Validate successful integration of devices). Then the Trial No2 (Residents' engage- As in the PoC pilot site, a series of trials are performed to validate the successful demonstration of the rest of the pilot's KPIs. Table 5 presents the list of the proposed trials and indicates the pilots in which they are demonstrated. All devices connected successfully to gateway, send data to platform and vice versa cupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors. As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented are monitored, consisting of offices and conference rooms, and a residential building con-sisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements. The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented

Self-sufficiency achievement in the order of 30-50%
Blackout support for specific loads with over 90% reliability a prosumer and take full advantage of these improvements. The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented  The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented

Self-sufficiency achievement in the order of 30-50%
Blackout support for specific loads with over 90% reliability Energy cost reduction of over 30%

Increased residents' satisfaction
Increase usage of EV charging point of over 10% compared to baseline scenario Total target energy saving 20-30% User acceptance of smart controls and demand response 6 Forecasting algorithms (production and consumption) Compare forecasting results to real data as regards energy production and consumption Figure 5. Pilots' type of use and field devices.
The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented  The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented

Self-sufficiency achievement in the order of 30-50%
Blackout support for specific loads with over 90% reliability  The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented

Self-sufficiency achievement in the order of 30-50%
Blackout support for specific loads with over 90% reliability Energy cost reduction of over 30%

Increased residents' satisfaction
Increase usage of EV charging point of over 10% compared to baseline scenario Total target energy saving 20-30% User acceptance of smart controls and demand response 9 Smart Billing Employing time of use tariffs for pilot sites carried out. In Trial No9 (Smart billing) the time of use tariffs for the Irish pilot are implemented considering buildings' baseline load profiles, encouraging customers to use energy at off-peak times. Trial No10 (Evaluation of flexibility) evaluates the performed actuations and control on the heat pump and hot water according to DR requests, while Trial No11 (Self-consumption increase) evaluates the control of the PV output, aiming to optimize the use of energy generated from renewable energy sources (RES). Self-consumption increase Evaluation of self-consumption Implementation of the PHOENIX architecture in the four pilot sites is in progress; therefore, the results of the validation process (KPIs and trials) are still being analysed. Despite this, a first rough presentation of the lessons learned so far during the implementation procedure in these demonstration areas is assessed in Section 4.

Results and Lessons Learned from PoC Pilot
This subsection provides the results from the defined trials as well as a list of lessons learned during the deployment and demonstration of the PHOENIX architecture in the PoC pilot site.
The first trials (DR-strategy for flexibility extraction) consisted of sending demand response events to the pilot building in order to test the possibility of shifting the load to reduce the grid charge at certain hours by changing the thermostat set point temperature during limited timeframes. In particular, Trial No1 (DR strategy for flexibility extraction- 10 Evaluation of flexibility Optimisation of heat pumpHot water controlled to run at times of lowest market cost carried out. In Trial No9 (Smart billing) the time of use tariffs for the Irish pilot are implemented considering buildings' baseline load profiles, encouraging customers to use energy at off-peak times. Trial No10 (Evaluation of flexibility) evaluates the performed actuations and control on the heat pump and hot water according to DR requests, while Trial No11 (Self-consumption increase) evaluates the control of the PV output, aiming to optimize the use of energy generated from renewable energy sources (RES). Self-consumption increase Evaluation of self-consumption Implementation of the PHOENIX architecture in the four pilot sites is in progress; therefore, the results of the validation process (KPIs and trials) are still being analysed. Despite this, a first rough presentation of the lessons learned so far during the implementation procedure in these demonstration areas is assessed in Section 4.

Results and Lessons Learned from PoC Pilot
This subsection provides the results from the defined trials as well as a list of lessons learned during the deployment and demonstration of the PHOENIX architecture in the PoC pilot site.
The first trials (DR-strategy for flexibility extraction) consisted of sending demand response events to the pilot building in order to test the possibility of shifting the load to reduce the grid charge at certain hours by changing the thermostat set point temperature during limited timeframes. In particular, Trial No1 (DR strategy for flexibility extraction- 11 Self-consumption increase Evaluation of self-consumption Figure 5. Pilots' type of use and field devices.
The Spanish pilot site includes an office building, in which the corporate premises are monitored, consisting of offices and conference rooms, and a residential building consisting of four apartments of approximately 125 m 2 each. Its objectives are focused on improving intelligence and energy efficiency in buildings, while allowing the user to become a prosumer and take full advantage of these improvements.
The Swedish pilot site includes a building that is both residential and commercial, and its goals are focused on saving energy, maintaining comfort and convenience for occupants, and improving final energy costs. It has eight apartments and a commercial area on the ground floor. The total area is 1920m 2 of heated space and 1278 m 2 of living space. The building has apartments which have up to five rooms each and there is a common area for socializing and a communal laundry. In addition, there is a BMS that manage the energy from HVAC and domestic hot water (DHW) sensors.
As in the PoC pilot site, a set of KPIs is defined for all pilot sites to demonstrate the impact of the PHOENIX architecture implementation. Table 4 presents the list of the proposed KPIs and indicates the pilots in which they are demonstrated.

KPIs Description and Targets
Pilot to Be Implemented

Self-sufficiency achievement in the order of 30-50%
Blackout support for specific loads with over 90% reliability Energy cost reduction of over 30%

Increased residents' satisfaction
Increase usage of EV charging point of over 10% compared to baseline scenario Total target energy saving 20-30% User acceptance of smart controls and demand response The successful integration of all devices is confirmed and validated through Trial No1 (Validate successful integration of devices). Then the Trial No2 (Residents' engagement) reveals whether the residents are receptive to the recommendations of the PHOENIX platform or not; in case they are not, corrective actions, such as training sessions and workshops, could be considered. For the validation of the battery, support in black out circumstances as well as the monitoring of EV's charger Trials No3 (Black-out support) and No4 (Electric vehicle usage) are defined, respectively. Moreover, there are two trials concerning the predictions and algorithms developed through PHOENIX.
Trial No5 (Simulated dynamic pricing) concerns the response of the algorithm to price changes, which in Greece need to be simulated because flexible tariff schemes are not yet provided to end users. Trial No6 (Forecasting algorithms) is concerned about the accuracy of the predicted energy production and consumption using the algorithms developed for the needs of the PoC pilot site. In Trial No7 (User acceptance of smart controls) and No8 (Comfort and convenience), an evaluation of whether the recommendations followed by the residents are consistent with their preferences and whether they bring the desired values for the KPIs in terms of energy savings and the comfort of the residents is carried out. In Trial No9 (Smart billing) the time of use tariffs for the Irish pilot are implemented considering buildings' baseline load profiles, encouraging customers to use energy at off-peak times. Trial No10 (Evaluation of flexibility) evaluates the performed actuations and control on the heat pump and hot water according to DR requests, while Trial No11 (Self-consumption increase) evaluates the control of the PV output, aiming to optimize the use of energy generated from renewable energy sources (RES).
Implementation of the PHOENIX architecture in the four pilot sites is in progress; therefore, the results of the validation process (KPIs and trials) are still being analysed. Despite this, a first rough presentation of the lessons learned so far during the implementation procedure in these demonstration areas is assessed in Section 4.

Results and Lessons Learned from PoC Pilot
This subsection provides the results from the defined trials as well as a list of lessons learned during the deployment and demonstration of the PHOENIX architecture in the PoC pilot site.
The first trials (DR-strategy for flexibility extraction) consisted of sending demand response events to the pilot building in order to test the possibility of shifting the load to reduce the grid charge at certain hours by changing the thermostat set point temperature during limited timeframes. In particular, Trial No1 (DR strategy for flexibility extraction-tariff scheme) was carried out to achieve a load shifting from high tariff to low tariff, aiming for a decrease of 20% on peak power loads and to an energy cost reduction of 18%. Trial No2 (DR strategy for flexibility extraction-renewable scheme) was carried out to achieve a 15% demand shifting from low renewable generation to high renewable generation. Both of them had a duration of 2 weeks in the winter period and two weeks in the summer period.
In Spain, where the PoC pilot site is located, all consumers have three or more periods daily with different energy prices. Moreover, there is the possibility of applying a dynamic tariff with an hourly price according to the actual market price. Trial No1 was performed to shift the load from high tariff hours to low tariff ones and its effect on efficiency was then analysed. The decision to choose the optimised hour for the intervention was carried out by forecasting the hourly price for the entire day ahead. The results that changed depending on the daily market prices consisted of the detection of two consecutive periods whose difference in the electricity price was maximum. To give an example of functioning for cooling loads, in the first period or low-price period, the setpoint temperature was lowered (the so-called 'precooling phase'), while in the second period or high price period, the setpoint temperature was raised. In this way, the demand was shifted to the period in which the electricity was less expensive. In particular, in the offices participating in the experiment, a typical energy consumption of 23 kWh was expected; however, the actual consumption during the DR event was 19 kWh. Therefore, a reduction of approximately 17.4% in energy consumption was achieved when tariffs were prioritized in the demand response strategy.
Trial No2 is based on the same methodology, but the hour intervals are chosen depending on the renewable energy generation. The decision making was based on CO 2 emissions, considering the energy production of the different energy sources used in Spain and the carbon footprint of each of them. In this way, it was possible to identify periods with fewer emissions or high renewable generation periods, in which we performed the precooling phase, and periods with high emissions or low renewable generation periods, to perform the increase in the setpoint temperature. As a result, the objective of shifting 15% of the demand to hours in which the electricity is produced by more renewable sources was achieved through a flexibility engine, which is in charge of performing the flexibility services, while maintaining an acceptable internal air temperature for the occupants. In particular, the expected consumption for the involved offices during the two hours of the experiment was 9.97 kWh, 24% of which (2.4 kWh) were shifted to the timeframe of the precooling phase, i.e., the period of high renewable production. The final energy consumption during the hours of the experiment was 7.99 kWh, hence it also obtained an energy saving of 1.98 kWh as a consequence of the trial. Also in this case, the evaluation of the thermal comfort during the trial was studied in Trial No4. An important result from both trials is that the internal air temperature, which decreased because of the precooling (or increased because of the preheating in winter), returned to its original value much later after the end of the experiment, hence it is possible to take advantage of the thermal inertia of the building. This means that the building occupants should not have felt too warm (or too cool in the winter period) at any moment. This result confirmed the positive effects that envelope quality can have on energy efficiency and energy flexibility potential in buildings [23]. In particular, through the combined effects of sufficient thermal mass and thermal insulation, it is possible to improve both the heat storage and heat saving of the building [24,25]. An appropriate building envelope can significantly improve the implementation of energy flexibility strategies, as it allows the use of the HVAC system to be shifted without compromising the adequacy of the thermal environment.
Trial No3 (DR strategy for energy saving) is related to the first trial. The DR events were the same; therefore, there are 6 weeks in total of data concerning demand response flexibility. In order to analyse energy savings in kWh, a predictive model based on Artificial Neural Networks (ANNs) [16,26] was created, which used the number of activated HVACs, setpoint and environmental conditions to estimate energy consumption. In order the ANN model to be trained and tested, baseline data consisting of past energy consumption measures and weather information, including air temperature, humidity and solar radiation, were used in order to create the inputs and the output of the model. Air temperature, humidity and solar radiation are variables that are commonly used in ANN models ensuring an improved quality of forecasts related to energy consumption in buildings [27][28][29]. The obtained accuracy on the test was of 92% Coefficient of Variation of the Root Mean Square Error (CVRMSE) in order to achieve 15% savings in energy consumption.
For Trial No4 (Occupants' feedback), users' feedback within the demand response strategy was collected. The goal was to estimate the acceptance of different users toward the strategy and also to verify that the occupants' thermal comfort was maintained during the experiments. The methodology was based on the distribution of two questionnaires: one was needed to create a baseline, i.e., to understand the general thermal preference of the occupants, and the other one was sent after each demand response event in order to test the reactions among the occupants. The questionnaires were created and distributed in English and in user-friendly language. The same questionnaire model used for the winter period was then slightly changed to be adapted to the summer season.
The thermal comfort is evaluated following the indication of the current regulations (ASHRAE [30] and ISO 7730 [31]). The method is widely used in the literature [32,33]. Occupants were asked: The general acceptance of the strategy was evaluated through ad hoc questions about expected thermal sensation during the experiment, eventual actions taken to restore the comfort, perceived level of productivity during the experiment and opinion about the precooling phase. The latter questions do not have references in the literature due to the novelty of the topic; therefore, they are the results of previous studies by the University of Murcia research group [34,35].
The results from Trial No4 in the summer period, are divided into the thermal comfort part and the acceptance of the flexibility strategy. In Table 6, the outputs concerning the occupants' thermal comfort are presented. To understand these outcomes, one should consider that during the demand response event, the set point temperature is raised, hence the risk is that the occupants should feel uncomfortably warm. To avoid that risk, a precooling phase is set before the actual demand response event. From the parameters of Table 6, it can be deduced that the risk of overheating is avoided. Instead, the mean TSV is −1.11 (comfortably cool) and some users indicated they would prefer to feel a bit warmer. To verify whether this sensation is due to the precooling phase, the answers to the corresponding question were analysed in Table 7. Out of nine respondents, four occupants declared they did not notice the precooling phase, two occupants stated the precooling phase was appropriate, one thought it was not needed, one that the room was too cool and one that the room was not cool enough. All the respondents considered that they did not need to take any action to restore their comfort. Overall, a good acceptance was shown through the experiment for the summer period. I do not think it will benecessary Next time, I will put on fresher garments I will take some cold drink/food 100% 0% 0% As a last step, the comfort votes collected through the questionnaire are then compared with the standard predicted values, using the Predicted Mean Vote (PMV) method of the Fanger's model [36], which complies with AHSRAE Standard 55-2020 [27]. From the questionnaire it was possible to deduce the occupants' average clothing level (0.5 clo) and the average metabolic rate (1.1 met), while the physical characteristics of the environment were collected through sensors for each day of the trial.
The mean PMV obtained through the assessment was 0.35, while the actual mean TSV of the occupant was −1.11. The mean Predicted Percentage of Dissatisfied (PPD) was 8%, i.e., 92% of occupants should be thermally comfortable according to the standard predictions, while according to the questionnaire the percentage of respondents with −1≤TSV≤1 is 78%. In this case, the model slightly underestimated the actual discomfort of the occupants, as confirmed by other studies in the literature [37,38].
Results from Trial No5 (Ventilation control) consisted of a series of events where overly high CO 2 levels activated a ventilation system. CO 2 levels are related to many variables, such as activity in the room, number of occupants, ventilation rates and many others that are less dynamic, such as space volume, plants and building construction. CO 2 levels can serve as a "proxy" for the number of viruses in the air [39]. It is well-known that good ventilation prevents the spread of viruses but continuous ventilation can result in the inefficient use of energy [40]. The control system used at the PoC pilot site premises is able to initiate ventilation when CO 2 levels are high and allows the balancing of the occupant comfort and energy-savings, helping to improve indoor air quality.
Trial No6 (Crowdsensing) consisted of the design of a mechanism where the room temperature is adjusted in a dynamic way in real-time, according to the past and current votes a person has provided with regards to their comfort. This continuous voting system for thermal feedback only takes into account the current occupant's past and current preferences, the latter having a greater influence. The acceptance of this real-time method is still under evaluation, where Cramer's V association test [41] is used to identify the strength of the association among vote types, and Spearman's q correlation test [42] is used to identify the direction of the association.
Based on these trials, the majority of KPIs were successfully demonstrated at the PoC pilot site, and Table 8 below presents the results.

KPIs Results
Improving the intelligence of buildings according to the Smart Readiness Index (SRI) The SRI score improved from 13% to 60% (+47%). Devices responsible for 80% of the energy consumption (HVAC) are connected Shifting load and demand from high tariff to low tariff periods (peak load reduction) Peak load reduction of 20% was achieved, as well as energy cost reduction of 18% The results from the trials offer important information about the services provided in the PoC pilot premises and are used to validate the implemented architecture through the achievement of the set goals. Through the implementation of these trials, valuable lessons are also learned about the process itself that can be considered as guidelines when replicating the solution in new buildings. The most important lessons learned from the PoC pilot site are listed below: • It is possible to reduce energy costs by load shifting. • Energy consumption prediction using ML methods can help to estimate the energy savings in an accurate way.

•
For the success of a demand response strategy, sending a day-ahead notification to the occupants would be useful. From a beta test, we noticed that users tend to interrupt the demand response event, either intentionally in order to achieve comfort regarding the expense of DR aims or accidentally. • When designing a DR strategy, the benefits of the thermal inertia of the building should be taken into account for optimised results • The time needed to fill the feedback questionnaire decreases after the first time: in our specific case, the average time needed to fill the questionnaire after the first demand response event was 227 s, while the average time after the second one was 121 s and after the third one was 81 s. We believe this information can encourage the occupants to keep sending feedback in user-centric experiments, such as Trial No3.

•
The precooling phase should be adapted to the thermal preferences of the occupants, as some users stated that they would have preferred a higher temperature. Maintaining the same ventilation rate-designed according to average room occupancy and area-is suboptimal due to recent changes in work habits, such as flexible work hours and work-from-home schedules. Therefore, a dynamic ventilation strategy based on CO 2 levels is more appropriate and helps on energy savings. • Thermal votes can be used to detect malfunctions and problems in the functional settings of devices in a very direct way.

Lessons Learned from Large-Scale Pilots
• As mentioned in previous sections, the implementation of PHOENIX architecture in the selected large-scale pilots is still in progress. However, the integration of the legacy equipment is completed at the four demonstration sites and a valuable list of lessons learned from this process has emerged. • As deployment planning, physical installation, communication configurations and the maintenance of IoT devices, gateways and peripheral devices (e.g., internet routers, etc.) are necessary actions to integrate legacy building equipment, multiple visits to pilot sites are required.

•
Manufactures' device information is not always available or trustworthy, so in situ hardware verification must be performed. To enable the connection with building devices (i.e., HVAC) via industrial legacy protocols, such as Modbus or Canbus, the knowledge of the configuration parameters is required in order to setup the IoT gateways that will communicate with legacy equipment. • Integration with legacy BMS and gateways can be difficult as they may not be fully open. Additionally, communication with hardware and software providers is essential, as many systems and service providers do not support interoperability. • Validation of wired connections and communication protocols of legacy appliances and systems is required. During the preparation phase, the technical team should verify the wired connections and protocols by using a laptop or similar device to ensure the compatibility and the technical information provided by the manufactures.

•
Proprietary solutions without open connectivity interfaces must be replaced by interoperable solutions. In some pilot cases, there is equipment (i.e., air-conditioning, ventilation, solar inverter) with closed protocols that can only be monitored and controlled using the software provided by the manufacture company. In those cases, smart meters can be used to monitor energy consumption and control the on/off operations, but if more operations are required (such as regulations or established set points in air-conditioning) it is better to replace the legacy appliances for open solutions. • Internet connectivity must be checked to avoid unexpected problems with local network configurations and firewalls. The technical support of building managers or owners that manage the internet connection is fundamental to opening internet ports and addresses in order to ensure the correct configuration of routers and firewalls of local networks.

•
In cases of installed renewable energy systems (such as photovoltaics) the predicted accuracy of electricity generation is of great importance for increasing self-consumption and optimizing energy use. Thus, the application of methodologies that can enhance the forecasting of renewable energy production using ML techniques, such as the "Hybrid Approach" [43], is quite important.

Conclusions
Increasing the energy efficiency of buildings and optimizing energy consumption will play a key role in the coming years to reduce GHG emissions. The control, activation and management of non-intelligent field devices is an essential part of the energy upgrading process as the majority of existing buildings are considered to be energy inefficient.
This paper proposed a new architecture for integrating legacy building systems into scalable energy management systems. The PHOENIX architecture consists of five horizontal layers that move from the unintelligent and uncontrollable legacy equipment of buildings to the overall energy management and interaction with the occupants, placing emphasis on maintaining or increasing their comfort and convenience. In addition to these five layers a vertical one is proposed for the security and privacy issues arising from the interoperable nature of this architecture.
The architecture was then implemented in five real pilot sites across Europe to measure the impact of the proposed solution. More than 400 legacy devices are now integrated and controlled in these pilots. The results from the trials performed so far show that by controlling and activating/deactivating the field devices, energy consumption savings of 15% have been achieved. Furthermore, according to occupants' feedback, it is stated that the actuations provided were mostly acceptable and no measures were necessary to restore their comfort.
The implementation of this architecture in most pilots is still in progress but some very interesting results and lessons learned are presented in this paper, validating both its accuracy and the necessity of managing and controlling legacy devices.