Developing energy flexibility in clusters of buildings: A critical analysis of barriers from planning to operation

This paper examines building energy flexibility at an aggregated level and addresses the main barriers and research gaps for the development of this resource across three design and development phases: market and policy, early planning and design, and operation. We review methodologies and tools and discuss barriers, challenges, and opportunities, incorporating policy, economic, technical, professional, and social perspectives. Although various legal and regulatory frameworks exist to foster the development of energy flexibility for small buildings, financing mechanisms are limited with a significant number of perceived risks undermining private investment. For the early planning and design phase, planners and designers lack appropriate tools and face interoperability challenges, which often results in insufficient consideration of demand response programs. The review of the operational phase highlighted the socio-technical challenges related to both the complexity of


Introduction
Decarbonization of the electricity grid and the electrification of transport, heat and industry are two of the primary means targeted at reducing greenhouse gas emissions to meet the international goal of limiting global warming to below 1.5 • C, as agreed in the Paris Agreement [1] and confirmed at the recent COP26 summit [2].Decarbonization of the energy grids through increased deployment of renewable energy sources requires measures such as active management of the power grids to balance energy supply and demand at all times.Buildings, which account for about 35 % of the global energy use [3], have a significant potential for the development of Demand Response (DR) strategies [4] using existing systems for energy flexibility.This flexibility is defined as the ability of a building to change its short-term (a few hours or a couple of days) energy demand and/or energy generation, according to weather conditions, user needs and energy network requirements, without jeopardizing the technical capabilities of the building or occupant comfort [5].Practical examples of flexible loads in buildings include storage heaters (space and water), heat pumps, air conditioners and circulation pumps [6,7].Interest in energy flexibility in buildings has significantly gained momentum in the last decade, partially driven by increased penetration of renewable energy systems, coupled with increases in energy prices, as well as renewed consumer focus on energy costs.
Energy flexibility from single buildings can be impracticable to harness due to small quantities available at the individual building level, as well as the existence of diverse small sources of flexibility and stochasticity in occupant behavior [8].Aggregation at scale is viewed as a solution to foster the development of flexibility as it creates critical mass providing larger quantities of flexible load and reduces uncertainty due to occupant behavior by increasing diversity, leading to greater attractiveness for TSOs/DSOs and utilities [9].Moreover, new opportunities may develop at district scale, e.g., sharing production systems [10,11], thereby reducing redundancy requirements and decreasing reliance on fossil fuel backup generation.In this article, we consider the development of energy flexibility related solutions in clusters of buildings, new or existing, and those with a community-based design.These clusters should aggregate multiple loads to reach a sufficient flexibility potential and are, therefore, composed of one or more buildings, co-located or located in a district, and connected to the same grid(s) (see Fig. 1).The flexibility may be managed by the building occupants (e.g., via a smart device), building energy managers (e.g., a municipality), a local entity (e.g., an energy community) or by an external party (e.g., an aggregator).
As highlighted by Li et al. [5], most research on energy flexibility has focused on the operational phase to evaluate the potential of flexibility or to develop control strategies.However, to the best of our knowledge, a research gap persists since there is no systematic review of barriers to the integration of flexibility in building groups or building clusters, from planning to operation.The importance of including flexibility in early planning and the replicability of solutions are key aspects for successful development and therefore the referred research gap is the focus of the current work.
Literature reviews to date on flexibility either focus on the building scale and quantification methodologies [12][13][14][15][16], or on the potential and use of energy flexibility [17][18][19][20].A small number of reviews [11,[21][22][23] have proposed a more comprehensive view of the challenges to the development of flexibility.D'Ettorre et al. [22] identified barriers and drivers to the development of demand response programs, both from an end-user and aggregator perspective.They mention the challenges related to the lack of market products suitable for small end users but did not evaluate opportunities from clusters of buildings.Li et al. [11] highlighted the need for technological, social, commercial, and regulatory development to enable the utilization of energy flexibility of buildings.The literature review performed by Vigna et al. [21] focuses on the district scale and analyses of various indicators, most of them being similar to the ones used at this building scale.However, there is little information on the methodology for the development of energy flexibility-related solutions.Sousa and Soares [23] conducted a systematic review of the literature on the benefits and barriers to flexibility, grouping them into different categories (market, financial, social, technological, and environmental) and highlighting the diversity of barriers and actors.The opportunities offered by the cluster/community scale were not analyzed.
Taking the existing literature into consideration, this work aims to address the identified research gap by providing a critical analysis of the barriers to the development of energy flexibility at a district scale, commencing at the market and policy design and continuing through to the operation phase.In the face of rising energy prices and ambitious decarbonization targets, there is a need to rapidly upscale the development of energy flexibility across multiple buildings, and accordingly community-based design is seen as an opportunity.In the current article, the key phases for the integration of energy flexibility are identified (see Fig. 2) and the various stakeholders involved are described.In section 2, market and policy design are discussed, as the development of projects is largely influenced by the legal and financial frameworks.In section 3, the early planning and design phases are addressed.In section 4, the operational challenges and lessons learned from pilot studies are analyzed.In section 5, the barriers and research needs for better integration of flexibility in the design of districts are discussed.The article closes with conclusions in section 6.
In order to provide a thorough analysis of energy flexibility in clusters of buildings, a review of the literature was undertaken.Fig. 3 (left) shows the available literature on the subject, divided into the different phases as outlined in Fig. 2. From this preliminary analysis, it can be observed that most of the existing literature focuses on the operation phase and market perspective.After an initial screening phase, a selection of journal and conference articles were reviewed on the topic of aggregated flexibility (keywords cluster, aggregate*, district, community, groups of buildings) and also individual building flexibility, as the literature is broader at this scale (see red line in Fig. 3).The key journals identified from this search were as follows: Energy and Buildings, Applied Energy, Energy and IEEE Series (Fig. 3, right).Additional documents such as research project reports, guidelines and legislation were also reviewed, as they provide complementary information on the development of flexibility (Fig. 3, right).The selection of documents was made to cover the current state-of-the-art and to capture challenges and opportunities.The review covers both the different phases (market and policy, early planning and design, and operation) and the different factors (economic, political, social, technological, and professional).

Market and policy designs to enable energy flexibility across multiple buildings
Several market and policy barriers must be addressed for the successful operation of energy flexibility across multiple, co-located buildings and realization and monetization of benefits.For example, regulatory barriers to increased activation of energy flexibility include a lack of clarity around decentralized energy trading and, specifically, what is permitted in each country [24], or arduous regulatory requirements [25].Additionally, participation of building loads in wholesale and retail markets, including in capacity markets, differs significantly depending on the electricity market rules, design, and jurisdiction.We identify market and policy designs, including specific legislative frameworks, that address key barriers and draw on examples from the European Union (EU), Australia and the United States of America (US) that have significant energy flexibility market activities.

Legislative and regulatory frameworks
There are several laws and regulations that enable energy flexibility across multiple buildings which reflect supranational, national, and local contexts.Broadly, legislative and regulatory frameworks define four key areas: 1) legislative and regulatory reforms, 2) Energy Communities (ECs), 3) enabling market participation, and 4) incorporating Distributed Energy Resources (DERs) in resource planning.
Firstly, legislative and regulatory reforms either empower existing bodies or create new institutions with the authority to remove barriers to energy flexibility.For example, Australia established an Energy Security Board to review and reform the National Electricity Market in light of the rapid changes to the power system, including increased variable renewable energy generation and distributed energy resources (particularly rooftop solar photovoltaic).Further options for increased energy flexibility, ECs or energy districts to provide flexibility services are expected to emerge through this ongoing reform process.In the EU, a comprehensive demand response aggregation framework is legislated for in the Electricity Directive (2019/944) [26], but to date it has only been implemented in two countries, France and Slovenia [27].
Secondly, the EC concept is either explicitly or implicitly defined depending on the jurisdiction.For example, the EU has two directives, one defining Renewable Energy Communities (RECs) in Directive (EU) 2018/2001 [28] and the second defining Citizen Energy Communities (CECs) in Directive (EU) 2019/944 [26].RECs and CECs are intended to empower communities to manage energy locally and provide flexibility through measures such as balancing supply and demand at the distribution level as well as creating critical mass for aggregating assets for specific demand response services.However, the EC directives are not yet fully transposed into national laws and Member States have discretion in how to create a framework that effectively leads to affordable and clean energy for citizens.A clear definition is required of what can be, and who can associate as REC or CEC at regional level, due to technical, geographic, cultural, economic and political circumstances in individual EU Member States [29].Additionally, Australia and the US lack explicit definitions at the national level, but several organizational frameworks can be leveraged to form an EC in practice including: a public company limited by shares; a cooperative; an incorporated association; or a trust [30].
Thirdly, a number of laws and regulations enable energy flexibility resources to participate in wholesale and retail electricity markets.A significant source of an EC's value to the electricity system is aggregating multiple building loads and flexible resources and providing multiple services (e.g., capacity, energy, and ancillary services).In the US, Federal Energy Regulatory Commission (FERC) Order 2222 (2020) mitigated many of the barriers to load aggregation and value-stacking by allowing DERs direct participation in wholesale electricity markets, including addressing certain physical and operational characteristics of DER aggregation, as well as allowing participation in multiple wholesale and retail electricity market products [31].Australia recently established a Wholesale Demand Response Mechanism that is lowering the barriers for businesses to procure smaller-scale demand response from customers [32].Participation of aggregators is also set out in EU Fig. 1.Types of demand-response applications and scope.
Directive 2019/944.In retail electricity markets, more granular and time-differentiated pricing (e.g., time-of-use rates) that reflects the actual marginal costs of energy can enhance the customer value (e.g., bill savings) of shifting electricity demand.In the US, several states are authorizing retail electricity pricing with greater unbundling of electricity services and temporal differentiation [33].EU Directive 2019/ 944 [26] specifies the requirement to provide dynamic or real-time pricing (RTP) to retail customers with a smart meter.This is a key enabler for flexibility as it introduces the capability to link renewable generation surplus and shortfall, currently reflected in wholesale market prices only, with actual prices paid by consumers and thereby incentivize more flexible consumption patterns [34].
Finally, regulators are incorporating DERs in resource planning and more explicitly recognizing DER resilience and reliability benefits [35].This is particularly important for ECs that are an aggregated load and can be geo-targeted to minimize distribution network impacts.For example, energy flexibility aggregators can contract with distribution network service providers in Australia via the Demand Management Incentive Scheme to provide non-network alternatives to emerging constraints on the distribution network (e.g., thermal constraints or widening voltage envelopes).

Financing mechanisms
Demand response (DR) financing is currently and primarily based on income from incentive payments and cost savings via tariff structures [36].Other traditional financing mechanisms such as loans, government grants, investment and tax relief are limited, particularly in comparison with renewable generation financing.To activate and increase the deployment of flexibility, alternative approaches such as virtual net metering, transactive control and trading [37] (e.g., peer to peer P2P), flexibility tenders [38] and leveraging the collective power of ECs [39] may prove beneficial.
Economic barriers to financing of flexibility include appropriate value capture from small-scale prosumer flexibility and achieving scale at a sufficient level to make it attractive for both: i) prosumers to participate, and, ii) operators to set up the market [25].Value frameworks for flexibility at the distribution level are at an early stage but are starting to develop enabling mechanisms such as flexibility tenders in Ireland [38].However, due to the emerging nature of flexibility trading at the distribution level, the value of services is still unclear [40] which limits financing options.Lack of access to capital to finance upfront costs was also identified as an economic barrier in Australia [25].In coupling electricity and district heating networks for flexibility, uncertainty regarding the economic benefits of increased flexibility, lack of financial instruments and high capital costs due to perceived risk [41] were identified as barriers.
Flexibility in ECs is considered in conjunction with renewable generation from a technical and market level [39], but financing mechanisms specifically for flexibility are unclear.Energy flexibility in ECs within the European Union has the potential to provide additional revenue streams, for example, through the provision of demand-side services to utilities, or arbitrage [29], which may add to the value proposition for ECs.Financing recommendations for ECs (which may also apply to flexibility in ECs) include grants, low interest loans, feed-in tariffs with minimum purchasing price, as well as investment and tax relief [42].Fig. 3. Overview of the reviewed literature.Left: All available literature 1 (black lines) and selected relevant literature (red line) included in the review.Right: Sources of literature reviewed, e.g., journal names, reports, conference publications.(For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.) 1 (Scopus search with the following keywords ("energy flexibility" OR "demand response") AND building* OR cluster OR aggregate* OR district OR community) and specific searches conducted by adding (market OR policy OR early-design OR design OR operation OR field OR experiment OR demonstration).)J. Le Dréau et al.

Barriers around trading of energy flexibility
Flexibility trading at the wholesale level, like wholesale energy markets, may be financially viable for aggregators and large industries [43].However, for residential and small commercial participants, P2P blockchain-based approaches are emerging as a possible solution in smaller scale applications [37,44].Trading of energy flexibility using blockchain-based technologies to enable decentralized trading by small prosumers is being developed in Italy [24], while P2P energy trading has been trialed in Australia [45] and successfully commercialized in Slovenia [46].
Barriers to trading of flexibility include: i) technological barriers such as low cost retrofit solutions to enable activation of small-scale flexibility [24]; ii) economic barriers, as detailed in the previous part; iii) regulatory, as addressed earlier; iv) organizational barriers around the size and flexibility capacity of the EC, for example insufficient numbers of participants, or scale of prosumer flexibility; v) motivation of citizens (e.g., to participate beyond financial rewards), awareness [25], ceding control of home-based devices to a third party and privacy concerns [24]; vi) distribution level barriers, and vii) barriers to market entry for demand response such as high MW participation thresholds (4 MW in Ireland), or frequent testing requirements in Poland with financial punitive consequences such as high penalties and potential loss of quarterly remuneration [27].
Despite these barriers, significant progress has been made both by P2P energy trading marketplaces and P2P energy flexibility marketplaces, likely to be deployed as a subset of the main P2P energy trading activity.For example, the Suncontract platform is fully operational in Slovenia and deployed in a number of ECs such as the renewable energy self-sufficient community of Zavrate [46].While the trials in Western Australia also experienced challenges with value capture, the technical feasibility of P2P energy trading was successfully demonstrated in the White Gum Valley trial involving 24 apartments [45].Extending energy trading to incorporate flexibility trading demonstrated benefits for grid decentralization, managing loads and near real time settlement of DR in an Italian pilot linked to a DSO [47].

Business models for aggregated flexibility
Business models for energy flexibility in clusters of buildings, districts and ECs may be based on legal forms such as cooperatives, charities, development trusts, partnerships, Energy Supply Companies (ESCOs), public utility companies, public-private partnerships, or a combination of these.For example, an ESCO may be contracted to manage and supply renewable energy to a cooperative.Additionally, microgrids have been demonstrated as successful case studies for ECs, which may include flexibility services.However, this is dependent on the regulatory structures in individual countries.
The business model canvas proposed in [48] makes a clear case for the value proposition for utilities and grid operators, but for other actors such as ESCOs or aggregators and consumers/householders the motivation for participation is less compelling.Nine elements of the business model were identified (see Fig. 4): flexibility product, flexibility market segment, service attributes, DR resources, resource availability, DR mechanism, communication channels, cost structures and revenue model.An example for electric vehicles is provided but it would be interesting to apply the business model canvas tool to more complex DR use cases such as multiple systems in households and commercial buildings.An acknowledgement of the environmental, social and sustainable benefits of DR is included, but there is scope for further exploration of community-based business models and valorization of the benefits for DR in ECs.Cardoso and Torriti [49] also found that one of the barriers for participation for businesses (i.e., non-domestic consumers) in the commercial and public sector was the lack of clarity around economic benefits and programs available.
An analysis of the economic viability of business models for aggregation of flexibility from residential and service customers found that the financial and operational aspects are linked [50].Strategies which may be deployed by aggregators to increase the economic feasibility of business models include: a) minimizing day ahead market cost; b) minimizing consumers electricity cost; c) minimizing imbalance costs; and d) arbitrage.However, the implementation of these is dependent on the market and regulatory conditions available in each country as well as the aggregator's ability to trade on wholesale electricity markets.
Microgrids have been successfully used for ECs such as the Scottish Island of Eigg for several years [51].In Australia, the microgrid model for ECs is gaining momentum through implementations such as the 'My Town Microgrid' [52] and feasibility studies.In addition, Energy-as-a-Service business models for microgrids may include flexibility services as part of the revenue generation streams [53].
From the review of policy and market perspectives, it can be observed that the legislative framework for flexibility is evolving fast, but the business models remain unclear due to the high uncertainty on future market perspectives.However, a few projects integrating energy flexibility in combination with Energy Communities, microgrids and P2P trading have emerged.

Integrating energy flexibility in early planning and design stages
When developing a construction or refurbishment project for a group of buildings or a district, the early planning stage is crucial for the integration of innovation.At this stage, the program and design options are discussed and refined.Designing a district for flexibility should ideally follow a methodological approach used for energy efficient buildings and include connectivity of the entities and systems (see Fig. 5), as well as the potential for district-scale shared energy systems (e.g., district thermal systems and community-scale energy generation/ storage) [54].Here, the goal is to employ a systemic approach that considers all aspects from passive design to load shifting across buildings.The reduction of energy demand is followed by the integration of efficient energy systems and renewable energy sources.In the last step, smartness 1 is crucial to ensure an optimization of not just the single entity, but of the overall system, and being able to operate buildings in a flexible manner.Key measures related to energy flexibility range from architectural measures (e.g., thermally activated building structures [55], thermal inertia [56], and enclosure insulation of buildings [12]), building and district energy systems (e.g., heat pumps, thermal and electrical storage) [57], integration of renewables and charging stations for electric vehicles, to the connection of the entire system [58,59].In cases of district refurbishment or upgrade, the methodology is similar except that a preliminary diagnostic phase is mandatory to identify the baseline conditions, barriers, and opportunities in the existing buildings and energy systems.
However, the design of energy flexible districts is often underrepresented or completely overlooked in the design stage due to a major focus on energy efficiency [60].Already at the building level, there are numerous challenges related to energy management as outlined in several publications [61,62].However aggregating energy management in blocks of buildings can increase the demand-response ability [63] and unlock a variety of potential value propositions associated with a multibuilding approach to energy management [64], including: CAPEX/ OPEX savings, ability to scale impact, community development, and investment in data infrastructure.

Stakeholders involved
At the district level in the early planning stages, four key stakeholder groups are typically identified: i) the urban planners, architects and engineers involved in the planning; ii) the developers, building owners, project financiers and future facility managers of the site; iii) the energy, utility, and infrastructure providers; and iv) the representatives of the municipality, local organizations, and building occupants or residents.At this early planning stage, it is of utmost importance that the different stakeholders work hand-in-hand to coordinate the design of the district.For example, the urban morphology should not only be defined by urban planners, but must be discussed with stakeholders ranging from energy utilities, developers and decision makers at the municipal level [65].Indeed, the urban morphology will greatly influence the energy demand of buildings [66], the possibility of sharing production or storage systems and thus the flexibility potential.The early planning stage is followed by the design stage, during which the design options are refined and the detailed design of solutions is carried out.Similarly to the early planning phase, a cooperative engagement from different disciplines is essential to transfer knowledge and perform in-depth analysis.Building energy modelers, HVAC specialists and control engineers are more actively involved in this second phase, to model the systems, define the technical constraints, develop the control framework, and analyze possible solutions to achieve flexibility activities under a common framework.
Closely engaging with people that make up the district/community and understanding their needs and desires is a key aspect of the planning phase.Building occupants and community residents will ultimately experience many of the potential benefits of a district-scale energy efficiency and demand flexibility project, such as reduced utility costs and improved comfort, control and resilience.Depending on the specific technologies and business models to be employed, the degree of engagement and participation of building occupants and community residents may directly impact the amount of energy savings and demand flexibility that is achieved.Thus, in the early planning phases, close engagement with the district occupants/residents can help ensure that approaches evaluated in subsequent design phases address community needs and desires and consider the degree of occupant engagement/ participation needed for success.
Whilst there is still limited information available on the needs of the Fig. 5. Methodology for energy and resource efficient planning at district level [54].
various stakeholder groups in this context, there is some literature on the perspective and challenges between stakeholders of the energy and buildings sectors.In a study based on a comparative interview analysis, the reduction of greenhouse gas (GHG) emissions was found to be a key shared concern, whilst challenges were identified related to: i) low flexibility in energy supply and use; ii) limited benefits; and iii) subsequent low levels of cooperation between the energy and buildings sectors [67].However, the benefits and impact of building-to-grid DR activities should be evaluated for each stakeholder to identify possible conflicts [68].This shows that the integration of all relevant stakeholders at an early planning stage is needed to provide, not only, an economically and technically sound system, but also a system that is widely accepted by the end users [68].

Existing early planning methodologies
In the early planning, a sound methodology and adequate key performance indicators (KPIs) can be highly relevant, as the framework conditions are already known and the design process is not yet completed, allowing a higher degree of freedom.A key objective at early-stage planning is to evaluate the high-level potential opportunities and strategies to include energy flexibility and to identify the potential measures and available technologies.Pless et al. [69] provide guidance to practitioners for the energy master planning of high performance districts and communities, including: fostering support and assembling a team; developing financial and business models; engaging utilities, planning for energy demand and efficiency; assessing renewable energy potential; and planning for grid-integration, energy storage, and electric vehicles.While Pless et al. [69] provide some general guidance regarding planning for energy flexibility and grid-interactivity, the authors note that "approaches and technologies for coordinated control at building and larger scales are emerging" and that district planners "may consider partnering with researchers, technology companies, utilities, etc. to pilot advanced technologies and approaches" for coordinated demand flexibility.
Especially when it comes to energy systems, where calculations and simulations are heavily relied upon, the initial master planning is often based on estimates and assumptions.At the building level, there exists already a wide range of indicators, from load prediction models that can be used at the early design phase [70] to support the quantification of energy flexibility in the building design phase [71].Potential assessments could also include a market model.However, this is not thought to be entirely future proof with changing markets and costs [72].In the US, quantitative methodologies have been tested to improve the design of grid-interactive buildings.One example is the GridOptimal(R) Buildings Initiative, which has "developed new metrics by which building features and operating characteristics that support more effective grid operation can be quantified" [73].These metrics have been utilized in the Grid Optimal Buildings LEED Pilot, encouraging that "building designers and operators evaluate the relationship between building energy use and load shape and the electricity grid that supplies the building and to enact strategies that optimize building peak load factor, energy timeof-use, demand flexibility and resilience capabilities" [74].Another example from the US is the ongoing development of the RESNET® Carbon Index for homes, which conceptually aims to use hourly emissions factors from NREL's Cambium database [75] allowing for the emissions reduction benefits of energy efficiency measures in homes to be valued, and creating a framework that could potentially be used to value demand flexibility measures in the future.
Qualitative methodologies can also be used at the early planning stage to evaluate the flexibility potential of a district.In Europe, the smart readiness indicator (SRI), as part of the EPBD (Energy Performance of Buildings Directive), has been proposed to evaluate the interaction of the buildings with the grid, the self-management possibilities and the interaction with the occupants [76,77].Within these framework conditions, the consideration and subsequent integration of energy flexibility increasingly becomes a prerequisite in early-stage planning.This also strongly supports the notion to view the single building within its wider context and broadening the systemic perspective of the building to the larger entity of the district to enhance the optimization potential.Some improvements of the SRI have been proposed to decrease the level of subjectivity in the evaluation process and include the district perspective [78].
There are many similarities in the methodologies applied in the early planning stages for existing districts and new districts.However, a key difference in the approaches is related to the assessment of existing buildings versus the assessment of framework conditions for new buildings.Using statistics, audits, building surveys and other datadriven analysis to assess flexibility can be a valid approach for existing buildings [79,80].In this context, however, a substantial amount of data (potentially individual, building-scale and aggregated) is required to reach a sound prediction model.For energy retrofitting at a district scale, there are also simple decision-making tools to support the process related to the integration of DSM and renewable energy systems measures [81].

Existing design methodologies
After the early planning phase, the detailed design of the buildings and systems is carried out.To harness and manage the energy flexibility potential of a cluster of buildings, architectural and mechanical design decisions that affect building performance and flexibility potential need to be evaluated [72].This typically requires the use of tools such as building information modeling (BIM) and building energy simulation (BES) software.Furthermore, enabling technologies and embedded control systems (ECS) that can aggregate building flexibility resources while accounting for cluster-level interaction have a significant impact on the flexibility potential in building districts [20,82].Building Automation Systems (BAS) also play a critical enabling technology for the provision of energy flexibility services, incorporating real-time monitoring, communication, analysis of data, and embedded controls [83].These four methodologies (BIM, BES, BAS, ECS) and associated tools are proposed as the cornerstone of a design-centered approach for harvesting the energy flexibility in building clusters.Different tasks can be supported in the design phase when considering energy flexibility, and correspondingly there are different methodologies and associated tools for this purpose (see Table 1).

Building Information Models (BIM)
Parametric design modeling is used to obtain insights into the potential for energy flexibility of single buildings while taking into account the district context, opportunities and constraints [84].Such approaches use exhaustive combinations of input parameters to analyze building thermal behavior, system performance and synergistic effects that may arise from the coordination of buildings operation.Dynamic energy simulation and parametric design modeling are being increasingly integrated into BIM tools to enable the evaluation of design alternatives, prevent model inconsistencies and costly implementation [85][86][87][88].BIM provides greater accuracy and improved estimates of energy flexibility potential as a digital central repository of a building whole lifecycle.Apart from streamlining building energy analysis, BIM can also be used along with geographic data, such as geographic information systems (GIS), for alignment of spatial planning strategies across a district, including but not limited to the design phase [89,90].Recent efforts have used spatial information from BIM during DSM operations [91][92][93].The focus in this scenario is on information integration enabling customized management of (shared) resources while maintaining local spatial requirements.

Building Energy Simulation software (BES)
Different BES tools are available, including white-box (physical models), grey-box (resistance-capacitance models) and black-box (data-driven models) [94].To date, white-box models are primarily used for design phase considerations, whilst the other approaches are still at a development or research phase and intended to be used for new methods, such as parametric design optimization or urban-scale modeling.Most BES (white-box) tools were originally designed to determine the energy demand, the heating/cooling loads and the thermal comfort within an individual building (e.g., EnergyPlus, IDA-ICE, TRNSYS, ESP-r, IES VE).Due to the transition to a clean energy system, BES is increasingly being used to analyze more complex energy flows within buildings.To predict energy flexibility, load management is necessary and BES enables complex load calculations for this purpose.The aim of load management can vary, including optimizing selfconsumption, reducing energy costs or responding to grid signals for demand reduction [95].Depending on the BES, a dynamic signal such as day-ahead prices and GHG emission data can be implemented via external tools to optimize the building/district operation.The management of complex building HVAC systems is typically done by cosimulation, which requires the integration of different BES tools for design-based analysis [96].
Unlike the energy flexibility at a single level, collaborative operation decisions are essential to creating an effective design for each building in district-level flexibility [97], such that a comprehensive modeling approach is required.A local energy manager or aggregator to manage the loads and the energy flows of a district is generally needed [98].To optimize the loads, the prediction of the future district demand formed by the choice of control strategies, the consumer/prosumer profiles and the energy storage potential is necessary [72].Therefore, tools such as CitySim, SimStadt, umi, CityBES, OpenIDEAS and URBANopt are becoming more widely used [99].To avoid the aforementioned modeling effort and long simulation times, a simplified simulation environment is often preferable [96].However, this may lead to a significant gap between the simulation results from the design phase and the field measurement data during the operational phase [100,101].
Specific tools have also been developed to assess building flexibility in district heating systems.Indeed, this type of system can take advantage of the additional flexibility from the network itself, which under certain conditions may not be possible for a fully electric district [102].A dedicated nodal hydraulic and thermal model has been developed by Cai et al. [103] to test different control strategies.Dominković et al. [104] used a commercial BES tool and archetypes to model the building dynamics.Hedegaard et al. [105,106] also focused on the representation of the building thermal load and applied Bayesian calibration of the RCmodel to better reproduce the district heating dynamics.In general, designing a district heating requires specific skills from the designers, which may prevent them from evaluating such a solution if not originally planned.

Building Automation Systems (BAS)
BAS are computer-based distributed systems that monitor and control building systems while facilitating the exchange of information between field, automation, and management layers [107].Among several functions dedicated to building energy management, BAS can be designed for energy flexibility purposes, responding to utility signals, performance requirements and occupant needs [108,109].Under fully automated DR applications, BAS receives external signals, often facilitated by the OpenADR standardized communication data model [110], which enables automatic triggering of DR control sequences without human intervention.The effectiveness of energy flexibility is circumscribed by BAS that activate the building responsiveness to a grid request.At a district level, BAS can facilitate information exchange for coordination of shared resources from multiple buildings.For instance, in Dadashi-Rad et al. [111], a BAS manages multi-energy resources to provide energy flexibility, including electrical energy storage, photovoltaic self-generation and appliance scheduling.In this study, however, interoperability (i.e., seamless data exchange) between the numerous BAS resources involved is not considered, which can lead to inconsistent and sparse data and hinder the appropriate flexibility exploitation.To address that, studies such as Li et al. [112], Esnaola-Gonzalez et al. [113], Santos et al. [114] and Koh et al. [115] propose semantic data models that support district energy applications by acting as mediators between heterogeneous data sources.As data availability increases in district energy environments, semantic representation is a potential promising method for assisting the management and control of numerous multi-domain data sources by BAS [116].

Embedded Control Systems (ECS)
To exploit energy flexibility in buildings, the use of lower-level embedded control systems within individual energy conversion or electrical energy systems is necessary.The control algorithms represent the practical means to implement a given control strategy, having therefore an indirect impact also on the system design.The control strategy, indeed, can influence the design by for example reducing the peak demand or altering the storage capabilities [12,117].
Different controller types are possible to activate the flexibility at a building/district level and they rely mainly on direct control strategies, such as rule-based controls (RBC) or predictive controls (e.g., model predictive control MPC).In the former case, the most common is a simple on/off control, while in the latter case, different types of models can be used, from physics-based methods up to reinforced learning methods [114].Indirect control strategies can also be implemented, relying on the response of end-users to an incentive or a penalty signal.When moving from the single user to multiple buildings, controls with a centralized coordination, distributed coordination or decentralized coordination (i.e., peer to peer) are the main options [118,119].Such

Table 1
Current methods, classified according to key tools (energy flexibility-related tasks are underlined).
controls are aimed at implementing active strategies addressed to manage HVAC systems, electric vehicles (EV), photovoltaics, electrical and thermal storage systems in order to optimize the energy flows at district level.
As an example, the building thermal mass can be activated by controlling the indoor temperature.Indoor temperature can be limited in a restricted comfort band [120] with/without daily schedule, as in traditional operation.However, heterogeneous and dynamic indoor conditions can be controlled depending upon renewable production [62].An operation strategy of periodic temperature setpoints can also be implemented to reduce aggregated loads [121].Furthermore, when energy flexibility strategies are applied at a district level, the control actions can be different among the buildings involved and dependent on the design specifications of their envelope and HVAC systems, as demonstrated by [122].EV charging scheduling can be controlled via applying game theory to reduce or shift the consumption in return of incentives [123].With a similar approach, the power demand of a district can be optimized using active cold storage systems [124].Moreover, trading strategies in a district should be considered in the design phase, leveraging existing and planned market and regulatory structures (as outlined in Section 2) enabling prosumers of the district to buy/sell energy among themselves with more favorable prices [125] or support grid stability [98,114].

KPIs used in the design phase
Key Performance Indicators (KPIs) quantitatively assess the performance of control strategies, and selecting an appropriate set of them is crucial to ensure that specific requirements are met for given applications [126].Several KPIs have been used to quantify energy flexibility [5].According to Pinto et al. [127,128], the KPIs particularly tailored for building design at a cluster level are based on: energy cost, energy consumption, peak, peak-to-average ratio (PAR), flexibility factor and self-sufficiency metrics.These studies also consider daily granularity for peak and PAR to assess the effects on the grid.The mathematical formulation and the related domain of such KPIs are summarized in Table 2.
Cost KPIs quantify the economic impact of control strategies using corresponding tariffs or a multi-purpose flexibility factor [128].The latter is an indicator that compares cost, energy consumption and emissions during high versus low load hours [5,10].The peak KPI represents the maximum peak over a given period [128].The peak can be also quantified, as both absolute and relative, by the reduced power demand during peak hours due to flexible operation [5,12].Mostly used as a design objective for utilities, the PAR metric is denoted by the average and peak load of the cluster [128].The flexibility factor quantifies the amount of imported off-peak energy consumption compared to total imported consumption during each tariff period [128].The selfsufficiency metric represents the degree to which the on-site generation can attend to the total energy consumption [5,128].This metric can also be extended to self-consumption, which characterizes the coincidence between locally produced electricity and building demand, measured daily [5] or during a DR action [129].
Although cluster-level KPIs cover important domains such as power, energy and costs, they overlook essential drivers for developing new controls such as energy efficiency, greenhouse gas emissions and occupant comfort.Other common KPIs in building science that address this gap are the capacity of DR [5,12,[129][130][131][132], efficiency of DR [5,12,130], flexibility index [5], rebound energy [130,132], flexibility interval [131] and thermal discomfort deviation [133].

Energy flexibility in operation phase
The evaluation of flexibility during the early planning and design stage is theoretical and does not guarantee the success of flexibility once implemented, due to factors that cannot be foreseen before implementation.The evaluation of flexibility during the operation phase is thus crucial to get feedback from the real world and improve its efficiency and acceptability.In this section, the scope is restricted to studies of existing energy districts performing DR.Studies that only include non-building energy end-users, such as electric vehicle charging stations, or those that do not assess energy flexibility are not included (see Fig. 1).
Energy flexibility in buildings is an emerging field in response to the needs for DSM, which were discovered from early pilot projects on DR.In the 2000′s, several pilot DR programs were carried out, lasting for typically one to two years using dynamic pricing and focusing on the effect on the grid-side [134][135][136].The objective of these programs was to change households' "normal consumption patterns in response to changes in the price of electricity over time, or to incentive payments designed to induce lower electricity use at times […] when system reliability is jeopardized" [134].In these pilots, electricity utility companies invited households to join their programs and relied on households to decide their electricity usage at home.Although these studies showed considerable potential, e.g., peak load reduction of 10-30 % [134][135][136], they also unveiled the complexity of energy use in buildings.This includes both the large variance in households' electricity use even in a homogeneous suburb (e.g., Auckland pilot project [136]) and their varied responses to DR programs.Here, we provide a review of recent demonstrations that exploited energy flexibility from energy districts, assess their practical implementation and discuss opportunities for further studies.In total, 18 field-studies were reviewed, most of them taking place in Europe (see Table 3 and Fig. 6, top).An overview of the characteristics of the pilots is given in the parallel categorical plot of Fig. 6 (lower diagram), where the color legend indicates the size of the pilots.The vertical bars represent different characteristics of the pilots, and the size of each bar indicates the number of pilots.The pilots mainly focused on flexibility in residential buildings (only a third of pilots included nonresidential buildings) and used relatively simple control architectures.The stakeholders, lessons learned and KPIs are reviewed in the following sections.

Stakeholders involved
The level of stakeholder involvement varied across the pilot studies, with some focusing only on end-users and others extending to the potential beneficiaries of flexibility (e.g., DSO, TSO, DHO).In the former case, the flexibility services can be used to meet local objectives, which include improving energy efficiency, meeting capacity constraints at the building level or improving the self-consumption from local solar generation.In the Netherlands, Klaasen et al. [143] demonstrated the use of automated control to improve energy efficiency of heat pump operation, while Bartusch et al. [139] used direct occupant engagement to reduce energy costs arising from time-of-use tariff rates.At the distribution grid level, these objectives can be broadened to manage congestion and resolve voltage issues in the power system.Other research [36,138,140,142,151,152] demonstrated the load reduction potential to mitigate the mentioned issues.Analogous to the power system, the main need of the district heating system is to reduce peak load, which could lead to network congestion and unfair heat distribution.In this regard, works described in [137,141,153,159] controlled multiple district heating substations to support system operation.At a broader level, the flexibility from many households or buildings can be aggregated for participation in electricity markets, e.g., on the day-ahead or imbalance markets, or for provision of ancillary services, e.g., primary, secondary, or tertiary frequency response.Kazmi et al. and Balint et al. [151,152] demonstrated reference tracking capability with a group of heat pumps indicating the potential as alternative reserve power resource, although it is not clear which service in the current market were targeted.Frequency regulation service was demonstrated in [137] by aggregating multiple resistive heating elements.Additionally, although the DSO was also mentioned as a potential beneficiary, the articles were not specific about which operational issues they can contribute to addressing.In all the aforementioned studies, households were involved by default as they provided the physical resources for flexibility.

Lessons learned from rolling-out on-site flexibility 4.2.1. Control strategies
To a large extent, studies reviewed found energy flexibility to be influenced by a multitude of exogenous (independent) factors e.g., ambient temperature and occupants' behavior, as well as endogenous factors e.g.control technique [151,152].Of all the factors, the type of control strategy was found to be the most significant [151,152].The control techniques used for operating and controlling the energy systems of the building in these pilot studies were either direct or indirect, with the majority being direct control.
For direct control strategies, two main approaches were used, namely: 1) devices were sent a signal directly specifying when and what amount of electricity [154] or district heat [150,159] to use; 2) an automatic DR signal was sent to devices, overriding their internal controllers, forcing them on [152] or off [144,146] for a limited amount of time.Of the 18 field studies analyzed, 14 pilots used simple RBC techniques for managing the use of single devices or clusters of heat pumps (HPs), electric heaters and other devices to provide flexibility in energy consumption (Fig. 6, lower diagram).While RBC mostly involves switching on/off the devices based upon set parameters, it does not offer much freedom to vary the device consumption.Kazmi et al. [151] have used data-driven control to manage the operation of air-source heat pumps and minimize their peak power demand while providing flexibility to the grid.One disadvantage of data-driven control methods is that they may be completely oblivious to the underlying physical model of the flexibility asset being controlled.They rely on input data to describe the system in the form of a black box transfer function, which is updated as more data is provided to the model.Guelpa et al. [150] used a genetic algorithm to anticipate thermal loads of a community of 104 buildings and optimize the use of district heat supplied to them, reducing the daily heat consumption and thermal energy demand of the buildings.
Indirect control strategies were also used in the field studies.For instance, in a multi-apartment building case study, penalty signals were used for peak-hour load shifting of radiant floor heating systems [149].The apartment owners were asked to define desired indoor room temperature set-points that the floor heating system must reach as closely as possible.As a peak hour approached, the local controllers reacted to the change of the penalty signals by lowering the set-point of the floor heating system, utilizing the thermal inertia of the building to maintain comfortable indoor temperature until the peak hour was passed [147,149].In some other publications, no control method was used as in the case of characterization of flexibility due to the introduction of dynamic tariffs [143], time-of-use tariffs [139] or price and volume tariffs [145].

Complexity effectiveness trade-off
Generally speaking, control techniques requiring a high number of sensors, high sampling times and high technical complexity can achieve better results.On the other hand, this can result in reduced applicability and high deployment costs, which may explain the relatively simple settings observed in field studies.The least complex setting to exploit users' flexibility is to rely on human responsiveness through variable tariffs [139,143,145].Introducing an automated response can increase the utilization of flexibility.Among automatic DR techniques, indirect control [147,149] and direct discrete control are the simplest approaches [141,152], in particular when thermo-electric devices are modeled without using temperature sensors [144,146].

Communication architecture
Communication protocols are determined by the existing systems in the buildings or districts, e.g., equipment embedded controllers, supervisory control, or automation systems.Most demonstration projects used Message Queuing Telemetry Transport (MQTT) as the protocol for bidirectional communication between physical resources and remote controllers.The key feature of MQTT is that it is lightweight and adopts a publish/subscribe paradigm.Additionally, it runs over TCP/IP with options to balance between the quality of communication service and the communication load.However, a recent study reports cyber-security concerns and shows that MQTT is susceptible to denial-of-service attacks [160].Alternatives such as OPC UA (Open Platform Communications Unified Architecture) offer similar features, but no reviewed studies have adopted the protocol in a large-scale demonstration case.Communication means at the building level are numerous, including BACnet, Modbus, Lonworks, dedicated APIs, and others not listed comprehensively here.

Temporal resolution
The time resolutions required are dependent on the services targeted.For example, peak shaving services (≥5 min [141,159]) are less demanding in terms of time resolution than power system frequency regulation services (where second or sub-second resolutions are required [137]).Most electrical smart meters installed by utilities achieve at best a 15-minutes sampling interval, meaning the flexibility provided with an interval less than 15 min cannot be validated by the utility directly and needs customized meters.Furthermore, increased temporal resolution leads to considerably higher communication or network costs.This increases the cost of the flexibility service.

KPIs used in experimental studies
The diversity of KPIs used to assess the energy flexibility and DR effectiveness at the design stage (see Table 2) reflects the lack of scientific consensus on that topic and the different objectives and interests that stakeholders might have in DSM.In the reviewed experimental studies, the majority only evaluated the power load/peak shaving and load shifting during the DR events (See Table 3 and Fig. 6).In some studies, additional KPIs were also calculated, such as the estimated energy storage level of the building.Specific KPIs focusing on a particular aspect of DSM and building-to-grid services are seldom computed, such as the peak power rebound after a DR event, the self-consumption of local renewable energy sources, the price responsiveness of households to price signals, or the voltage stabilization in a local electrical grid.
It was found that most of these DR effectiveness KPIs are based on a comparison between the power/energy usage time series of the buildings/cluster of buildings performing DR and a baseline or reference power/energy usage profile.In half of the reviewed pilot studies, this baseline energy profile is established from a reference case that is not performing DR.For the other studies, a data-driven approach is used to generate a baseline energy profile of the test building performing DR from historical monitoring data including, or not, DR events.Linear regression or averaging methods are usually employed to create these baseline scenarios.In some cases, the outdoor weather conditions are also integrated to estimate the baseline due to the strong correlation between the latter and the building energy demand [161].Data-driven baseline generation approaches for the operation phase and the continuous evaluation of energy flexibility is advantageous, when compared to other approaches (e.g., reference scenario obtained from a similar building where no DR measure is applied or through simulation), as it does not need any pre-existing model of the study case and the entire pool of flexible resources can be exploited.It can easily be used for different buildings with no or very limited prior knowledge on the physical characteristics of the building and behavior of its occupants.However, model-driven or data-driven strategies to build baselines must be used with caution in practice.Using the same model for optimization and determining the baseline may lead to a biased estimation of the benefits that accrue from the demand response program.This is of particular concern when the models do not fully capture the complexity of real-world operation or where the models' predictions are inaccurate in certain regions of the state-space (typically occurring due to insufficient exploration).While uncertainty-aware baseline models can be utilized to address this issue, this has typically not been done in reviewed case study literature.
Data collected to compute the result of KPIs can also be used to support the characterization of energy flexibility provided by the controlled buildings by using data-driven methodologies, such as the one developed during IEA EBC Annex 67 [162].This methodology assumes that buildings are able to use the available energy flexibility to react to certain modifications in imposed penalty signals (e.g., electricity price) in order to decrease the cumulative penalty over a period of time (e.g., electricity cost for a specific day).In this case, a dynamic flexibility function describes how the building or cluster of buildings react to the imposed penalty signal, receiving, as inputs, datasets of penalty signals and respective energy consumption variations.

Barriers
The challenges of enabling demand-side flexibility in buildings are numerous, including the needs for innovative business models, supportive legislation and regulations, and technological development, while operational evaluation of real performance is hampered by the lack of demonstration projects.Fig. 7 highlights the key barriers to this development which have been identified in this review, grouped into five categories (policy, economic, technical, professional, social) and linked to the development phases of an energy flexibility exploitation project (market and policy, early planning, design and operationsee sections 2, 3 and 4).We will review here some of the barriers.
In terms of policy, the main barriers are related to the legal and regulatory framework, the limited access to the wholesale electricity market, and the privacy and cybersecurity concerns.The legislative and regulatory framework has developed rapidly in recent years and the landscape will continue to evolve.However, the rapid pace of change has sometimes led to a lack of awareness on the part of customers.The development of energy flexibility is also often linked to the development of energy communities and DERs, which have been initiated differently in the three jurisdictions studied.Two types of Energy Communities (i.e., RECs and CECs) have been explicitly legislated for by the EU [29], but the members state implementation at local level differs and the design of effective supports for energy flexibility are not yet clear.Increasing participation in energy markets of energy flexible resources is more advanced in the US through measures, such as FERC, permitting DERs to participate in wholesale electricity markets [31].This, coupled with dynamic or real-time pricing at retail level, thereby reflecting actual renewable generation output, is a key enabler for flexibility in both the US (at state level) and the EU (through Directive 2019/944) [33,34].In Australia, an overall review of the electricity market is underway and further initiatives to increase energy flexibility are expected.Resource planning is starting to incorporate the energy flexibility capabilities of DERs, such as through Australia's Demand Management Incentive Scheme, and it would be beneficial if such initiatives were replicated in other jurisdictions.
In terms of economy, financing of DR is currently mainly from flexibility activation payments and tariff optimization, but additional approaches being developed include virtual net metering, flexibility tenders and leveraging the collective power of Energy Communities.However, significant economic barriers still exist, in particular the lack of clarity around value capture from multiple small sources of flexibility and specific financing mechanisms for flexibility within Energy Communities [64].The lack of a standardized building-to-grid assessment framework limits the ability of stakeholders and industry to quantify the value of flexibility.In terms of energy flexibility trading, P2P is emerging as a possible solution for small scale prosumers, and while trading barriers still exist (e.g., lack of low-cost retrofit solutions), it has been demonstrated successfully in Italy [24].Business models such as cooperatives, ESCOs or public-private partnerships have been most viable in a microgrid configuration to date.The business model canvas developed by Hamwai et al. [48] provides a starting point to valorize other approaches, but further work is needed on the value proposition motivating households and smaller participants in flexibility services.
In terms of technology and techniques, barriers exist at the technology and energy management levels.Cost-effective and reliable technologies should be developed to enable the activation of flexible assets.The communication of these flexible loads with the grid is also a cornerstone in the development of DR in buildings.A suite of technologies needs to work in harmony to control flexible loads, local generation or energy storage and create values for building owners and TSOs/ DSOs.A reliable and secure 2-way communication with a relatively high sampling rate is usually required and any failure in the chain of control or actuation may result in loss of signal transmission.Such issues may arise from databases, hardware, and technologies beyond building levels.Communication failure in operational projects can occur more frequently than planned in a design stage [36].Interoperability and standardization should help improve the reliability, but the robustness of solutions to communication failure should be tested.At the energy management level, the low diffusion of BAS and the lack of standards and seamless cross-domain data exchange solutions represent some of the main barriers for the implementation of energy flexibility services [163,164].During the design phase, the data exchange between the cross-domain applications required to perform these processes also suffers from interoperability and standardization challenges [112,165].Studies on semantic web technologies have made progress on this topic [166][167][168].However, there is a lack of application of these studies dedicated to energy flexibility with standardized and replicable workflows.
Barriers to the integration of flexibility were also identified for professionals during the design stage.The development of quantitative and qualitative methodologies (such as SRI and the Grid Optimal Buildings LEED pilot credit) should be pursued in the early planning stages to assess the flexibility potential of projects with low levels of information.At the design stage, BES is often limited in its ability to incorporate flexibility and load management strategies.For a district, several singlebuilding models must be connected and coordinated, a feature which is not currently part of commercially available BES modeling software.Therefore, modeling flexibility in single buildings and districts with BES often requires development of external algorithms, co-simulation, preand post-processing.Together the co-simulation environment, complex energy system modeling and prediction horizon might cause time consuming model set-up, numerical problems, and long simulation time regarding its complexity.There is therefore a need for further development of district level modeling tools capable of testing control strategies for building clusters.In terms of stakeholders, there is a very limited cooperation between the building and the energy sectors, with the two working in silos.The energy infrastructure and building development are considered separately based on differing industry practices, stakeholders, project timelines, and regulatory frameworks within each sector.Overcoming this barrier will require improved collaboration between sectors to better consider their interrelated impacts and optimize solutions at the interface between buildings and the grid.This will require the energy sector to be more present at the local level to enable collaborative decision making.
In terms of social barriers, limited end-user knowledge of flexibility is one of the main limitations.End-users' knowledge of energy is often limited, which makes flexibility even more of a challenge.Energy Communities can be used as a common ground to promote discussion at local level and to raise citizens' awareness of the concept of flexibility.The environmental and societal benefits of energy flexibility should also be emphasized, and the design of DR-programmes should account for the diversity of end-users.More studies are also needed to evaluate the relevance of price-based DR-programs to decrease GHG emissions, as a mismatch can be observed in some countries [169].Moreover, there remain some privacy and security concerns for customers as cyberphysical devices and systems need to be integrated to enable smart management of homes and communities [170,171].Perceived consequences include potential leakage of personal information, losing control of devices and causing financial losses [170].Finally, the review performed highlights the lack of information from field studies, which should feed into research to develop new technologies and design appropriate strategies.The experience gained in previous pilot projects is usually not publicly available and a steep learning curve may be required to reproduce the studies.There is also a lack of follow-up projects partially or fully reusing the infrastructure developed during the pilots.Therefore, transferability of pilot study learnings needs to be improved.

Research gaps and future directions
Based on the barriers identified in the previous part, several research directions can be formulated for the different development phases (Fig. 8).In the following, we will develop some of these research directions and highlight possible solutions to overcome the barriers.However, we do not intend to be exhaustive, as various research directions can be formulated and this is an active field of research.
Assessing the role of building flexibility in long-term energy planning is seen as a key factor in encouraging investment.Energy planning and building planning have been and still are anchored in very different sectors and regional scales.To fill this gap, Thorvaldsen et al. [172] highlighted the long-term value of building flexibility and the potential impact on price structures in this context.In addition, Chantzis et al. [173] have shown that the policy and regulatory aspects have a strong influence on the long-term contribution of demand response to decarbonization targets in the building sector.Key research questions in this context relate to the regulatory framework and its impact on the rapid uptake of flexibility measures in future developments, as well as pricing structures related to the potential uptake of building energy storage and flexibility in existing and new buildings.
Data privacy and security is also one of the main concerns when implementing DR measures using the available energy flexibility.This barrier can be tackled not only by establishing a legal framework to reinforce privacy protection, such as the General Data Protection Regulation (GDPR) [174] in Europe or the California Consumer Privacy Act (CCPA) [175] in the U.S., but also by developing technical solutions that minimize, or completely avoid, the use of personal data or data related to consumption and building occupancy.Therefore, technical innovations that allow decentralized control without sharing private user data [124] and/or solutions that can rely on aggregated data [162], which increases the difficulty to obtain personal information [176], represent active areas of research.The co-design methodology within Energy Communities is also seen as a solution to overcome this problem [63].
Another barrier related to end-users is their acceptance and willingness to participate in DR programmes.Many technical studies ignore the social or economic aspects, although they are key to the success of flexibility [177].In the commercial and industrial sector, Lashmar et al. [178] conducted a literature review and interviewed end-users.They found out that DR participants were mainly motivated by financial benefits, but many were unaware of system and community benefits.They also identified newly reported barriers, such as the lack of trust between DR service providers and consumers, the resistance to change and the lack of interest in energy.In the residential sector, Naghiyev et al. [179] tested different user interface designs for automated washing appliances and highlighted that DR incentivization should focus on convenience rather than money.Equity is also an active area of research, in particular to assess the potential price risk for consumers who do not respond to price signals [180].Guo and Kontou [181] assessed the equity of EV purchase rebates across income groups and disadvantaged communities and highlighted the importance of income cap policies to improve equity.
To overcome the barrier of harnessing flexibility at scale, new strategies for coordinating and controlling of building clusters need to be developed and tested [11].As mentioned by Kaspar at al. [182], this manifests itself in both the implementation of effective control at both building and cluster level.However, this is an open problem from an algorithmic perspective.On the one hand, activating flexibility in a centralized manner requires access to consumer electricity demand data, which may impact privacy as mentioned above.Such an approach also suffers from potential issues with communication and introduces a single point of failure.While techniques such as federated learning and learning from encrypted data have recently been introduced to energy flexible assets by Balint et al. [183], it is unclear what privacy protection they actually offer and how they will be adopted by industry players.On the other hand, truly decentralized flexibility activation requires both system identification and state estimation by each node.This is not only financially challenging, but it also introduces the risk of overshoot, i.e., situations where too much flexibility is activated due to poorly constructed price signals.The fact that this overshoot may not be observable in real time further complicates the problem.
To ensure better coordination of buildings, the multi-agent Fig. 8. Summary of links between research gaps and phases.
framework has recently been developed in research for different types of control strategies (centralized, decentralized or distributed).Cai et al. [184] exploited the flexibility from a cluster of buildings to alleviate network congestion issues in district heating systems by means of a coordinator to ensure that the collective response does not adversely impact the system.The method is capable of auto-correction with realtime demand and weather data, allowing optimization with a rolling horizon methodology to reduce the impact of prediction uncertainties.Pinto at al. [128] describes a multi-agent system for the management flexibility in building clusters at district level.Two multi-agent reinforcement learning methods are explored: a centralized (coordinated) controller and a decentralized (cooperative) controller, which are benchmarked against a rule-based controller.Zhang [185] describes a modular multi-agent framework platform, which was tested on a case study of 1,000 buildings, performing an analysis of the effects of small temperature deviations in buildings on the primary grid substation balancing problem.The results show the flexibility of the platform in testing different strategies.Nweye et al. [186] describe the CityLearn environment, an OpenAI Gym environment for the easy implementation of reinforcement learning agents in a demand response setting to reshape the aggregated curve of electricity demand by controlling the energy storage of a diverse set of buildings in a district.As seen in the previous examples, agent-based coordination has shown an interesting potential for harnessing flexibility at scale.However, it requires a stable and reliable two-way communication between the different agents and the sensitivity to network conditions should be evaluated [185].
The challenge of coordination and control becomes even more complex when considering multi-carrier energy systems, where optimizing energy flows between different energy sources adds to the complexity of the problem.Gholinejad et al. [187] present a hierarchical home energy management system for energy hubs based on multi-agent reinforcement learning to schedule the flexible loads, the storage systems and the CHP units.Srithapon [188] examined coordination approaches for multi-energy systems incorporating electricity and heating systems.Zheng et al. [189] describe a distributed multi-energy demand response method for the optimal coordinated operation of smart building clusters, which exploits a hierarchical building-aggregator framework.
Finally, in terms of dissemination based on open science principles, several initiatives can be highlighted.Among them, we can mention the publication of open datasets by different groups of researchers (e.g., three flexibility-related datasets made available in [190], 16 in [191], four in [192]).Better dissemination of project results can also be seen in more recent projects, such as the Connected Communities programme in the U.S. [193] or the Smart-Grid programme in France [194].

Conclusion
The literature review conducted in this work focused on building energy flexibility available at an aggregated level, which is the scale necessary to achieve sectoral and economy-wide decarbonization targets.Barriers were identified and grouped by development phase (market and policy, early planning and design, and operation) and by perspective (policy, economic, technical, professional, social).The following paragraphs present the main conclusions by development phase.
Due to limited market opportunities and high technology cost barriers, direct energy flexibility participation, especially to support power systems operation through market mechanisms, has been typically reserved for large consumers or for a few jurisdictions where small consumers can participate through an aggregator.However, the literature review supports the introduction of EC-related concepts in different parts of the world as a means to enable residential and small commercial buildings to participate in DR measures to achieve individual and community-level objectives.Nevertheless, clear regulations must be published in a timely manner to create and enable market opportunities for these communities.It is also important to note that flexibility is not usually included in district financing schemes due to the lack of certainty in revenues and program availability.This perceived risk in the private financial sector is one of the main barriers limiting investment and may be overcome in the short term with public sector grants and incentives.The literature also shows that business models for energy flexibility related solutions are relatively clear for utilities and grid operators, but less appealing for other actors, in particular for consumers/householders where the cost of enabling technology is still relatively high and the value proposition is not fully clear.
When developing a new program or refurbishment in a cluster of buildings, the early planning and design stage is crucial in driving key decisions, but little attention is paid to flexibility.For planners, connecting different energy users is still not typically considered at an early stage.Also, at an early planning stage and especially at a higher spatial level above the building (district, neighborhood, city), the information on the associated building dynamics of the demand-side is limited.Thus, currently mainly qualitative indicators, such as the SRI (Smart Readiness Indicator) prevail.Additionally, the literature shows that the evaluation of flexibility at district scale generally continues to be performed with building simulation tools and that the development of simulation environments which enable seamless connectivity at building and district scale are necessary to facilitate automation of buildings and support the use of existing energy flexibility.
Regarding the studies focusing on the operation phase, the literature shows that the targeted DR service is usually not clearly identified in field-studies.The complexity of deployment and the communication burden greatly influence the choice of controller and the type of DR services.More than half of the reviewed studies employed simple RBC techniques, most likely due to the simplicity of deployment.Moreover, the baseline estimation remains a challenge in the operation phase due to the difficulty to evaluate the uncertainty from prediction.Finally, there is a lack of detailed information on pilot studies (data, research articles), which would help transferring the knowledge and foster the development of flexibility solutions.
In conclusion, the development of energy flexibility in buildings is a complex socio-economic-technical challenge requiring engagement across different stakeholders and reflecting the multidisciplinary aspect of this field.A closer cooperation between the grid-side (e.g., TSOs/ DSOs, utilities) and the demand-side (e.g., end-users, architects, planners, building owners, ESCOs) is necessary to overcome the complexity of designing for flexibility and offering successful market solutions.In particular, tools and new methods should be developed to promote flexibility at the early planning phase, when critical design decisions are made.More pilot studies are also needed to test and act as the catalyst for novel demand-side flexibility solutions.Finally, cross-sectoral synergies (e.g., buildings and transportation/mobility, buildings and power) should be considered in future work to expand flexibility market perspectives.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Fig. 2 .
Fig. 2. Overview of the article structure and research questions (numbers indicate the respective sections of this article).

Fig. 7 .
Fig. 7. Overview of barriers to the development of energy flexibility in building clusters (abbreviations: M&P market and policy, EP early-planning, D design, O operation).

Table 3
Summary of reviewed experimental studies.