Framework to Facilitate Electricity and Flexibility Trading within, to, and from Local Markets

Peer-to-peer (P2P) electricity sharing or trading can empower consumers and prosumers, incentivize the balancing of generation and demand locally, increase system resilience and reliability, and help in achieving societal goals, such as increasing renewable energy penetration. Nevertheless, the development of P2P trading in actual environments has been slow due to the unclear position of P2P markets in the power system. Recent developments in the European legislation are promising for the establishment of P2P markets and energy communities. Hence, the interplay between local trading and existing market structures needs to be addressed carefully. Furthermore, P2P trading with distributed resources presumes that electricity end users will become active players in the power system. This paper proposes a bidding and pricing mechanism for local markets, considering the external markets; a new approach to balance settlement and balance responsibility when local trading occurs; and an interface to promote end-user interest in, and interactions with, local energy trading. The proposed local market concept and interface solution promote the coupling between local and existing retail, wholesale and ancillary service markets, and can be seen as a step towards the establishment of local energy markets in real-life settings.


Introduction
The twin challenges of environmental pollution and climate change have made it imperative to radically and urgently revolutionize the global usage of electricity production, distribution, and consumption. As a result, there has been a significant focus on the development and utilization of clean, sustainable, and renewable energy sources (RES) and technologies, such as photovoltaic (PV) panels and wind turbines. RES, such as PV panels, are distributed energy resources (DERs) that can be installed locally in residential houses. They have been investigated from various perspectives (e.g., [1][2][3][4][5][6]) because such locally installed DERs can supplement centralized RES production and accelerate the transition to 100% RES-based electrification. In most local grid designs, customers who install DERs to produce their own electricity, called prosumers, self-consume most of the self-produced electricity, and then either waste any excess electricity or sell it with relatively low compensation to their electricity supplier. However, an alternative mechanism has in the US forbids P2P trading in the public distribution grid, beyond the microgrid. In April 2019, a P2P pilot was set up by researchers from UCL, London, and Universidad EIA in Medellin, Colombia in cooperation with the utility company Empresas Públicas de Medellin (EPM), and the rooftop PV installation company ERCO Energía [21]. This project, called the Transactive Energy Colombia Initiative, groups 14 residential users who are all independently connected to EPM's distribution network. Additionally, a combined solar and storage solution was installed in a community center to support the production.
While these pilot programs show promise toward full and practical installations, there are many gaps between theory, pilot programs, and concrete permanent installations on real electricity grids. These gaps exist for a variety of reasons. P2P trading entails a few unknown risks and uncertainties, e.g., the heaviness of negotiations and the efficiency of clearing mechanisms [15], which deter private enterprises, DSOs, local governing bodies, central governments, and other stakeholders from making investments in P2P trading as a business. Moreover, customer engagement and enthusiasm in trading programs are crucial for successful P2P exchanges, but customers are often ambivalent about participating because their interest in and knowledge of electricity issues generally tends to be low (see, e.g., [22]). Customers would participate if there were clear profits, but governments and energy sector companies remain hesitant because of the technical and economic complexities involved, even though it has been shown that it is effective for renewable energy proliferation [11,16,23,24]. In particular, gaps in the regulatory framework are a major issue [15,16]. In many countries, regulation simply does not allow P2P trading [16]. Furthermore, the legal requirements concerning billing, electricity labeling, and reporting may be applied to all parties who supply electricity, leading to high transaction costs for small market players [25].
Another important problem is that although numerous research and theoretical papers have been published, they do not always capture (or solve) the difficulties encountered in different electricity markets and grids across the world. For example, much of the previous research and piloting related to P2P trading has focused on isolated microgrids (e.g., [26,27]) or assumed that the P2P trading community is balanced by a single entity (e.g., utility) (e.g., [28][29][30]). These starting points differ substantially from the reality that most European electricity users are seeing, i.e., interconnected electricity markets and free choice of suppliers so that even neighboring end users are supplied by different retailers. For example, Sousa et al. [15] conclude their comprehensive review of P2P markets by stating that future research should promote coupling between P2P markets and the existing wholesale and retail markets. A recent study [31] has contributed towards this gap by proposing a framework to integrate prosumer communities to wholesale electricity markets. Naturally, the local flexibility may be used within the P2P community for local supply demand balancing and peak demand reduction [32]. However, the opportunity to sell flexibility (i.e., demand response or flexible generation to maintain system balance or to reduce congestion) for external stakeholders has gained less attention than energy trading, although the new market platforms could also be used for offering flexibility for other stakeholders' needs, thus providing additional revenue. Regardless of the traded product (energy or flexibility), trading with distributed resources challenges the current balance responsibility and balance settlement arrangements, which is not addressed adequately in the literature or in the pilots.
In this paper, we address these gaps by making the following contributions: (1) We add to the literature on the coupling between P2P and higher-level markets and propose an energy and flexibility bidding and pricing mechanism for local markets, taking into account the external energy and flexibility markets; (2) We propose a new approach to balance settlement and balance responsibility taking into account the local trading; and, (3) We propose an interface to promote end-user interest in and interactions with local energy trading. Our proposed solutions are based on the work done in the H2020 project DOMINOES that aims to set up a local market architecture compatible with the current market structures, in order to enable the integration of the distributed and centralized markets. From our experience with DOMINOES, we believe that our contributions fill in the above-mentioned gaps between theory and practice in three important ways that are especially relevant to the implementation of P2P trading in open competitive electricity markets. First, the proposed energy and flexibility trading mechanism makes it easier for DSOs, retailers, and other relevant stakeholders to adopt the P2P paradigm and acquire flexibility for their own needs also. Second, the proposed balance settlement approach can be a key enabler for P2P trading specifically in open markets, such as the European market. Third, the customer-centric user interfaces motivate and encourage the most important stakeholderconsumers-to actively participate in the P2P trading.
However, none of this is possible without regulatory approval from market authorities. Since an enabling regulatory and legislative framework is a key prerequisite for P2P trading and the utilization of distributed resources, the next section-Section 2-will review the regulatory development in two European countries, Portugal and Finland, which are involved in the DOMINOES project as test cases. Portugal and Finland are southern and northern European countries with interesting similarities and differences in their markets and regulations. Their case analysis offers a fresh perspective on typical European market scenarios, regulations, and consequent barriers and opportunities. Section 3 presents the bidding, pricing, and balance settlement mechanisms and user interface solutions proposed in the DOMINOES project. Finally, Section 4 discusses and concludes the paper.

Regulatory Development
As mentioned in the introduction, gaps in the regulatory framework form a significant barrier for the development of P2P markets. In Europe, the Clean Energy for all Europeans legislative package [33] and especially the Recast Electricity Market Directive 2019/944 (EMD) [34] and the Renewable Energy Directive 2018/2001 (RED II) [35] provide some relevant aspects for P2P trading and energy communities.
RED II defines the peer-to-peer trading of renewable energy as the "the sale of renewable energy between market participants by means of a contract with pre-determined conditions governing the automated execution and settlement of the transaction, either directly between market participants or indirectly through a certified third-party market participant, such as an aggregator." Furthermore, the right to conduct P2P trading shall be "without prejudice to the rights and obligations of the parties involved as final customers, producers, suppliers or aggregators." Apart from the definition, P2P is addressed only in Article 21 concerning renewables self-consumers and their right to sell their excess production through P2P trading arrangements.
The EU legislation acknowledges two types of energy communities, i.e., a renewable energy community (REC) defined in RED II and a citizen energy community (CEC) defined in EMD. Both types of communities are legal entities based on open and voluntary participation and have, as their primary purpose, to provide environmental, economic, or social community benefits for their shareholders or members or for the local areas where they operate, rather than to generate financial profits. Furthermore, they are effectively controlled by members or shareholders, which are natural persons, local authorities, including municipalities, or small-(CECs and RECs) or medium-sized enterprises (RECs). REC members or shareholders must additionally be located in the proximity of the renewable energy projects that are owned and developed by that legal entity. Thus, although both concepts are aligned in relation to their noncommercial purpose and open membership, RECs can be considered a subset of CECs, due to more restrictive aspects of geographic proximity, democratic governance, and eligible participants [36].
The member states must ensure that energy communities are able to access all suitable energy markets (RECs) or electricity markets (CECs), either directly or through aggregation in a nondiscriminatory manner, and that they are entitled to share the renewable energy or Energies 2021, 14, 3229 5 of 20 electricity produced by the production units owned by the community, while community members maintain their rights and obligations as customers. The EU member states should transpose the requirements concerning CECs into national legislation by the end of 2020 and the requirements concerning RECs by the end of June 2021.
While the main focus of P2P and energy communities is typically on energy trading or sharing, the platforms (or other arrangements) facilitating them could also be used as a tool to aggregate flexibility for other stakeholders' needs. At the moment, the resources providing ancillary services for the transmission system operators (TSOs) vary widely, even within Europe [37]. However, transposition of EMD should facilitate market access of demand response and aggregators, as it requires the member states to ensure that TSOs and DSOs treat demand response aggregators in a nondiscriminatory manner alongside producers when procuring ancillary services.
Furthermore, EMD addresses balance responsibility of the new stakeholders, stating that CECs, aggregators, and active customers shall be "financially responsible for the imbalances they cause in the electricity system" and "to that extent they shall be balance responsible parties or shall delegate their balancing responsibility." Arrangements concerning balance responsibility are not defined. Thus, Section 3.2 of this paper proposes novel solutions for this.

Portugal
The Clean Energy for All Europeans legislative package [33] essentially represents policy guidelines that inform the transposition of restrictive national legal frameworks of the EU member states, such as the case of Portugal, which only recently introduced an enabling national regulatory framework (i.e., Decree-Law No. 162/2019 [38]) for RECs and collective self-consumption. This represents an important governmental milestone to reach a 47% share of renewables in the gross final energy consumption by 2030 [38]. Portugal decided to take a step-by-step, partial transposition of the referred EU RED II into a national regulatory framework for the facilitation and experimentation of collective self-consumption schemes and REC initiatives by the end of 2020 [38]. This approach will allow the executive governmental agencies responsible for regulating these activities to further develop the national regulatory framework in view of the best practices learned from the field [38].
The referred to Decree-Law [38] removed unjustified legal obstacles and established necessary conditions that allow either RECs and consumers organized in (individual or collective) self-consumption schemes to produce, consume, store, share, and sell their renewable generation without being faced with disproportionate charges, with the primary aim of promoting environmental, economic, or social benefits rather than commercial profit. While collective self-consumption schemes refer to groups of more than two prosumers in a geographic proximity that collectively own renewable generation units for self-consumption, RECs refer to legal, profit, or nonprofit entities that develop and own renewable energy projects, and whose members, partners, and shareholders are in geographic proximity [38]. The aspect of geographic proximity will be validated on a case-to-case basis by the Directorate General for Energy and Geology (DGEG), assuming the physical and geographic continuity of the renewable energy project and the respective prosumers or REC participants, and potentially taking into account other factors, such as the transformation station to which the renewable energy project is linked, the different voltage levels of the renewable energy project, and any other technical or regulatory aspect [38].
The referred to Decree-Law formulates the rights and duties of prosumers involved in individual or collective self-consumption, including, e.g., their responsibility for imbalances caused to the national energy grid, and their nondiscriminatory right to transact any surplus renewable generation through organized energy markets, bilateral contracting (including power purchase agreements), or peer-to-peer trading regimes [38]. The referred to Decree-Law also states that prosumers must approve an internal regulation that defines, at least, the access and exit requirements for new and existing members, respectively; Energies 2021, 14, 3229 6 of 20 the required deliberative majorities; the rules and respective coefficients for sharing the renewable production among prosumers; the rules for sharing the payment of tariffs; the commercial agreement to be adopted with the surplus renewable generation; and the application of the respective revenue [38]. Additionally, prosumers are obliged to appoint a duly qualified entity responsible for the operational management of the collective selfconsumption activities, who is responsible for the management of the internal network when it exists; articulation with DGEG; the connection with the distribution grid and articulation with the respective grid operator (namely in terms of sharing renewable generation and the respective coefficients); the commercial relationship to be adopted for the surplus generation; definition of the respective representative powers; among other responsibilities [38].
Furthermore, the referred to Decree-Law facilitated the installation of renewable generation units for either self-consumption or RECs, by not imposing a limit on the number of units that can be installed and by exempting them from prior communication, registration, exploitation certificate, and licensing, provided that the total installed capacity does not exceed 350 W. If the installed capacity ranges from 350 W to 30 kW, only prior communication is required. From 30 kW to 1 MW, prior registration and exploitation certificates are necessary. Above that, licensing is also mandatory [38].
In terms of rights, duties, monitoring of renewable generation, and commercial relationship of RECs, the same rules of collective self-consumption apply with the appropriate adaptations [38]. Illustratively, RECs have the power to produce, consume, store, and sell renewable energy through power purchase agreements; share their renewable generation within their members; and participate in all suitable energy markets, both directly and through aggregation, in a nondiscriminatory manner. RECs are also fully responsible for imbalances caused to the national energy grid, being responsible for settling such imbalances or for delegating them to a market participant or its designated representative [38].
The referred to Decree-Law also makes clear that any natural or legal, public or private stakeholder can openly and voluntarily participate in RECs, putting emphasis on the roles of small-and medium-sized enterprises (SMEs), municipalities, and domestic customers in it [38]. As for the latter, the Decree-Law asserts that any domestic customers (including low-income or vulnerable customers) must not be subjected to unfair or discriminatory treatment that prevents them from becoming REC members [38].
The executive governmental agencies designated to closely oversee the development of the individual/collective self-consumption and REC activities are the Directorate General for Energy and Geology (DGEG), the Energy Sector Regulatory Authority (ERSE), and the government official for the energy sector [38]. Specifically, the DGEG is responsible for the compliance of most rights and duties defined in the Decree-Law; the approval of all initiatives on a case-by-case basis until December 2020; as well as the assessment of obstacles and opportunities for the publication of a report that will further promote and facilitate the development of RECs [38]. On the other hand, the ERSE is responsible for the definition of conditions and the feasibility assessment of local grid tariffs (i.e., the exemption/reduction of network access tariffs for collective self-consumption schemes and RECs, reflecting the reduced reliance on the distribution and transmission networks, as already studied in Klein et al. [39]) [38]. Finally, the government official for the energy sector is responsible for the feasibility assessment of a dedicated support scheme related to the total or partial exemption of costs related to energy policy, sustainability, and economic interest (CIEG), in case these costs do not bring disproportionate burden for the long-term financial sustainability of the national energy grid [38].
The design of the referred to Decree-Law took into account the feedback from the governing bodies of the Autonomous Region of the Azores and Madeira, the National Association of Portuguese Municipalities, the National Data Protection Commission, the Energy Services Regulatory Authority (ERSE), and energy sector stakeholders [38]. Then, it was published for public consultation on 25 October 2019 and enforced on 01 January  [38].
As explained by Hannoset et al. [40], Portugal was the EU member state that most literally transposed the EU RED II provisions as they are. On the other hand, Portugal still has not transposed the EMD provisions for the promotion of CECs. All in all, before the Clean Energy for All Europeans legislative package was put into effect, Portugal had only a handful of national initiatives that could be compared with present-day RECs and CECs, especially in relation to other EU member states, such as Germany or the Netherlands.
As an illustration, the Community S project represented the first demonstration project to have ever trialed the concept of peer-to-peer energy sharing under real market conditions and real-life settings in Portugal [39,41,42]. The project ran between 2016 and 2018, thus predating the introduction of Decree-Law No. 162/2019. It encompassed three different low-voltage renewable energy communities, where surplus solar energy from public buildings was equitably shared among participating households [39].
After the introduction of Decree-Law No. 162/2019, the conceptualization of different REC initiatives started gaining traction across the country (e.g., in the forms of neighborhoods, condominiums, private social security institutions, municipal buildings, and industrial complexes for collective self-consumption), and currently await the ruling of the DGEG and other competent authorities to gain their formal recognition as such. In conclusion, although Portugal has started taking the first steps to comply with the EU-wide provisions on energy communities, it still has a long way to reach full maturity in this topic.

Finland
In Finland, consumers living in detached houses have been able to install generation for their own use, but the regulatory gaps related to energy sharing have complicated investments in apartment buildings. The Finsolar pilot project [43], which took place in Finland in 2016-2019, aimed to improve the potential of solar generation in apartment buildings. The challenge addressed was that typically, photovoltaic generation installed to an apartment building provides electricity only for the common consumption of the building (e.g., ventilation, elevator, laundry room, lighting of the staircase and yard), as there has not been a feasible solution for sharing PV generation for apartments. As a result, the size of the installed PV systems has been modest, and the full potential of PV generation has not been achieved. From the customer's viewpoint, the challenge is that persons living in an apartment building do not have similar opportunities to become prosumers as those who are living in a detached house.
In order to share local generation among the apartments, the housing company should form an entity that is a single customer in the electricity markets and buys electricity for all the apartments. The costs can be shared within the housing company based on the submetering of electricity consumption in each apartment. In this kind of an approach, all the apartments benefit from the local generation, as the energy purchase costs are based on the net load, from which own generation is deducted. However, in this submetering approach, there are some economic, social, and legal challenges. Furthermore, installation of submeters poses a financial challenge. As apartments already have DSO-owned smart meters, there will be extra costs caused by purchase, installation, and operation of the required submeters. A social challenge is that all the apartments have to pay for investment costs, and there has to be a majority of the apartments for the investment before it can take place. Furthermore, the concern of legal challenge is related to the fact that electricity end-users would lose their right as customers in electricity markets, since they would not be able, e.g., to change their electricity supplier. Hence, such an approach would not be in line with the requirements of the EMD [34] regarding the citizen energy communities, in which it is stated that "participation in citizen energy community is open and voluntary," and "members do not lose their rights and obligations as household customers".
To overcome the above-described challenges, there was a need for a novel solution for sharing of the PV generation within a housing company. The solution to be developed was an IT service that allocates the shares of PV generation to the participants of the energy community, i.e., residents of the apartments. The local DSO is in charge of this service, as it owns the meters. PV generation is shared according to the following procedure: first, the common consumption of the building is deducted from the PV generation, and after that, the remaining part of the generation is deducted from the consumption of each resident based on their share of the PV system. If there is still an excess of PV generation after this, the residual is sold to the market. Calculations are performed based on hourly values, hour being the balancing period in the Nordic electricity markets.
The model was developed and tested by the permission of the national regulator, as such sharing of the local generation was not permitted by the Finnish legislation during the project. In addition to showing the feasibility of the proposed peer-to-peer sharing methodology, various barriers were detected during the piloting. First, the regulation did not recognize the concept of energy community. Hence, distribution fees and electricity taxes apply, even if electricity is distributed within an apartment building, if the use of electricity is measured by the DSO's meters in the apartments. Another legislative challenge is that using computational values in billing (i.e., measured consumption-share of local generation) is against the Directive 2014/32 on the harmonization of the laws of the Member States related to the making available on the market of measuring instruments [44], which states that "The reading of this (measurement instrument) display is the measurement result that serves as the basis for the price to pay." In addition to these legislative barriers, an organizational challenge is that there was no clear responsibility for the organization of the net metering service. The DSOs have to be involved in this process, as the measurement information is in their possession. However, as monopoly actors, they may not have incentives to develop and maintain such a service.
However, legislative barriers are being removed in the implementation of the EMD. In addition, a national datahub as a centralized storage for electricity market measurement data is under development. It would make it easier to combine the generation and consumption measurements of an energy community, as all the measurements would be accessible by a service provider, if the customer (i.e., a member of an energy community) allows such access.
In December 2020, Decree 66/2009 concerning balance settlement and measurement [45], was updated enabling an energy community within a property (i.e., as was tested in the Finsolar project). The updated decree introduced the concept of 'local energy community', which is mainly in line with the definition of the CEC, except for the additional requirement that the members or 'shareholders' must be located within the same property or a group of properties, and that they must be connected to the distribution network through the single connection point. Additionally, the energy generation or storage equipment of the community must be connected to the internal network of the property. Electricity production or discharge from a storage is shared within the community (or a group of end-users with similar locational restrictions) according to the allocation guidelines informed by the community. In practice, a community member's consumption used in billing and balance settlement is calculated as the sum of measured electricity consumption and the member's share of the community generation/discharge. While this change in the legislation has enabled energy communities within, e.g., apartment buildings, the framework for more distributed communities is still unclear.

Market Integration for P2P
Next, we will discuss some of the key design issues related to local markets based on work done in the H2020 project DOMINOES (2017-2021), which aims to develop and validate a local electricity market structure that enables local sharing and optimization of renewable resources in MV and LV grids, creates relevant and liquid flexibility for innovative distribution management, empowers prosumers, and promotes demand response service provision. In the DOMINOES local market model, consumers and prosumers trade with energy and offer flexibility for other stakeholders' (e.g., DSOs, TSOs, retailers) Energies 2021, 14, 3229 9 of 20 needs. The energy and flexibility are primarily traded within the local market, and if not used, they can be traded in existing open energy markets. Trading locally and beyond the local market is facilitated by an energy community service provider (ECSP), which establishes a platform enabling the participants to provide and manage the various local market services. The ECSP role may be adopted by various stakeholders including, e.g., retailers and aggregators. The local market concept is presented in Figure 1.
Next, we will discuss some of the key design issues related to local markets based on work done in the H2020 project DOMINOES (2017-2021), which aims to develop and validate a local electricity market structure that enables local sharing and optimization of renewable resources in MV and LV grids, creates relevant and liquid flexibility for innovative distribution management, empowers prosumers, and promotes demand response service provision. In the DOMINOES local market model, consumers and prosumers trade with energy and offer flexibility for other stakeholders' (e.g., DSOs, TSOs, retailers) needs. The energy and flexibility are primarily traded within the local market, and if not used, they can be traded in existing open energy markets. Trading locally and beyond the local market is facilitated by an energy community service provider (ECSP), which establishes a platform enabling the participants to provide and manage the various local market services. The ECSP role may be adopted by various stakeholders including, e.g., retailers and aggregators. The local market concept is presented in Figure 1. While local markets and P2P trading may lead to environmental benefits, DOMI-NOES local market concept does not explicitly consider, for example, carbon emissions and related policies as constraints affecting consumption and bidding decisions. For more information on these topics, see, e.g., [47][48][49][50]. Section 3.1 will focus on the market and pricing mechanisms in local markets. The regulatory framework was discussed in Section 2. As mentioned, the Recast Electricity Market Directive specifically requires that the new players such as CECs, aggregators, and active customers are responsible for the imbalances that they cause in the electricity system. Thus, Section 3.2 proposes a practical approach to balance settlement and balance responsibility, taking into account the local trading. Finally, as interest of prosumers and end-users is crucial for the formation of local markets, Section 3.3 designs an interface to promote end-user/prosumer interest in, and interactions with, local energy trading.

Bids and Pricing
A key element in determining the efficiency of allocation of the resources in a marketplace is the structures that enable the description of costs, value, and preferences, i.e., the bids. In addition, the methods used for compensation of the allocations play a significant role in the attractiveness of the market. This section describes the ways in which the bids could be described and priced, as well as the rationale behind different compensation methods. The following assumes that the central market model in place is the European target model with zonal pricing and redispatch for congestions within zones, in contrast to the centralized SCED (security constrained economic dispatch) and LMP (locational While local markets and P2P trading may lead to environmental benefits, DOMINOES local market concept does not explicitly consider, for example, carbon emissions and related policies as constraints affecting consumption and bidding decisions. For more information on these topics, see, e.g., [47][48][49][50]. Section 3.1 will focus on the market and pricing mechanisms in local markets. The regulatory framework was discussed in Section 2. As mentioned, the Recast Electricity Market Directive specifically requires that the new players such as CECs, aggregators, and active customers are responsible for the imbalances that they cause in the electricity system. Thus, Section 3.2 proposes a practical approach to balance settlement and balance responsibility, taking into account the local trading. Finally, as interest of prosumers and end-users is crucial for the formation of local markets, Section 3.3 designs an interface to promote end-user/prosumer interest in, and interactions with, local energy trading.

Bids and Pricing
A key element in determining the efficiency of allocation of the resources in a marketplace is the structures that enable the description of costs, value, and preferences, i.e., the bids. In addition, the methods used for compensation of the allocations play a significant role in the attractiveness of the market. This section describes the ways in which the bids could be described and priced, as well as the rationale behind different compensation methods. The following assumes that the central market model in place is the European target model with zonal pricing and redispatch for congestions within zones, in contrast to the centralized SCED (security constrained economic dispatch) and LMP (locational marginal pricing) markets (used, e.g., in the US) [51]. These assumptions motivate the introduction of multiple marketplaces as well as the distinction between energy and flexibility.

Bids and Allocation
In general, markets can be categorized in several ways, such as whether they are pool based, where the energy is allocated from a central pool in a timed interval, or if the market continuously facilitates the allocation of energy directly between peers (i.e., peer-to-peer) [15]. Another distinction can be made between whether the clearing is centrally coordinated or if allocation and compensation are distributed between the peers. Furthermore, the level of transparency affects the willingness and truthfulness of bidding. Usually, in energy markets, bids are sealed in order not to have to reveal internal cost functions, but in that case, the allocation might not be fully explainable when using more complex valuations. Different methods for allocation and compensation can then be devised for specific cases. These choices, as well as how bidding structures are defined, affect how well the bidders are incentivized to provide truthful valuations. In practice, combinations of the aforementioned market configurations can be used.
In a local setting, more detailed requirements for expressing preferences might arise. For example, end-customers may want to trade with their neighbors, or a network operator may want to procure flexibility from specific locations of the grid. Trading coefficients can be used to enable the specification of preferential trading partners [15,52]. Even more complex valuations can be expressed in generalized combinatorial auctions [53]. In a combinatorial auction, a bidding language can be used to "allow the expression of complex utility functions in a natural and concise way" [54]. Valuations in bidding languages can generally be defined in terms of complementarity and substitutability [55]. The complementarity of two items means that the perceived value of both combined is larger than, or equal to, the sum of the values of the items separately. Conversely, substitutable items are items of which the combined value is less than or equal to the value of the items separately. Furthermore, complex order types could be expressed as in the Nordic Power Exchange Nord Pool (where general bidding language is not used) for linking bids between time periods or to exclusive groups [56].
When a local market is included in connection with other markets, the most sensible timing placement would be before the wholesale markets. This affects the pricing of the bids by the bidders, as they also have to assess subsequent trading options. However, some bidders might value energy from the local market at a different cost, e.g., because of social preferences of local and "green" energy or, e.g., because of energy community incentives regarding network costs when locally sharing energy.

Compensation
After energy has been allocated to the bids, the method of compensation for traded energy has to be chosen. In pool-based energy markets, uniform pricing is an obvious choice, with the market clearing price resulting from the intersection of the merit order curves. The rationale for a uniform price includes the assumption that all the energy produced is identical, fairness can be established, and market participation incentivized, owing to the "best" possible price for all participants [57]. Furthermore, general economic reasons for the market participants, such as ease of hedging and forecasting, are motivating factors for a common price.
In uniform pricing, however, marginal generation sets the price, and price takers in the market cannot influence their compensation or costs. In addition, if more complex valuations are described, it might not be possible to define a single price without paradoxically accepted (or rejected) bids, where bids are accepted even if they are in-the-money based on their bid price [57,58]. Alternatively, accepted bids could be compensated based on their bid price. Pay-as-bid is used mainly in TSO balancing (flexibility) "markets" (in practical terms, procurement platforms). The pay-as-bid method is used for simplicity, explainability, and for the benefit of the procuring party (TSO or potentially DSO), which could, however, discourage its use [57]. Alternatively, a general Vickrey-Clarke-Groves (VCG) mechanism could be used, which, in theory, guarantees truthful bidding. In practice, however, the VCG suffers from limitations, such as potential for gaming by coalitions, issues with budget balance, as well as difficult tractability for bidders to choose prices and in terms of resolving compensations [59].
In case the cleared trades are allocated peer-to-peer, compensation could be reconciled by, e.g., taking the average price between the bids or the offer price. However, these solutions do not guarantee truthful bidding and thus do not, in general, lead to efficient outcomes.

Bids in DOMINOES
Within the DOMINOES market model, trading and settlement are carried out for each metering point separately. In addition, a distinction is made between energy and flexibility. This is done in order to provide the possibility to separately validate and take account of explicitly activated flexibility in an open market setting. In the simplest form, the bids include an identifier for the location of the resource, price and quantity, as well as its type (i.e., whether the bid is for energy or flexibility). Furthermore, more complex linking and preferences for selling and procuring flexibility were developed [60] based on combinatorial auctions.
The markets in the validation of the DOMINOES market model concept were set up as centrally cleared pools with separate markets for energy and explicit flexibility. For energy, pay-as-clear was chosen as the compensation method, while for flexibility, pay-as-bid was established for flexibility providers for congestion management. These choices were made to maintain conceptual compatibility with the linked wholesale markets, as well as for simplicity. In case complex valuations (e.g., to indicate preferred trading partners) are used, marginal prices are deduced from dual values of the energy balance constraints when formulated as a social welfare optimization problem. The proposed market model and implementations provide opportunities for the participants to get more value out of their resources through, e.g., local trading and network value. In addition, the local market can provide a way to influence the value creation process and provide transparency toward subsequent wholesale markets, where the resources would not otherwise directly participate. Figure 2, with simulated example bids for energy and explicit validatable flexibility (energy and flexibility bidded separately), illustrates how local market participants can trade energy at the local level and beyond, as well as how the pricing of bids affects the trading. The bids are offered first to a local market, and in case they are not accepted locally, they are then forwarded to the wholesale market. Due to this direct link to the higher-level market, there is no minimum size for the local market. Prosumers and consumers may freely choose their bidding strategies with an emphasis on prices or, e.g., local green generation according to their priorities. Thus, if a generator believes that there is a preference for local generation, it may offer it at a price higher than the expected wholesale market price. In the first figure, we can see how the intersection between the merit order lists of offers and demands is located at approximately 5.5 kWh with a price of approximately 0.06 EUR/kWh. The total energy traded (sold and procured combined) on the local market is thus around 11 kWh, while the rest of the energy is traded on the wholesale market (16 kWh). The shaded bids are flexibility bids, which are not accepted, because of their ask prices due to their higher perceived value. The flexibility could then be later offered for example to a local congestion management flexibility market or system-level reserve markets.

Balance Responsibility
This section introduces options to consider balance responsibility in the local market solutions. If the balance responsibility is not considered, the local market will disturb the energy market and cause negative side effects for other market participants, or the value

Balance Responsibility
This section introduces options to consider balance responsibility in the local market solutions. If the balance responsibility is not considered, the local market will disturb the energy market and cause negative side effects for other market participants, or the value of the local market will not be used to its full potential.
Imbalance settlement mechanisms settle the allocated volumes and final positions of the parties. Imbalance settlement determines the electricity deliveries between the parties operating in the electricity market. Imbalance settlement is based on a hierarchic imbalance settlement model and chains of open deliveries. Every party operating in the electricity markets must constantly take care of its power balance, meaning that the balances between consumption/sales and generation/procurement are equal. A party responsible for the imbalance is called a balance responsible party (BRP), and it identifies balance responsibility with the imbalance settlement responsible (ISR). According to [62], the ISR is responsible for the settlement of differences between the contracted quantities and the realized quantities of energy products for the BRPs in the market area.
Local market operation and flexibility will change the end-customer behavior, which will have an effect on the retailer and thus, BRP imbalance. End-customers' peer-to-peer trades, implicit demand response, and trading with other market parties will increase the imbalance risks for the BRP. If the one BRP is not responsible for the imbalance of all local market participants, the effects on other BRPs should be taken into account when setting up local market balance settlement mechanisms.
Developing a balance settlement process suitable for a local market should consider the basic principles of the balance settlement (the concept of balance responsibility and open supplier), the role of the distribution network (the local market does not operate behind one metering point), and rights of the customer to choose the retailer and withdraw from the energy community/local market. The definition of the balance settlement has a significant impact on the viability of the proposed market solution.

Balance Settlement Options
The challenge can be handled by extending the responsibilities to smaller balance responsible parties, providing mechanisms for independent aggregation, or enabling the concept of multiple retailers.
Extending the balance responsibility to new market participants would create more competition and new opportunities for market participation, but the actual balance settlement mechanisms would remain the same. A local market operator, aggregator, energy community, or even an end-customer could take over the role of the balance responsible party and maintain the balance and bear the consequences if it is not in balance. The smaller the BRP is, the more difficult the balancing is. Nowadays, the technical and financial requirements of the BRP are out of reach of small market participants. This solution would, however, be easiest to apply from the perspective of the prevailing market structures. Independent aggregation is, at the moment, a hot topic in the energy industry, and energy communities, peer-to-peer trades, and local markets could be considered one form of independent aggregation. Similar to the local market, independent aggregation also interferes with the traditional balance settlement process when energy or flexibility is traded outside the balancing responsibility chain. In some markets where the balancing effect is not significant, independent aggregation may already be allowed [63], and there are pilots in progress [64]. The aggregated energy/flexibility can be verified and its impact on the balance can be measured and calculated. For example, different methodologies and their suitability for the Baltic market are discussed in [65].
The independent aggregation model must also define how the harm and financial losses caused to the BRP by the control can be compensated for in a cost-correlated way. Compensation mechanisms should be verified by a neutral party like an ISR, and they need to include information to compare the planned consumption/generation and agreed trades. Compensation mechanisms amount to double the balance settlement.
One solution is to allow multiple retailers and thereby multiple BRPs for one endcustomer. This means that there would be separate retailers for, e.g., generation, EV charging, demand response (such as electric heating/cooling, air conditioning), and basic electricity consumption at one customer, or some of these according to the customer's wishes, and these retailers would be responsible for their own part of the balance settlement chain.
Verification of the supply/flexibility requires measurements (an additional register in the electricity meter or separate submeasurement), or some parts of the supply could be verified by improving the processing of the load curve, fixed deliveries, and proportional allocation. The concept of multiple retailers is discussed, e.g., in [66].

DOMINOES Balance Settlement Models
Based on [67], the solutions identified for implementing balance responsibility locally for the DOMINOES local market could be categorized into light and full local balance responsibility. Trades with the local market (LM) and the wholesale market (WM) are presented, and the balance responsibility relationships and provision of settlement information in these models are visualized in Figure 3.
on the balance can be measured and calculated. For example, different methodologies and their suitability for the Baltic market are discussed in [65]. The independent aggregation model must also define how the harm and financial losses caused to the BRP by the control can be compensated for in a cost-correlated way. Compensation mechanisms should be verified by a neutral party like an ISR, and they need to include information to compare the planned consumption/generation and agreed trades. Compensation mechanisms amount to double the balance settlement.
One solution is to allow multiple retailers and thereby multiple BRPs for one endcustomer. This means that there would be separate retailers for, e.g., generation, EV charging, demand response (such as electric heating/cooling, air conditioning), and basic electricity consumption at one customer, or some of these according to the customer's wishes, and these retailers would be responsible for their own part of the balance settlement chain.
Verification of the supply/flexibility requires measurements (an additional register in the electricity meter or separate submeasurement), or some parts of the supply could be verified by improving the processing of the load curve, fixed deliveries, and proportional allocation. The concept of multiple retailers is discussed, e.g., in [66].

DOMINOES Balance Settlement Models
Based on [67], the solutions identified for implementing balance responsibility locally for the DOMINOES local market could be categorized into light and full local balance responsibility. Trades with the local market (LM) and the wholesale market (WM) are presented, and the balance responsibility relationships and provision of settlement information in these models are visualized in Figure 3.  [67]. In the full model, a retailer or an aggregator can act as a mediator between the wholesale market and end-users, but is not responsible for end-users' imbalances.
Light balance responsibility (left side of Figure 3) refers to an independent aggregation solution, where the effects of aggregation on other market participants are considered. In the light balance responsibility model, the traditional system balance responsibility is maintained, and a separate local balance is established (i.e., 'light' in terms of the number of regulatory changes required in the overall market mechanism). Local balance responsibility adds an additional layer to the balance settlement and thus complicates the settlement procedure, but for the ISR, local market operation is not visible. In the light model, the balance responsibility is a separate contractual agreement similar to the system balance responsibility, but maintained only between the "sub-BRP" (e.g., end-consumer) and its retailer or a BRP. The local market coordinates the changes to the balances of the BRPs at the system level. In the light model, a separate local ISR may be required in order to allocate payments for non-delivery of flexibility, e.g., to the DSO.
The full balance responsibility (right side of Figure 3) has similarities with the idea of a smaller balance responsible party. In the full balance responsibility model, the (system) balance responsibility is extended, e.g., to the level of individual end-customers, and the trades from the local market as well as the bilateral trades or trades with the retailer are directly forwarded to the imbalance settlement responsible (ISR). This extensively increases the number of parties connected to the settlement procedure and the amount of data to be settled, and thus, the information exchange requirements. One benefit of this approach is that it does not interfere with the structures of balance settlement at a general level, but it requires redefinition of the role and responsibilities of the BRP, and thus, new regulation. The proposed model increases the responsibilities of the end-user, but also incentives for active market participation.

User-Centric Interfaces
Although P2P energy sharing is a growing field of research across the globe, it still showcases many untapped opportunities and synergistic potential for academia and industry. Considering that P2P energy sharing models fundamentally thrive on the social interconnectedness among end-users [42], this section aims at exploring the main takeaways from the social sciences literature on P2P energy sharing that can inform the design of local energy market interfaces where the added value of P2P energy sharing can be effectively explored.
In view of that, little evidence is found in the literature related to end-user engagement in the context of P2P energy sharing. Nonetheless, the work carried out by Klein et al. [41] is informative in this regard, as these authors conceptualized, designed, trialed, and validated a pragmatic end-user engagement framework in three different low-voltage energy community pilots in Portugal, where the concept of P2P energy sharing was demonstrated [41]. The framework, which is framed on P2P energy sharing, suggested dividing the enduser engagement approach into two distinct phases that encompass different engagement strategies and respective mechanisms to enable them [41]. Additionally, the framework recommended segmenting end-users based on their level of involvement with the P2P energy sharing interactions [41]. All in all, the framework proposed different end-user engagement strategies that addressed the following aspects: provision of added value (e.g., in the forms of data privacy, data security, comfort gains, financial incentives, information services); the identification of different end-user typologies; promotion of capacity building and awareness raising; creation of commitment and appeal; delivery of effective feedback and pricing schemes; promotion of a variety of end-user-interaction schemes; ease-of-use and intuitive designs; incentivization of social comparison; and stimulation of reflection and learning [41].
From the perspective of a change in energy-related behavior, Heiskanen et al. [68] suggested that the focus should shift from an individual level to an energy community level to account for the socially grounded nature of humankind. Heiskanen et al. [68] concluded that energy communities of different types can offer solutions (not addressed at the individual level) to issues, such as social dilemmas, social conventions, socio-technical infrastructures, and helplessness. For example, the collective nature of energy communities addresses the issue of social dilemmas because it allows people to see others "doing their part" or, in other words, it provides stronger assurance that others will cooperate (e.g., in the sustainable management of shared resources, such as the case of P2P energy sharing) [68]. Energy communities also address the issue of social conventions, as they allow people to self-organize in new social groups that can deliberately create alternative social conventions that challenge existing ones (e.g., challenging high-carbon lifestyles in the face of more sustainable ones) [68]. In terms of socio-technical infrastructures, energy communities provide new grounds for the experimentation of alternative solutions (e.g., new local grid networks for direct P2P energy trading among peers within the same energy community) [68]. Finally, energy communities can counter helplessness by empowering end-users in the context of collective actions toward common goals [68].
Still on the topic of energy-related behavior change, Pombeiro et al. [69] identified multiple dimensions to be considered in energy reporting interfaces to drive behavior change, including: feedback frequency; different measuring units for different targeted enduser groups; data granularity; balance between pull and push (i.e., what is solicited from and displayed to end-users); appropriate selection of the presentation medium; location of the energy reporting system; appealing visual design and language of the end-user interface; suggested actions and solutions; comparison; and information sharing.
With regard to the development of local energy market interfaces, Zhou et al. [70] explained that these interfaces can be either centralized or blockchain-based decentralized, and that their design can leverage on game-based approaches to stimulate P2P energy sharing decision-making processes in synchronism with market rules and pricing signals. In the same line of thought, Peacock et al. [71] concluded that end-users prefer home energy management interfaces with visual means and contextual information over abstract information, as well as community-wide information rather than household-level information. Additionally, Beck et al. [72] inferred that the use of gamification components and game elements in mobile energy-related applications positively influence their uptake, and that the most widely used ones are feedback and points, respectively.
In line with the foregoing, the DOMINOES local energy market interface was conceptualized and designed as a means to provide a virtual ecosystem where end-users could interact and transact their energy assets (such as the case of surplus distributed generation in P2P energy sharing transactions) with other market participants. The DOMINOES local energy market interface was developed under the following premises: (i) prosumer empowerment to extract new value from their energy assets through new revenue streams and/or energy savings; (ii) demand response service provision; (iii) creation of actionable flexibility for innovative distribution management; (iv) easy wholesale market uptake of distributed resources; (v) local sharing and optimization of renewable resources in MV and LV grids; (vi) support to liberalized energy markets; and (vii) compatibility with the ongoing policy development.
Based on this, different front-end engagement mechanisms were devised to enable effective participation of end-users in the DOMINOES local energy market. As an example, end-users willing to engage in P2P energy sharing were invited to select their buying and selling profiles based on the trading behavior they want to assume in the DOMINOES local energy market. Then, a bespoke social matchmaking mechanism was designed to support the optimal matching between the most compatible providers and buyers in the DOMINOES local energy market. This optimal matching considers multiple variables, such as: end-users' profile selection; day-ahead forecasting of energy consumption profiles, renewable generation profiles, battery storage capacity; and energy prices in the wholesale and local energy markets. This mechanism was designed to save end-users from having to constantly make decisions on P2P energy sharing transactions, thus representing a valuable and resourceful tool for those who wished to have a more proactive role in the local energy markets, but who had a misleading perception that such a role was too difficult or cumbersome. A visual representation of the P2P energy sharing module within the DOMINOES local energy market platform is given in Figure 4.

Managerial Implications
Sections 3.1-3.3 have proposed approaches for bidding, pricing, and balance settlement in local markets, as well as an interface design for prosumers and end users taking part in such markets. These solutions were designed keeping in mind the market arrangements and legislative framework in most European countries (e.g., double-auction based wholesale market, retail market with a free choice of supplier, emerging energy community legislation, and access of aggregated flexibility to ancillary service markets). In electricity markets outside Europe, different approaches may be required. Furthermore, as the national legislative frameworks concerning energy communities and P2P trading are still forming in many European countries as well, there is uncertainty related to the emergence of new service providers and the opportunities for them. Balance responsibility arrangements may be simpler if a retailer adopts the energy community service provider role and facilitates local trading, but the solutions proposed in Section 3.2 enable the service provision to communities also by other stakeholders, possibly adding pressure to innovate and develop better services for communities and prosumers. Nevertheless, all the proposed solutions still require testing in real market conditions to gain additional insights into their feasibility and prosumer/end-user preferences related to bidding arrangements and the information that they consider valuable. from having to constantly make decisions on P2P energy sharing transactions, thus representing a valuable and resourceful tool for those who wished to have a more proactive role in the local energy markets, but who had a misleading perception that such a role was too difficult or cumbersome. A visual representation of the P2P energy sharing module within the DOMINOES local energy market platform is given in Figure 4.

Managerial Implications
Sections 3.1-3.3 have proposed approaches for bidding, pricing, and balance settlement in local markets, as well as an interface design for prosumers and end users taking part in such markets. These solutions were designed keeping in mind the market arrangements and legislative framework in most European countries (e.g., double-auction based wholesale market, retail market with a free choice of supplier, emerging energy community legislation, and access of aggregated flexibility to ancillary service markets). In electricity markets outside Europe, different approaches may be required. Furthermore, as the national legislative frameworks concerning energy communities and P2P trading are still forming in many European countries as well, there is uncertainty related to the emergence of new service providers and the opportunities for them. Balance responsibility arrangements may be simpler if a retailer adopts the energy community service provider role and facilitates local trading, but the solutions proposed in Section 3.2 enable the service provision to communities also by other stakeholders, possibly adding pressure to innovate and develop better services for communities and prosumers. Nevertheless, all the proposed solutions still require testing in real market conditions to gain additional insights into their feasibility and prosumer/end-user preferences related to bidding arrangements and the information that they consider valuable.

Conclusions
Peer-to-peer (P2P) electricity trading and better utilization of distributed resources, such as demand response and storages, can benefit several stakeholders in the power sys-

Conclusions
Peer-to-peer (P2P) electricity trading and better utilization of distributed resources, such as demand response and storages, can benefit several stakeholders in the power system and, additionally, help in reaching societal goals, such as increasing the share of renewable generation. However, the legislative and regulatory framework for P2P trading and energy communities is still lacking in many countries, which has slowed down their uptake in actual environments. In Europe, the Clean Energy for all Europeans legislative package sets some guidelines for energy communities and P2P trading. However, the main focus is on the rights of consumers, prosumers, and novel stakeholders, such as aggregators, and not on detailed P2P trading and sharing arrangements. Thus, detailed arrangements still require national consideration. Nevertheless, piloting the new solutions in actual environments in cooperation with the regulators and legislators has proven to be an efficient way to identify the gaps and proposing solutions for tackling them.
Key parts in determining the efficiency of markets are the ways in which the market participants can describe their valuations for tradable resources, as well as how allocation and compensation are determined based on the indicated valuations. In a peer-to-peer context, the end-customers may have complex valuations of who they want to trade with based on, e.g., generation type or locality. Furthermore, the multimarket scenario makes the decision-making more complex, as further markets have to be considered during the valuation. Compatibility with existing markets in the choices for bidding structures and compensation enables easier integration of a local peer-to-peer market within the sequence of existing markets.
While several aspects of P2P trading have been addressed in previous literature, the interplay between the local trading and the existing market structures has received less attention. Furthermore, P2P trading and utilization of distributed resources presumes that electricity end-users who have traditionally had a rather passive role as mere consumers would transform into active players in the power system. This paper has addressed these gaps by proposing (1) a bidding and pricing mechanism for local markets taking into account the external energy and flexibility markets; (2) a new approach to balance settlement and balance responsibility taking into account the local trading; and (3) interface to promote end-user interest in, and interaction with, local energy trading.
The proposed bidding and pricing mechanism takes into account compatibility with the existing arrangements in the European wholesale markets, i.e., zonal pricing and redispatch for congestion within zones. Separate bids are sent for energy and flexibility, and although the markets are organized as centrally cleared pools, the indication of preferred trading partners is enabled. This arrangement contributes to simplicity for the participants while also increasing their freedom of choice. Furthermore, our balance settlement and balance responsibility approach considers two options to deal with local trading, keeping in mind that local trading affects the suppliers or balance responsible parties (BRPs), and the new European legislation requiring balance responsibility from the active customers, communities, and aggregators. Thus, two options for implementing balance responsibility locally were proposed. The end-user/prosumer interface designed in this paper tries to improve the chances of customer participation in P2P and local trading programs. We consider consumer preferences for energy information and interfaces and the potential added value of addressing communities instead of only individual users. The proposed design enables the end-users to take part in local trading without constantly making decisions on transactions.
However, as the local market concept considered in this paper is based on European legislation and market arrangements, some approaches and services may not be feasible in markets with very different offsets. Furthermore, we have considered the coupling between local and higher-level markets, and some TSOs already accept flexibility bids from aggregated resources. However, DSOs could also benefit from the local flexibility (or be impacted by local transactions), but their participation in dynamic flexibility markets is still in a very early phase. Thus, further research is needed on DSO participation in local markets, or on the interaction between local markets and DSOs' preferred flexibility trading mechanisms.

Data Availability Statement:
No new data were created or analyzed in this study. Data sharing is not applicable to this article.