<figure><img src="image_1.png" /></figure>

HAL
open science

# Coordinated management under uncertainty and fair revenue distribution in a multi energy community

Rémy Rigo-Mariani, Arif Ahmed

► To cite this version:

Rémy Rigo-Mariani, Arif Ahmed. Coordinated management under uncertainty and fair revenue distribution in a multi energy community. Energy, 2025, 339, pp.138802. 10.1016/j.energy.2025.138802. hal-05329276

HAL Id: hal-05329276

https://hal.science/hal-05329276v1

Submitted on 24 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_3.png" /></figure>

# Coordinated management under uncertainty and fair revenue distribution in a multi energy community

Rémy Rigo-Mariani<sup>a,b,*</sup> , Arif Ahmed<sup>c</sup>

## ARTICLE INFO

### Keywords:

Energy community

Fairness

Model predictive control

Coordinated optimization

ADMM

## ABSTRACT

This paper investigates an energy community comprising residential users with controllable heating/cooling systems and distributed energy resources. A two-stage management is proposed with a day-ahead scheduling followed by near real-time correction of the controls to mitigate uncertainties. Decentralized model predictive control using an Alternating Direction Method of Multipliers (ADMM) algorithm is employed in both stages. Additionally, a monthly post-delivery reward system is suggested to evaluate each user's marginal contribution to community performance. The contributions are the real-time tuning of the models to limit the impact of equations inaccuracies, and the simulation of the operational phase while prior studies on communities focus on offline assessments with deterministic profiles. Also, the proposed methodology emphasizes technical objectives over economic considerations with i) the smoothing of the community power usage and ii) minimum deviations from committed profiles in real-time. Those objectives relate to the reduction of peak power generation and the need for energy reserve. Simulation results show a 55 % reduction in reserve requirements and a 35 % smoother community power profile, albeit with a 10 % increase in users' bills due to coordination. The post-delivery scheme evaluates each user's contribution to peak power reduction and energy deviation, facilitating fair revenue distribution based on energy and reserve prices.

<table><caption>Nomenclature of the main symbols and acronyms used</caption><tr><td>Sets:</td><td></td></tr><tr><td>t &isin; T</td><td>set of time steps (time step dt)</td></tr><tr><td>n &isin; N</td><td>set of users</td></tr><tr><td>Variables:</td><td></td></tr><tr><td>p<sup>bat</sup><sub>n,t</sub>, p<sup>bat-</sup><sub>n,t</sub></td><td>storage charge/discharge of user n at time t</td></tr><tr><td>soc<sub>n,t</sub></td><td>storage state of charge of user n at time t</td></tr><tr><td>u<sup>bat+</sup><sub>n,t</sub></td><td>storage of user n charging mode at time t {0,1}</td></tr><tr><td>p<sup>bd+</sup><sub>n,t</sub>, p<sup>bd-</sup><sub>n,t</sub>, p<sup>bd</sup><sub>n,t</sub></td><td>grid import/export/net of user n at time t</td></tr><tr><td>p<sup>bd</sup><sub>n,t</sub>, p<sup>bd</sup><sub>n,t</sub></td><td>HVAC heating/cooling power of user n at time t</td></tr><tr><td>u<sup>c</sup><sub>n,t</sub></td><td>HVAC of user n in cooling mode at time t {1,0}</td></tr><tr><td>T<sup>g</sup><sub>n,t</sub></td><td>temperature setpoint of user n at time t</td></tr><tr><td>T<sup>u</sup><sub>n,t</sub></td><td>zone temperature of user n at time t</td></tr><tr><td>P<sub>t</sub></td><td>aggregated net grid power at time t</td></tr><tr><td>x<sub>n,t</sub></td><td>aggregated variables of user n at time t</td></tr><tr><td>p<sup>gd</sup><sub>n,t</sub></td><td>consensus variable of user n at time t</td></tr><tr><td>Parameters:</td><td></td></tr><tr><td>p<sup>l</sup><sub>n,t</sub>, p<sup>lv</sup><sub>n,t</sub></td><td>load and solar generation of user n at time t</td></tr></table>

(continued on next column)

(continued)

<table><tr><td>π<sup>+</sup><sub>n</sub>, π<sup>-</sup><sub>n</sub></td><td>grid purchase price and feed-in tariff</td></tr><tr><td>T<sup>g</sup><sub>n</sub></td><td>ambient temperature at time t</td></tr><tr><td>α<sup>g</sup><sub>n</sub></td><td>trade-off coefficient for near real-time operations</td></tr><tr><td>p<sup>bat</sup><sub>n</sub>, p<sup>bat</sup><sub>n</sub></td><td>battery rated power and capacity of user n</td></tr><tr><td>η<sup>bat</sup></td><td>battery efficiency</td></tr><tr><td>M</td><td>BigM value - 10<sup>6</sup></td></tr><tr><td>Revenue Distribution:</td><td></td></tr><tr><td>P2</td><td>performance value for grid power smoothing</td></tr><tr><td>Edev</td><td>performance value for energy deviations</td></tr><tr><td>B<sup>0</sup><sub>n</sub>, B<sub>n</sub></td><td>baseline and final monthly bills of user n</td></tr><tr><td>C<sup>tot</sup><sub>n</sub>, f<sup>tot</sup><sub>n</sub></td><td>total community cost increase and revenue/savings</td></tr><tr><td>t<sup>P2</sup><sub>n</sub>, t<sup>Edev</sup><sub>n</sub></td><td>revenues from smoothing and deviations of user n</td></tr><tr><td>p<sup>g2</sup><sub>n</sub>, p<sup>gdev</sup><sub>n</sub></td><td>parts of revenues captured by user n</td></tr></table>

## 1. Introduction

Over the recent decades, the growing need to address limited fossil fuels and reduce carbon emissions has driven the increased use of

<footnote><sup>a</sup> Université Grenoble Alpes, CNRS, Grenoble INP, G2Elab, F-38000, Grenoble, France</footnote>

<footnote><sup>b</sup> CNRS@CREATE, 1 Create Way, Singapore</footnote>

<footnote><sup>c</sup> Energy and Power Systems Group, TUMCREATE Ltd., 1 Create Way, Singapore</footnote>

<footnote>* Corresponding author. Université Grenoble Alpes, CNRS, Grenoble INP, G2Elab, F-38000, Grenoble, France.
E-mail address: remy.rigo-mariani@grenoble-inp.fr (R. Rigo-Mariani).</footnote>
renewable energy sources in power systems in the form of small-scale Distributed Energy Resources (DERs) [1]. These systems, integrated into distribution networks, contribute to lower losses by placing generation closer to consumption points [2]. From the perspective of the end-users, the integration of DERs has led to the emergence of the “prosumers” concept which denotes the ability of traditional consumers to also produce energy and adapt the profile of the power exchanged with the main grid they are connected to. Two distinct frameworks are identified in the literature related to the DERs deployment at the “prosumer” level. On one hand, a wide range of studies investigates energy management applications at the individual building level with specific attention attached to operating conditions and uncertainty mitigations. One the other hand, in recent years, the literature on the aggregation of several prosumers with the concept of Energy Community (EC) has gained a lot of interest. Beyond the control aspects, the related studies mainly deal with energy and value-sharing strategies between the EC members.

## 1.1. Smart building Energy Management Strategies

At the building level, DER integration such as local generation allows energy bill reduction and/or better energy usage with greater ratios of self-consumption/sufficiency [3]. Greater performances can be reached with flexible assets such as energy storage, controllable loads, and adjustable Heating, Ventilation, and Air Conditioning (HVAC) systems [4,5]. In order to enable those performances, household equipment shall be efficiently controlled. To that end, Energy Management Strategies (EMS) have long been explored, particularly in the context of smart homes [6]. These strategies typically rely on Model Predictive Control (MPC), where the assets setpoints are determined based on predictions of the system environment (e.g., load/generation profiles) and system models, possibly including building/household models when considering thermal comfort [4,7,8]. Control often involves cost-driven optimization (e.g., minimizing energy bills [8–10]) with environmental objectives such as reducing carbon emissions [11,12], and technical criteria like Peak to Average Ratio (PAR) of power profiles exchanged with the grid [4,12]. Deterministic optimizations are performed on a look-ahead basis, usually over a 24-h window, using algorithms tailored to the system models. Mixed Integer Linear Programming (MILP) is prevalent, especially for managing shiftable/interruptible loads [8,9, 13]. Mixed Integer Non-Linear Programming (MINLP) is applied when dealing with nonlinearities such as storage degradation [13], power flow computation with electrical grid models [11], or HVAC systems [4]. Heuristics and metaheuristics like genetic algorithms [10] or particle swarm optimization [9] are used for multi-objective or strongly nonlinear scenarios.

Most studies assume perfect forecasts and evaluate the control performances in a somewhat offline mode with deterministic simulations performed to assess the expected performances. However, uncertainties and variability of renewable generation and load profiles can drastically degrade the controller performances if not mitigated properly. To do so, real-time redispatching and adaptive strategies are oftentimes investigated, typically at a minute-level resolution [14]. Two-stage management strategies are then implemented, with near real-time phases considering updated forecasts and correcting the control actually sent to the equipment from instantaneous measurements [15]. Noticeable examples of such methods adjust controls in order to keep the grid power profiles close to scheduled values determined in the first look-ahead stage, using MILP or fast heuristics [16,17]. Mitigating forecast errors has then received specific attention, focusing on load/generation predictions, energy prices, and environmental factors such as ambient temperature or solar radiation. However, when actual systems are controlled, they behave differently from the predictions of the approximate model equations. Thus, for a thorough performance assessment of any control strategy, it is deemed crucial to consider the impact of those controls once applied to a more accurate representation of the systems

(if not the physical system itself). This is often overlooked in the literature. Some studies validate proposed controls using more accurate building models (e.g., EnergyPlus software) integrated as environment within reinforcement learning strategies [18] or traditional MILP [19] for cost reduction. Experimental results on real-life systems, such as actual rooms [20] or entire houses [21], exist, but they primarily focus on cost reduction with comfort constraints without real-time correction for power profile uncertainties. Table 1 summarizes the main references reviewed in the scope of building energy management.

## 1.2. Energy communities operations and organizations

Aggregating the DERs owned by different users and/or buildings allows achieving more efficiency while taking advantage of heterogeneous energy usage. This is today possibly within the Energy Community (EC) framework, on which literature has extended a lot in recent years. Even if different definitions and regulatory frameworks exist [27], ECs typically consist of the coalition of several end-users, equipped or not with DER in their premises – i.e. “behind the meter”, and who can potentially exchange and/or trade energy together. For more efficient energy usage, ECs can display shared assets (e.g. community storage in Ref. [28]) or consider multi-energy carriers layouts with electricity, heating, and/or cooling as in Refs. [30,31]. Extensive research on energy communities focuses on EMS relying on optimization solutions such as MILP [28] or metaheuristics [29]. It is worth noting that a wide range of studies consider centralized implementations with a community manager that has full controllability of the assets within the community [29, 32]. Also, similar to the building control, simulations are oftentimes performed in a somewhat offline mode with deterministic load/renewable profiles with few studies proposing two-stage operations with uncertainties mitigation in near real-time [32,33].

Being by nature multi-player environments, ECs operation strategies and organization are more and more considered within decentralized frameworks. In such cases, decentralized architectures are proposed with a central manager that coordinates a pool of individual end-users through price signals. There is then no direct control of the resources “behind the meter” in order to ensure privacy by design. The implemented problems typically take the form of a multi-level game (Stackelberg game [30]) while considering local objectives (e.g. individual energy bills) and global performances (e.g. self-consumption at the community level). In many cases, bi-level optimization to find the best operating setup for individual assets is considered. A unique mathematical problem with equilibrium constraints is oftentimes solved while formulating the lower-level problem (i.e. end-user optimization) with its equivalent KKT conditions if convexity is proven [30,34]. Other proposed solutions keep the decentralized nature of the systems while iteratively solving the local and global problems until an equilibrium is reached. Traditional optimization (MILP [35], NLP [36], GA [37]) is proposed along with heuristics that manage the information exchanges between the upper and lower levels along iterations. Among decentralized algorithms, the Alternating Direction Method of Multipliers (ADMM) has gained interest in the field of distributed energy resource management in the past years [32,38]. This algorithm proceeds in iterations where the agents optimize their individual objectives while converging toward consensus (we talk here of C-ADMM).

The distribution of economic value among EC members is a research field by itself, covering two topics. The first topic refers to how EC members trade and exchange energy. This can typically be addressed in a decentralized or centralised fashion. In the former, community members usually bid on quantity prices before peer-to-peer mechanisms or local energy markets are cleared in Refs. [35,36]. In a centralised framework, a community manager oversees the community's physical and financial flows [37]. This can be done post-delivery the EC is controlled and when the measured power profiles at the meters are available (e.g. on a monthly basis) [39]. The second topic refers to analysing the fairness within the EC after cost/benefit sharing has been
<table><caption>**Table 1**
Scope of work and contribution of the article in the context of smart building energy management.</caption><thead><tr><th>Refs.</th><th>DERs and controls</th><th>Objectives</th><th>Controller Algorithm</th><th>HVAC Model</th><th>Two-Stage Management</th><th>Validation Model</th></tr></thead><tbody><tr><td>[4,7,8,11,12, 22]</td><td>PV, EV, storage, HVAC, thermal/electrical storages, controllable loads, CHP unit</td><td>Cost, PAR</td><td>MILP, MINLP</td><td>✓</td><td></td><td></td></tr><tr><td>[9,10]</td><td>Distribution grid, PV, storage, controllable loads</td><td>Cost, emissions</td><td>GA, PSO</td><td>✓</td><td></td><td></td></tr><tr><td>[23]</td><td>Single house, PV, storage, controllable load</td><td>Cost, energy</td><td>DP and heuristic</td><td></td><td></td><td></td></tr><tr><td>[15–17]</td><td>Multi-energy, PV, thermal/electrical storages, controllable loads</td><td>Cost</td><td>MILP, MINLP, DP, Metaheuristics</td><td></td><td>✓</td><td>✓</td></tr><tr><td>[5]</td><td>Multi-energy, PV, fuels cell, storage, CHP unit</td><td>Costs</td><td>MINLP</td><td>✓</td><td>✓</td><td></td></tr><tr><td>[18,24]</td><td>multi-energy, PV, storage</td><td>Cost</td><td>RL</td><td>✓</td><td></td><td>✓</td></tr><tr><td>[25,26]</td><td>Single building, controllable load</td><td>Cost</td><td>PSO</td><td>✓</td><td></td><td>✓</td></tr><tr><td>[19–21]</td><td>Single house</td><td>Cost</td><td>MILP; NLP</td><td>✓</td><td></td><td>✓</td></tr><tr><td>[17]</td><td>Single house, PV, storage</td><td>Energy exchanges</td><td>MILP/QP and heuristic</td><td>✓</td><td>✓</td><td>✓</td></tr><tr><td><strong>This work</strong></td><td><strong>Single house, PV, storage</strong></td><td><strong>Energy exchanges</strong></td><td><strong>MILP/QP and heuristic</strong></td><td>✓</td><td>✓</td><td>✓</td></tr></tbody></table>

PV: photovoltaics, EV: electrical vehicles, MILP: mixed integer linear programming, MIQP: mixed integer quadratic programming, PSO: particle swarm optimization, GA: genetic algorithm, PAR: peak to average ratio, MIQCP: mixed integer quadratically constrained programming, CHP: combined heat and power, NLP: nonlinear programming, MINLP: mixed integer nonlinear programming, DP: dynamic programming, RL: reinforcement learning.

performed with different metrics inherited from game theory [40]. The Shapley value has then emerged as a widely used metric based on the estimation of every user's marginal contribution to the community performances (e.g. Shapley value [41–43]). Typical EC studies focus on the economic advantages for the user when joining an EC with improved self-sufficiency and reduced energy bill. Additional revenues stream arise with the provision of services to grid operators [44]. In this paper we will propose services based on the improvements of technical criteria that can be generalized to any power system. In such cases the share of that additional revenue is considered at the same time as the energy exchange between the EC members. Table 2 summarizes the main references reviewed in the scope of building energy management.

## 1.3. Scope of work and contributions

Following the previous subsections, Tables 1 and 2 highlight the scope of work of the current paper that bridges a gap between the two aforementioned classes of problems - i) building control and ii) energy community management. The case study considered in this work is the control of buildings DERs and HVAC in the context of a residential energy community. At first, the community operation is implemented in a two-stage fashion with a look-ahead phase based on forecasts followed by a near real-time adjustment of the controls. Both stages rely on decentralized optimization with ADMM accounting for local and community objectives. From the perspective of building control, the main contribution is the management performed on a two-stage mode while accounting at the same time for uncertainties from load/renewable

forecasts, and inaccuracies embedded in the model equations of the controller. In the context of ECs, in light of the previous discussions, the vast majority of research works aforementioned overlooks the operational phase and ECs performances are discussed in offline simulations considering deterministic profiles. It is not the case here with a two-stage operation simulated over a month and accounting for the impact of forecast inaccuracy. In addition, discussions on fairness among the community members are oftentimes limited to the arbitrage between the end-user's energy bill and overall system operating costs at the equilibrium point. This paper distinguishes itself as there is no economic considerations at the community level such as energy purchase/sold with the wholesale electricity market. Instead, technical objectives are targeted to i) smooth the overall net power of the community and ii) minimize deviations to a committed profile in near real-time operations. In other words, the community can participate in increasing the overall power system efficiency and resilience with fewer power peaks and fewer reserve requirements. Lastly, a post-delivery methodology is proposed for fairness in the community. It consists of rewarding individual users based on their marginal contribution to the EC performance improvement along the two technical objectives considered. To summarize, the main contributions of the paper are:

* A two-stage management of HVAC systems and storage within a residential energy community with mitigation of forecast uncertainties and model inaccuracies.

* A decentralized operational planning that considers local and global objectives compared with centralized and individual controllers.

<table><caption>**Table 2**
Scope of work and contribution of the article in the context of energy communities.</caption><thead><tr><th>Refs.</th><th>DERs and controls</th><th>Management Algorithm</th><th>Control Type</th><th>Cost/Energy Allocation</th><th>Two-Stage Management</th><th>Fairness Assessment</th></tr></thead><tbody><tr><td>[28,29,45]</td><td>Local and shared assets, PV, storage</td><td>MILP, GA</td><td>Centralized</td><td></td><td></td><td></td></tr><tr><td>[38]</td><td>PV, storage, EV</td><td>ADMM</td><td>Decentralized</td><td></td><td></td><td>≈</td></tr><tr><td>[31,42]</td><td>PV, storage</td><td>MILP</td><td>Centralized</td><td>Post delivery</td><td>✓</td><td>✓</td></tr><tr><td>[46]</td><td>PV, storage, grid constraints</td><td>ADMM</td><td>Decentralized</td><td>Post delivery</td><td>✓</td><td>≈</td></tr><tr><td>[47]</td><td>PV, storage</td><td>ADMM</td><td>Decentralized</td><td></td><td>✓</td><td>≈</td></tr><tr><td>[30]</td><td>Multi-energy, PV, storage</td><td>KKT</td><td>Decentralized</td><td></td><td></td><td>≈</td></tr><tr><td>[32]</td><td>PV, storage, grid constraints</td><td>ADMM</td><td>Decentralized</td><td>P2P</td><td>✓</td><td>≈</td></tr><tr><td>[37]</td><td>PV, controllable loads</td><td>GA + heuristic</td><td>Decentralized</td><td>Pool</td><td></td><td>≈</td></tr><tr><td>[35,36]</td><td>PV, storage, grid constraints</td><td>MILP/NLP + heuristic</td><td>Decentralized</td><td>P2P</td><td></td><td>≈</td></tr><tr><td>[43]</td><td>Shared ESS</td><td>MILP + heuristic</td><td>Decentralized</td><td>Post delivery</td><td></td><td>✓</td></tr><tr><td>[42]</td><td>PV, storage</td><td>MILP</td><td>Centralized</td><td>Post delivery</td><td></td><td>✓</td></tr><tr><td>[33]</td><td>PV, storage</td><td>MILP</td><td>Centralized</td><td></td><td>✓</td><td></td></tr><tr><td><strong>This work</strong></td><td><strong>HVAC, PV, storage</strong></td><td><strong>ADMM</strong></td><td><strong>Decentralized</strong></td><td><strong>Post delivery</strong></td><td>✓</td><td>✓</td></tr></tbody></table>

PV: photovoltaics, EV: electrical vehicles, MILP: mixed integer linear programming, GA: genetic algorithm, PAR: peak to average ratio, NLP: nonlinear programming, ADMM: Alternating Direction Method of Multipliers, KKT: Karush-Kuhn-Tucker.
* A post-delivery revenue distribution between users based on their marginal contribution to the community and profitability assessment based on wholesale and reserve energy prices.

The rest of the paper is organized as follows. Section 2 introduces the main model equations for the household along with a generic ADMM implementation. Section 3 details the proposed approach while highlighting the users' and coordinator's objectives in the two-stage management proposed. In addition, section 3 presents the revenue distribution among users based on the savings of the coordinator in both energy and reserve wholesale markets. A one-month simulation is performed in section 4, and results are analyzed along the look-ahead and near-real-time phases before a sensitivity analysis of the individual and collective savings is performed. Finally, conclusions are drawn in section 5.

## 2. Case study models and methods

### 2.1. Case study

This paper focuses on the coordinated control of a multi-energy community consisting of several households N (users n) along a simulation horizon T (time steps t). As illustrated in Fig. 1a and further explained in Section 2.3, the coordination accounts for individual house objectives $f_n$ (e.g. bill minimization) respectively to local controls/variables $x_{n,t}$ and a global target F at the distribution level once the individual contributions of every house are aggregated (i.e. grid power $p_{n,t}^{gd}$). Convergence will be reached with successive information exchanges about quantities and prices/penalties ($\lambda_{n,t}$).

A generic representation of the considered households is given in Fig. 1b. The presented case study models and accounts for the thermal behavior of the system while considering the electricity needed for heating/cooling with respect to the ambient temperature ($T_t^a$), solar irradiation ($G_t$), and numerous building parameters. Ultimately, for a given electrical load value ($p_{n,t}^t$) and solar generation ($p_{n,t}^{pv}$), the electrical power exchanged with the grid ($p_{n,t}^{gd}$) - import $p_{n,t}^{gd+}$ export $p_{n,t}^{gd-}$ - is impacted by the two degrees of freedom in the system - i.e. the battery charge/discharge powers ($p_{n,t}^{bat+}$, $p_{n,t}^{bat-}$) and the zone temperature setpoint set by the user ($T_t^z$) that impacts the electrical load for heating/cooling ($p_{n,t}^{hc}$). Note that the weather conditions, which are inputs for simulation, embed the solar radiation ($G_t$) that is used (with the ambient temperature $T_t^a$) to compute the generated solar power ($p_{n,t}^{pv}$) based on a standard single-diode solar model [48].

### 2.2. Generic model equations

#### 2.2.1. Household thermal model

As previously mentioned, the simulation accounts for the thermal behavior of the households by modeling the dynamic thermal nature of the house/building and considering the impact of HVAC power for heating ($p_{n,t}^h$) and cooling ($p_{n,t}^c$). A reference system model is then established based on prior works carried out in the context of multi-energy system modelling [49]. The model serves as a reference to evaluate the heating/cooling HVAC power estimated based on the weather conditions - i.e. ambient temperature and solar radiation while accounting for the orientation of the wall - the temperature setpoint ($T_t^z$) and the observed zone temperature ($T_t^a$). The reference model also accounts for the room/building characteristics in terms of volumes, windows positions and materials. More importantly, it includes a PID controller for the HVAC based on the room temperature setpoints and the value measured, and runs at an internal resolution of 1 min. For management purposes, and for further integration in optimization-based planning, simplified versions of the thermal model are derived with

linearization at lower resolutions. More details can be found in Ref. [17], and ultimately, sets of linear equations estimate the heating and cooling power at 30 min Eq. (1) and 5 min Eq. (2). The coefficients are obtained with a two steps methodology. At first the reference model for the HVAC system is run with a two hundred different sets of inputs (i.e. ambient temperature, setpoint, initial zone temperature), in both cooling and heating modes and at both time resolutions (i.e. 30 min and 5 min). A standard least square minimization is then used to fit the linear equations in terms of cooling/heating power for ever input sets, and thus leading to four sets of coefficients (linear regressions with R2 from 0.80 to 0.99). Also, note that the same ambient temperature is considered for all households n at different time resolutions while the zone and setpoint temperature are individually represented.

$$ \begin{cases} p_{n,t}^{c30} = a_{c30}^{T^a} \times T_t^a + a_{c30}^{T^s} \times T_{n,t}^s + b_{c30} \\ p_{n,t}^{h30} = a_{h30}^{T^a} \times T_t^a + a_{h30}^{T^s} \times T_{n,t}^s + b_{h30} \end{cases} \quad (1) $$

$$ \begin{cases} p_{n,t}^{c5} = a_{c5}^{T^a} \times T_t^a + a_{c5}^{T^s} \times T_{n,t}^s + a_{c5}^{T^z} \times T_{n,t}^z + b_{c5} \\ p_{n,t}^{h5} = a_{h5}^{T^a} \times T_t^a + a_{h5}^{T^s} \times T_{n,t}^s + a_{h5}^{T^z} \times T_{n,t}^z + b_{h5} \end{cases} \quad (2) $$

#### 2.2.2. Household energy hub model

As commonly done in the literature on power and energy systems, individual end-users are here represented as energy hubs with sources and loads. The management of the systems can be formulated as optimization problems with a set of constraints that allow accounting for the physical models of the assets. The first set of constraints refers to the operating limits for the battery in terms of power and energy. Especially, bounds for charging/discharging $p_{n,t}^{bat+}$, $p_{n,t}^{bat-}$ account for the battery-rated power of every user ($p_{n,t}^{bat}$) and its operating mode with the binary variable $u_{n,t}^{bat+}$ denoting the charging mode of the battery of user n at time t (Eq. (3) and Eq. (4)) in order to avoid simultaneous charging and discharging. The state of charge ($\text{soc}_{n,t}$) shall remain in the range 0–100 % (Eq. (5)) and is updated at every time step with the charge/discharge power according to the simplified linear model in Eq. (6). The model accounts for the battery efficiency $\eta^{bat}$ and nominal capacity of user n's battery ($\epsilon_n^{bat}$). Additional constraint (Eq. (7)) allows setting the initial ($\text{soc}_{n,0}$) and final SOC values to be similar (typical cyclic constraint for energy conservation purposes).

$$ 0 \le p_{n,t}^{bat+} \le u_{n,t}^{bat+} \times \overline{p_n^{bat}} \quad \forall (n, t) \in \{N, T\} \quad (3) $$

$$ 0 \le p_{n,t}^{bat-} \le (1 - u_{n,t}^{bat+}) \times \overline{p_n^{bat}} \quad \forall (n, t) \in \{N, T\} \quad (4) $$

$$ 0 \le \text{soc}_{n,t} \le 100 \quad \forall (n, t) \in \{N, T\} \quad (5) $$

$$ \text{soc}_{n,t+1} = \text{soc}_{n,t} + \left( p_{n,t}^{bat+} \times \eta^{bat} - \frac{p_{n,t}^{bat-}}{\eta^{bat}} \right) \times \frac{dt}{\epsilon_n^{bat}} \times 100 \quad \forall (n, t) \in \{N, T\} \quad (6) $$

$$ \text{soc}_{n,t+1} = \text{soc}_{n,t=\|T\|+1} = \text{soc}_{n,0} \quad \forall n \in N \quad (7) $$

The next set of generic constraints relates to the simplified model to compute the HVAC power based on the temperature setpoints between the bounds in Eq. (8) – those bounds are set to 21–25 °C in cooling mode and 18–22 °C in heating. Similar to the battery charge/discharge modes, cooling and heating cannot occur at the same time. This is ensured with constraint Eq. (9) and the use of the binary variable $u_{n,t}^c$ denoting that the system of user n at time t is operated in cooling mode with an upper limit theoretical (M = 10⁶). Cooling occurs whenever the ambient temperature (predicted) is greater than the temperature setpoints, and heating otherwise, as ensured with Eq. (10). As previously mentioned, the same ambient temperature value is assumed to be shared among all the participants n. Constraints Eq. (11) compute the cooling/heating power of
<figure><img src="image_4.png" /><figcaption>Fig. 1. Considered case study – a) multi-energy community coordination – b) house models.</figcaption></figure>

the HVAC with the fitting coefficients for the proposed linear model – the example is given here for optimization at a half-hourly resolution, i. e. lookahead phase presented in the next section. The BigM method here ensures that the appropriate operation and power estimation are valid depending on the operating mode (binary variable value). That method is a standard approach in MILP that allows to translate “if – else” conditional constraints into piecewise feasibility regions in the optimization search space.<fnref n="1" /> Rigorously, the unit of M would deend on the units of the variables in the test conditions (e.g. kW or °C in Eq. (9) and Eq. (10)). However, as M is more a “mathematical object” rather than a physical/ measurable quantity, the conventional approach is to consider it as a dimensionless parameter. This also avoid the use of multiple M symbols for different units/tests.

$$21 \leq T_{n,t}^{s} \leq 25 \quad \forall (n,t) \in \{N, T\} \qquad (8)$$

$$\begin{cases} 0 \leq p_{n,t}^{c} \leq u_{n,t}^{c} \times M \\ 0 \leq p_{n,t}^{h} \leq (1 - u_{n,t}^{c}) \times M \quad \forall (n,t) \in \{N, T\} \end{cases} \qquad (9)$$

$$\begin{cases} T_t^a - T_{n,t}^s \le u_{n,t}^c \times M \\ T_t^s - T_{n,t}^a \le (1 - u_{n,t}^c) \times M \quad \forall (n,t) \in \{N, T\} \end{cases} \qquad (10)$$

$$\begin{cases} p_{n,t}^{c30} - (1 - u_{t}^{c}) \times M \le p_{n,t}^{c} \le p_{n,t}^{c30} + (1 - u_{n,t}^{c}) \times M \\ p_{n,t}^{h30} - u_{n,t}^{c} \times M \le p_{n,t}^{h} \le p_{n,t}^{h30} + u_{n,t}^{c} \times M \end{cases} \quad \forall (n,t) \in \{N, T\} \qquad (11)$$

The most important information exchange between the coordinator and the users will be the grid power ($p_{n,t}^{gd}$) computed with the power balance constraint Eq. (12) once all the variables values are known – controls and state variables stored in a vector $x_{n,t}$ in Eq. (13). Also, the considered formulation is generic to all households. In the case study investigated, not all users will be equipped with solar generation and storage.

$$\underbrace{p_{n,t}^{gd+} - p_{n,t}^{gd-}}_{p_{n,t}^{gd}} + p_{n,t}^{pv} = p_{n,t}^{l} + p_{n,t}^{bat+} - p_{n,t}^{bat-} + \underbrace{p_{n,t}^{h} + p_{n,t}^{c}}_{p_{n,t}^{hc}} \quad \forall (n,t) \in \{N, T\} \qquad (12)$$

$$x_{n,t} = \left\{ \underbrace{p_{n,t}^{bat-}, p_{n,t}^{bat+}, T_{n,t}^{s}}_{\text{controls}} \text{ soc}_{n,t}, p_{n,t}^{h}, p_{n,t}^{c}, p_{n,t}^{gd+}, p_{n,t}^{gd-} \right\} \qquad (13)$$

## 2.3. Consensus alternating direction method of multipliers – C-ADMM

As further detailed in section 3, the coordination of the considered community relies on the implementation of an alternating direction method of multipliers (ADMM). Initially introduced in Ref. [50], ADMM has garnered significant attention for addressing optimization problems in a distributed manner (e.g., coordination of N agents with associated controls $x_n$) with convex objective functions ($f_n$) derived from a globally separable function. In Eq. (14), $z_n$ represents global variables corresponding to the anticipated system optimum, subject to potential constraints (not depicted here). The need for consensus arises because distinct agents may calculate different values for the same set of variables $x_n$ based on their available information. Consensus ADMM (C-ADMM) involves optimizing separated sub-problems inherited from the augmented Lagrangian of the original problem concerning dual variables $\lambda_n$, with a convergence rate $\rho$ (typically ranging between 0 and 1), as expressed in Eq. (15).

$$\text{obj : } \min \sum_{n \in N} f_n(x_n) \quad \text{s.t : } x_n - z_n = 0 \qquad (14)$$

$$L_n(x_n, \lambda_n, z_n) = f_n(x_n) + \lambda_n^T (x_n - z_n) + \frac{\rho}{2} \|x_n - z_n\|_2^2 \qquad (15)$$

The algorithm then proceeds in three steps over iterations (super- script. (k)). Step 1 lies in the optimization for every agent, potentially subject to individual constraints. Consensus variables are then updated in step 2, and Lagrangian multipliers are refreshed $\lambda_n$ in step 3 (refer to Table 3). The estimation of the consensus variables is the most important step in the coordination scheme and depends on the communication topology and the information exchange between the different actors [51].

In this paper, we employ C-ADMM to address the problem in a decentralized manner, starting with the subproblem for each n (step 1). The consensus values refer to the grid power $\hat{p}_{n,t}^{gd}$ in the agent problem Eq. (16). Similarly to Ref. [52], the update of the consensus involves solving an optimization problem solved by a coordination agent (e.g., at the PCC). Once the controls are individually computed for each house - all $p_{n,t}^{gd}$ are then known and aggregated (step 2). The goal is to minimize the Lagrangian function based on the coordinator’s objective F Eq. (17). Following the conventional last step 3 of the ADMM iteration, multi- pliers are finally updated as expressed in Eq. (18).

$$\text{obj : } \min_{x_{n,t}} f_n(x_{n,t}) + \lambda_n^T (p_{n,t}^{gd} - \bar{p}_{n,t}^{gd}) + \frac{\rho}{2} \|p_{n,t}^{gd} - \bar{p}_{n,t}^{gd}\|_2^2 \qquad (16)$$

$$\text{obj : } \min_{\bar{p}_{n,t}} F(\bar{p}_{n,t}) + \sum_{t \in T} \sum_{n \in N} \lambda_{n,t}^T (p_{n,t}^{gd} - \bar{p}_{n,t}^{gd}) + \frac{\rho}{2} \|p_{n,t}^{gd} - \bar{p}_{n,t}^{gd}\|_2^2 \qquad (17)$$

<footnote n="1">¹ https://www.lix.polytechnique.fr/~dambrosio/teaching/Pisa/slides/Day2/slides_Pisa_Day2_b_MILP_intro_and_ex.pdf.</footnote>
<table><caption>**Table 3**
C-ADMM algorithm.</caption><thead><tr><th colspan="2">C-ADMM</th></tr></thead><tbody><tr><td colspan="2">Initialize: λ<sub>n</sub> = 0, z<sub>n</sub> = 0</td></tr><tr><td colspan="2">Repeat:</td></tr><tr><td>1.</td><td>x<sub>n</sub><sup>(k+1)</sup> = argmin<sub>f</sub> (x<sub>n</sub>) + λ<sub>n</sub><sup>(k)T</sup>(x<sub>n</sub> - z<sub>n</sub><sup>(k)</sup>) + ρ/2||x<sub>n</sub> - z<sub>n</sub><sup>(k)</sup>||<sup>2</sup> for n = 1, ..., N</td></tr><tr><td>2.</td><td>z<sub>n</sub><sup>(k+1)</sup> = &lt;x<sub>n</sub><sup>(k+1)</sup>&gt; - average over all agents</td></tr><tr><td>3.</td><td>λ<sub>n</sub><sup>(k+1)</sup> = λ<sub>n</sub><sup>(k+1)</sup> + ρ/2(x<sub>n</sub><sup>(k+1)</sup> - z<sub>n</sub><sup>(k+1)</sup>)</td></tr><tr><td colspan="2">Until one stopping criteria is met</td></tr></tbody></table>

$$ \lambda_{n,t}^{(k+1)} = \lambda_{n,t}^{(k+1)} + \rho \left/ \left( 2 \left( \bar{p}_{n,t}^{gd} \right)^{(k+1)} - \bar{p}_{n,t}^{gd} \right) \right. \quad (18) $$

### 3. Energy community management and revenue distribution

Similar to previous works carried out by the authors for a single house [17], the proposed energy management strategy consists of a two-stage approach with MPC at different time horizons. The first step consists of a look-ahead optimization that computes the predicted (commitment) grid power profile for the next day – both for the individual household and the coordinator. The second step proceeds in step-by-step decision-making to fulfill the grid commitment as much as possible, accounting for the actual values for consumption, solar generation, and ambient temperature. Note that overall there are three HVAC models. The simulation model derive from Ref. [49] and is not explicated in this paper for the sake of clarity. From that reference model, a 30 min resolution approximation is derived and included in the look-ahead optimization (Eq. (1)) and a 5 min resolution approximation is included in the near real time optimization (Eq. (2)) (see section 2.2.1). Finally, once the actual grid power values are known, billing can occur (e.g. on a monthly basis) and revenue sharing determined based on the coordinator’s savings and potential users’ bill increase. Fig. 2 illustrates the proposed methodologies with the main steps. Details are presented in the following subsections.

#### 3.1. Day-ahead coordination

In the first look-ahead phase, the coordination relies on successive optimizations at the household level (they output the expected $p_{n,t}^{gd}$ in step 1 of the C-ADMM) and at the coordinator level (to update the consensus $\hat{p}_{n,t}^{gd}$ in step 2 of the C-ADMM). That stage accounts for day-ahead forecasts for the load, solar generation, and ambient temperature profiles. For obvious privacy purposes, the forecasts are only accessible to the corresponding household owners who then optimally schedule the operations of their assets (if any). The users’ day-ahead objective, denoted $f_n^{da}$, is the minimization of the electrical bill over the scheduling horizon – i.e. 24 h at 30-min time steps here. The bill consists of the cost for the purchased energy at a time-of-use retail price ($\pi_t^-$) and the revenue for selling any surplus of generation at a fixed feed-in tariff ($\pi^+$) as expressed in Eq. (19). Obviously, the day-ahead optimization is subject to the constraints introduced in the previous section and with the half-hour model for the house HVAC systems.

$$ f_n^{da}(\mathbf{x}_{n,t}) = \sum_{t \in T} \left( p_{n,t}^{gd+} \times \pi_t^{gd+} - p_{n,t}^{gd-} \times \pi_t^{gd-} \right) \times dt \quad (19) $$

The coordinator optimization in step 3 of the C-ADMM aims at defining the values of the consensus variables $\hat{p}_{n,t}^{gd}$ accounting for the global objective. At the coordinator level, the goal $F^{da}$ smooths the grid power profiles over the scheduling window – i.e. minimizing the objective in Eq. (20). From the mathematical perspective, this continuously differentiable objective has the advantage of convexity. For power system applications, this objective is somewhat representative of the loss minimization due to the line power flow and is also consistent

with typical cost-driven optimizations that assume quadratic generation cost (i.e. increasing marginal costs in unit commitment problems [53]).

$$ F^{da} \left( \bar{p}_{n,t}^{gd} \right) = \sum_{t \in T} \left( \sum_{n \in N} \bar{p}_{n,t}^{gd} \times dt \right)^2 \quad (20) $$

As already mentioned, the coordination proceeds in successive iterations $k$ and updates of the Lagrangian and consensus variables. In the implementation, the iterations stop whenever there is no significant improvement of the global objective from one iteration to the next – i.e. $||F^{da}(k+1) - F^{da}(k)|| < \varepsilon$. In addition to the user’s and coordinator’s objectives values, the day-ahead phase returns the expected values for the individual grid power profiles $p_{n,t}^{gd^*}$ and state of charge $soc_{n,t}^*$ that will be considered in the near-real-time phase.

#### 3.2. Near real-time coordination

##### 3.2.1. Minimum deviations from commitments

In real-time, the objective of both households and the coordinator is to remain as close as possible to the day-ahead commitments. From the overall power system perspective, this reduces the need for power/energy reserve in order to enhance stability, which can then be retributed. In near-real-time, the households are subject to actual values of their electrical load and solar generation (if any). Also, actual values of ambient temperature impact the HVAC cooling/heating power. Thus, it is necessary to adapt the controls scheduled in the day-ahead phase in order to better stick to the commitments. Similar to the day-ahead, the near-real-time coordination relies on ADMM. The main difference is that there is no look-ahead optimization – i.e. the decisions are taken along a single time step of 5 min duration (i.e. the temporal set $T$ is a singleton). The households’ objective, denoted $f_n^{rt}$, is to arbitrate between the deviation on the committed grid power $p_{n,t}^{gd^*}$ and the targeted state of charge $soc_{n,t}^*$ of the storage (if any). The underlying idea is not to overstress the storage to mitigate all the uncertainties at every time step at the risk of being unable to smooth the overall grid profile along the daily horizon (the primary objective of the day-ahead schedule). One potential approach, similar to Ref. [17], would be to account for a tolerance bandwidth around the committed grid power profiles and use it to correct any deviations in the state of charge. Here, the arbitrage is directly represented in the users’ objective $f_n^{rt}$ with a trade-off coefficient $\alpha^{rt}$ as in Eq. (21) with a weighted sum of the normalized power and state of charge deviations. A further sensitivity analysis of that coefficient value will be further discussed in the results section. The individual optimization accounts for all the household constraints presented previously and with the 5-min resolution model of the HVAC system. Also, the initial state of charge and zone temperature considered in the models are the actual measurements at the corresponding time step.

$$ f_n^{rt}(\mathbf{x}_{n,t}) = \alpha^{rt} \times \left( \frac{p_{n,t}^{gd} - p_{n,t}^{gd^*}}{\max(1, |p_{n,t}^{gd^*}|)} \right)^2 + (1 - \alpha^{rt}) \times \left( \frac{soc_{n,t} - soc_{n,t}^*}{100} \right)^2 \quad (21) $$

From the coordinator’s perspective, the near-real-time objective $F^{rt}$ is to minimize the distance to the commitment on the aggregated power profile when updating the consensus variables following Eq. (22). As for the scheduling phase, the coordination algorithm stops when there is no significant improvement of the global objective from one iteration to the next.

$$ F^{rt} \left( \bar{p}_{n,t}^{gd} \right) = \left( \sum_{n \in N} \bar{p}_{n,t}^{gd} - \sum_{n \in N} p_{n,t}^{gd^*} \right)^2 \quad (22) $$

##### 3.2.2. Online tuning of the simplified thermal model

Once the actual controls (i.e. $p_{n,t}^{bat+}$, $p_{n,t}^{bat-}$, $T_{n,t}^*$) are computed, they are sent to the household equipment, and especially to the HVAC system represented in the simulations with the reference original model. Recall
<figure><img src="image_5.png" /><figcaption>Fig. 2. Flowchart of the proposed methodology.</figcaption></figure>

that the decisions taken in near real-time then rely on an approximation of the thermal behavior at 5-min resolution to assess the HVAC cooling/heating power – denoted $\tilde{p}_t^h$ and $\tilde{p}_t^c$. Once the controls, i.e. the temperature setpoints, are sent to the actual systems, the observed powers may then differ from the predicted values. As detailed in Ref. [17], the observed deviations between the predicted and actual HVAC power can be used to refine the near-real-time model, reducing the error from more than 50 % to only 4 %. In this paper, a distinction is made between the deviations when the HVAC operates in cooling or heating mode Eq. (23). The original 5-min resolution models in Eq. (2) are then updated following Eq. (24). These updated equations will then be used in the MPC optimization at the household level at the next time step.

$$ \left\{ \begin{array}{l} e_{n,t}^c = e_{n,t-1}^c + (p_{n,t}^c - \tilde{p}_{n,t}^c) \times u_{n,t}^c \\ e_{n,t}^h = e_{n,t-1}^h + (p_{n,t}^h - \tilde{p}_{n,t}^h) \times (1 - u_{n,t}^c) \end{array} \right. \quad \forall (n,t) \in \{N, T\} \qquad (23) $$

$$ \left\{ \begin{array}{l} p_{n,t}^{c5} \leftarrow p_{n,t}^{c5} + e_{n,t}^{c} \\ p_{n,t}^{h5} \leftarrow p_{n,t}^{h5} + e_{n,t}^{c} \end{array} \right. \qquad (24) $$

### 3.3. Post delivery revenue distribution

#### 3.3.1. Baselining and performance criteria

Once the community is managed with the two-stage strategy introduced in the previous sections, the actual grid power for all houses ($p_{n,t}^{gd}$) are known over time. As the study is based on simulations, it is also possible to assess the individual power profiles for a theoretical baseline case in which every household would be controlled individually. For the sake of consistency, the baseline considers the previous two-stage management at the individual level (i.e. no coordination) with:

i) A look-ahead bill minimization (Eq. (19)) following the 30 min constraints in Section 2. The output is an individual power profile over the next day $p_{n,t}^{gd0}$ (index 0 to denote the baseline).

ii) Near-real-time controls are then computed similarly to Eq. (21) before being sent to the accurate building model. The final output is the actual grid power over time $p_{n,t}^{gd0}$ for the baseline.

On a monthly basis, it is then possible to compute the individual bill for every household, as in Eq. (19), for both the baseline case (i.e. $B_n^0$ computed with $p_{n,t}^{gd0}$) and after coordinated management (i.e. $B_n$ computed with $p_{n,t}^{gd}$). This allows to compute the overall monthly bill
increase (or decrease) the users could expect while joining a community with the proposed coordination scheme. On the aggregator side, two performance criteria are considered in line with the two-stage management proposed (Eq. (25)). The first index $P2$ relates to the objective of the first optimization that aims at smoothing the overall power profile $P_t$ at the community level. This overall profile is the summation of the individual household grid power after the coordinated management (i.e.

$P_t = \sum_n p_{n,t}^{gd})$. Similarly, the baseline value $P2^o$ can be assessed considering the baseline household power (i.e. $P_t = \sum_n p_{n,t}^{gd0}$). The second index $Edev$ accounts for the real-time deviations of $P_t$ from the profiles committed on the day ahead basis $P_t^* = \sum_n p_{n,t}^{gd*}$. It is simply a summation of the energy within the deviations. Similarly to the first index, the baseline value for that criteria $Edev^0$ can be assessed while considering the baseline commitment (i.e. $P_t^* = \sum_n p_{n,t}^{gd0*}$) and actual values (i.e. $P_t = \sum_n p_{n,t}^{gd0}$).

$$P2 = \sum_{t \in T} (P_t \times dt)^2 \quad \text{and} \quad Edev = \sum_{t \in T} |P_t - P_t^*| \times dt \qquad (25)$$

### 3.3.2. Cost/benefit allocation and fairness

Once the baseline and final households' bills are available, it is possible to estimate the potential cost increase for the users over a month – overall cost increase $C^{tot}$ in Eq. (26). At the same time, at the aggregator level, any improvement in the two metrics considered can lead to an income. A smoother community power profile relates to a remuneration homogeneous to a marginal cost of energy $c^{P2}$ (in €/kWh$^2$). The deviation criteria can be associated with a cost for reserve $c^{Edev}$ (in €/kWh). The total income $I^{tot}$ over a month corresponds to a lesser cost for transactions with the wholesale energy ($I^{P2}$) and reserve ($I^{Edev}$) markets and can be estimated following Eq. (27).

$$C^{tot} = \sum_{n \in N} B_n - \sum_{n \in N} B_n^0 \qquad (26)$$

$$I^{tot} = I^{P2} + I^{Edev} = c^{P2} \times (P2^0 - P2) + c^{Edev} \times (Edev^0 - Edev) \qquad (27)$$

The community is deemed profitable whenever the aggregator income is greater than the additional cost incurred by the users. The overall community then displays a typical Stackelberg game structure – leaders/followers with distinct objectives [26]. The question arises on how to fairly distribute the income among the users relative to their contribution to the community performances. One typical approach deriving from game theory is to consider the Shapley value [31]. It allows to distribution of the gains among the players while computing their marginal contribution to the overall objective(s). The contribution for every player $\Phi_n$ is computed as the average performance improvement allowed by every player $n$ when considering its participation or not to any coalition $S$ (i.e. a subset of the entire set of $N$ players) as in Eq. (28). The first term enumerates all the coalitions in which the player $n$ can participate (coalitions of different sizes $|S|$ - a single player, two players, three, etc). The term $(v(S \cup \{n\}) - v(S))$ denotes the marginal contribution of player $n$ to a coalition $S$ relative to an objective value $v$. In the considered case study, two objectives are leading to two distinct Shapley values per player - i.e. $\phi_n^{P2}$ and $\phi_n^{Edev}$ computed with Eq. (25) and considering different sets of power profiles. When a player $n$ is part of a coalition, the coalition performances for the two criteria are computed with the actual power $P_t$ and reference power $P_t^*$ accounting for the player's profile (Eq. (29)). When assessing the performance value of the coalition without the player's contributions, its baseline power profiles and references are considered and added to the ones from the other players in the coalition as in Eq. (30). Ultimately, the contribution of each player to the community performances ($\phi_n^{P2}$ and $\phi_n^{P2}$) is estimated

by its relative Shapley value relative to the sum of all the contributions – taken negatively, as the lesser the values for the performance criteria $P2$ and $Edev$, the greater the profit for the community (Eq. (31)). The fairest distribution then consists of computing the users' income while allocating the revenue from each performance criterion proportionally to its contribution to it (Eq. (32)).

$$\phi_n = \sum_{S \subseteq N \setminus \{n\}} \frac{|S|! (|N| - |S| - 1)!}{|N|!} \times (v(S \cup \{n\}) - v(S)) \qquad (28)$$

$$S \cup \{n\} \rightarrow P_t = \sum_{i \in S} p_{i,t}^{gd} + p_{n,t}^{gd} \quad \text{and} \quad P_t^* = \sum_{i \in S} p_{i,t}^{gd*} + p_{n,t}^{gd*} \qquad (29)$$

$$S \rightarrow P_t = \sum_{i \in S} p_{i,t}^{gd} + p_{n,t}^{gd0} \quad \text{and} \quad P_t^* = \sum_{i \in S} p_{i,t}^{gd*} + p_{n,t}^{gd0*} \qquad (30)$$

$$\beta_n^{P2} = \frac{-\phi_n^{P2}}{\sum_{n \in N} -\phi_n^{P2}} \quad \text{and} \quad \beta_n^{Edev} = \frac{-\phi_n^{Edev}}{\sum_{n \in N} -\phi_n^{Edev}} \qquad (31)$$

$$I_n = \beta_n^{P2} \times I^{P2} + \beta_n^{Edev} \times I^{Edev} \qquad (32)$$

## 4. Obtained results

### 4.1. Simulation setup

For the sake of results explainability and to limit the computational time, the simulated community simply consists of four households – i.e. residential load profiles taken from Ref. [54], and weather data (solar radiation and outdoor temperature) from Ref. [55]. Please note that these data are not geographically aligned. This was chosen due to the need for fine time resolution (5 min here) over long periods of time, without considering electricity demand for cooling/heating (estimated using an HVAC model here), and because no other data sources were available for the same location. While this setup is not realistic, it is deemed sufficient to assess the feasibility of the proposed control scheme, which targets technical criteria that can be replicated in any power system (power smoothing and minimum deviation from commitments). In order to better highlight different types of contributions in the community, the households display different setups in terms of installed DER:

* User 1: 3 kWp solar generator and 3 kW/3 kWh storage.

* User 2: 3 kWp solar generator.

* User 3: no DER installed.

* User 4: 3 kW/3 kWh storage.

Charging/discharging efficiency for the storage is set to 0.9 with an allowed state of charge between 0 % and 100 % In addition to the installed storage, another degree of flexibility arises with the HVAC control with a reference indoor temperature setpoints at 23 °C and an allowed margin of ±2 °C. Finally, time-of-use prices (three levels between 0.3 and 0.9 €/kWh in Ref. [56]) are considered for the user's purchased energy, along with a fixed feed-in tariff of 0.1 €/kWh whenever a surplus of local generation is injected into the grid. Simulations are performed for a summer month (June), with successive daily operations, while tracking the storage state of charge and indoor temperature from one day to the next (final/initial values). All optimization problems at both user and coordinator levels are implemented in YALMIP [57] and solved with Gurobi. The computational time for a community of 4 users remains acceptable with around 1 h to simulate one month (Intel i5, 1.3 GHz, 16 Go RAM). Most of the computational time is dedicated to the near-real time phase – i.e. successive optimizations for coordination purposes every 5 min. Also computing is not parallelized and at every iteration of the ADMM, optimizations over the different houses are run successively. The main motivation for considering four

<footnote n="2">2 https://transparency.entsoe.eu/.</footnote>
<figure><img src="image_6.png" /><figcaption>**Fig. 3.** Sample results of the look-ahead phase along ADMM iterations – a) aggregated community power profile over time – b) coordinator and users objectives increase/decrease.</figcaption></figure>

users only, beyond an acceptable computational time, was the opportunity to facilitate the results analysis for different types of members (depending on the installed solar and/or storage system behind their meter. Finally, note that in the look-ahead phase, forecasts for load, solar radiation, and outdoor temperature are based on a “backcasting” or “recurrent” method - i.e. the look-ahead forecast for D at a 30 min resolution corresponds to the actual values for day D-1 at 5 min resolutions resampled. The impact of prediction quality on the results is deemed outside the scope of the study and was performed in a previous study by the authors in the course of the same project [17].

## 4.2. Day-ahead scheduling results

For validation and clarity purposes, a first simulation is performed on a daily horizon. Fig. 3 displays the results of the look-ahead phase with the coordination based on load and generation forecasts. In case of no coordination - i.e., the first iteration of the ADMM, the overall community profile predicted $P_t$ displays a consumption peak early morning. This is due to the battery charge of user 4, not being displayed here to preserve clarity and synthetic results. Running the ADMM allows convergence to a smoother profile along the iterations (Fig. 3a), which will then be considered as the committed community profile in near-real-time operations ($P'_t$). At the same time, the global objective of the coordinator (smoothness $F^{da}$) obviously improves along iterations, and the ADMM stops when the difference between two successive iterations is negligible. However, this coordination leads to end-users that deviate from their individual optimum – i.e. their lowest energy bill predicted for the next day (Fig. 3b).

Details of the results with and without coordination for both users' and coordinator objectives are presented in Table 4. The coordination allows a significant improvement with a much smoother community power profile. This incurs an expected bill increase only for users 1 and 4, which display the biggest flexibility capacity due to their storage. Ultimately, the coordination leads to an overall bill increase of 4.53 € (+18 %) to allow a 46 % decrease in the smoothing objective. As further discussed, the valuation of that decrease will impact the community

<caption>**Table 4**</caption>

Look ahead results with and without coordination.

<table><thead><tr><th></th><th>User 1<br>$f^{da}$ (€)</th><th>User 2<br>$f^{da}$ (€)</th><th>User 3<br>$f^{da}$ (€)</th><th>User 4<br>$f^{da}$ (€)</th><th>Coordinator<br>$F^{da}$ (kWh<sup>2</sup>)</th></tr></thead><tbody><tr><td>Without coordination</td><td>2.15</td><td>5.74</td><td>7.44</td><td>9.08</td><td>P2<sup>*</sup> = 70.99</td></tr><tr><td>With coordination</td><td>3.80</td><td>5.74</td><td>7.44</td><td>11.96</td><td>P2<sup>*</sup> = 38.21</td></tr></tbody></table>

profitability and users' interest in joining the coordination. At this stage, before the actual control with real-time adaptation, the smoothing objective of the baseline case with no coordination can be denoted $P2^{*}$, and the expected one after ADMM is noted as $P2^{*}$.

## 4.3. Near real-time control

### 4.3.1. Daily results

Similar to the look-ahead phase, the near-real-time control is run at first on a single day for validation purposes for both the baseline case (i. e. individual optimizations) and the proposed coordinated management. Results at the community level, in terms of aggregated power, are displayed in Fig. 4 with and without real-time correction of the controls. In the latter case, the setpoints for battery charge/discharge and zone temperature directly derive from the look-ahead results – for both baseline and coordinated cases. As already mentioned in the previous subsections, the reference power profiles to follow are much smoother in the coordinated case than in the baseline scenario. In addition, the individual uncoordinated near-real-time correction does not allow for mitigating the uncertainties efficiently in the baseline case. As shown in Fig. 4a, the correction of the controls does not allow to remain much closer to the reference profile. On the contrary, in the coordinated case of Fig. 4b, the correction is effective at least for the first half of the day. The flexibilities in terms of storage and temperature setpoints are depleted during the afternoon, before being efficient again after 6 p.m.

Results in Table 5 quantitatively illustrate the aforementioned tendencies, with the energy deviations in comparison to the baseline profile being much more reduced thanks to real-time correction in the coordinated case (Edev: 27.52 kWh → 10.72 kWh) than in the baseline scenario (Edev⁰: 27.55 kWh → 23.58 kWh). It is worth noting that in all cases, the values of the final criteria $P2$ differ from the one predicted in the look-ahead phase ($P2^{*0}$ and $P2^{*}$) due to the obvious impossibility of mitigating all the uncertainties. Ultimately, the best results for the two considered metrics are obtained with the proposed coordinated management. Baseline values $P2^{*}$ and $Edev⁰$ (over a month) with real-time corrections will be considered for revenue distribution in the next subsection.

At this stage, it is possible to detail the results obtained at the household level in terms of generation, load, storage, and HVAC power, while highlighting the difference between the baseline and coordinated cases. However, to limit the analysis and preserve the paper's clarity, a simple set of complementary results is displayed in Fig. 5 for user 1 (with solar ad storage). Without coordination, the user tends to better follow its reference grid power profile. In the case of coordination, the correction does not strictly follow its reference due to the incentive to potentially compensate for the deviations of other user(s). Obviously, as displayed in Fig. 6, the near-real-time correction leads to modified
<figure><img src="image_7.png" /><figcaption>Fig. 4. Community power profile with and without real-time correction of the controls – a) baseline without coordination – b) with coordination.</figcaption></figure>

controls for the storage and temperature setpoints. Especially, for the simulated day, the heating setpoint decreases significantly in the afternoon in order to increase the load demand (from the HVA) to compensate for a potential surplus of generation that was not predicted in the look-ahead phase (Fig. 6b).

### 4.3.2. Impact of control settings

The near-real-time control can be tuned with the trade-off coefficient $\alpha^{rt}$ – arbitrage between the deviations in the grid power and the state of the charge profile. Following (21), a greater $\alpha^{rt}$ gives priority to committing to the reference profile, at the risk of overusing the storage and potentially depleting it for later use. The impact of different values of $\alpha^{rt}$ is illustrated in Fig. 7 for the same day previously simulated for user 1. Although differences are not obvious, it can be noted that the smaller value leads to better commitment to the state of charge value (Fig. 7a) at the cost of potentially greater deviations in terms of individual commitment to the power profile (Fig. 7b). However, this may allow the battery to be more available for further deviation compensation at the community level. As proof for the single-day simulated, the Edev metric increase by around 20 % compared to the previous simulation – i.e. Edev = 10.72 for $\alpha^{rt} = 0.01$ and Edev = 12.51 for $\alpha^{rt} = 0.5$.

### Table 5

Results after real-time operations with and baseline without coordination/with and without adaptation of the controls.

<table><thead><tr><th rowspan="2"></th><th colspan="2">Without real-time correction</th><th colspan="2">With real-time correction</th></tr><tr><th>P2 (kWh<sup>2</sup>)</th><th>Edev (kWh)</th><th>P2 (kWh<sup>2</sup>)</th><th>Edev (kWh)</th></tr></thead><tbody><tr><td>Without coordination</td><td>P2° = 68.07</td><td>Edev° = 27.55</td><td>P2° = 69.78</td><td>Edev° = 23.58</td></tr><tr><td>With coordination</td><td>P2 = 41.26</td><td>Edev = 27.52</td><td>P2 = 36.65</td><td>Edev = 10.72</td></tr></tbody></table>

In order to appropriately tune the value of $\alpha^{rt}$ with more rigorous results, an additional set of simulations is performed over ten different days. In every case, the control performances P2 and Edev are computed with values that obviously differ for the different days simulated. Fig. 8 illustrates the relative metrics increase relative to the lowest value observed over ten daily simulations. As could be expected, the real-time control setting has much more impact on the deviation metric Edev than on P2 (ratio 1 to 10). However, its impact on the community power smoothing is far from negligible. For both P2 and Edev, the smallest increase – i.e., the best solutions for every day – is obtained on average for $\alpha^{rt} = 0.01$.

## 4.4. Monthly revenue distribution

### 4.4.1. Monthly simulations

In this section, the revenue distribution within the community is discussed, starting from a month-duration simulation – while running the management over successive days. Similar to the previous observation for a daily scenario, results over a month show that both community metrics P2 and Edev are systematically improved compared to the baseline without coordination (Fig. 9).

Table 6 displays the monthly results for both the users (i.e. energy bill $B_n$) and the community (i.e. power smoothing P2 and energy deviation Edev). Users 1 and 4 with energy storages face the highest cost increase (+20 %) compared to the baseline due to significant deviations from their optimal behaviours – i.e. charge/discharge to absorb/compensate a potential community surplus/deficit of energy. On the contrary, the bill difference for users 2 and 3 remains marginal (1 %). User 2 even benefits from being part of the coordination while displaying a slightly lower monthly bill. Note that in the near real-time phase (in both coordinated or uncoordinated cases), the objective is to stick to the look-ahead commitments – not to minimize the bill. Also,

<figure><img src="image_8.png" /><figcaption>Fig. 5. Grid power of user 1 after real-time correction – a) baseline without coordination – b) with coordination.</figcaption></figure>
<figure><img src="image_9.png" /><figcaption>Fig. 6. Profiles for user 1 after the look-ahead and near real-time phases, with coordination – a) state of charge – b) temperature setpoint.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>Fig. 7. Results after near real-time correction for different $\alpha^t$ for user 1 – a) grids power – b) state of charge.</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>Fig. 8. Distribution of the impact of $\alpha^t$ on the control performances over 10 daily simulations – a) relative increase of metric P2 relatively to the lowest value observed – b) relative increase of metric Edev relatively to the lowest value observed.</figcaption></figure>

user 2 does not have a storage installed, and its only sources of flexibility lies on the HVAC control. The results suggest that in the coordinated cases, user 2 is incentivized to reduce his load (i.e. increase its temperature setpoint in cooling mode) in order to absorb a potential surplus of community generation that was not predicted accurately in the look-ahead phase. The overall bill for the simulated month ultimately increases by 10%. On the community side, the coordination significantly improves the performance metrics with a much smoother power profile and fewer deviations around the look-ahead commitments. Note that this decrease in terms of energy deviations is allowed thanks to the coordinated flexibilities in the community but also from the natural spread effect with the aggregation of several users – i.e. with different electrical load profiles, real-time uncertainties relative to the look-ahead profiles can be mitigated to some extent as they do not occur concomitantly and simultaneously over all the users.

### 4.4.2. Community profitability

As already mentioned, the improvement of the technical metrics can be translated to a revenue stream at the community level, while considering a wholesale marginal cost of energy $c^{P2}$ (in €/kWh$^2$) and a cost for reserve $c^{Edev}$ (in €/kWh) ((27)). From the values commented in the previous subsection, the community can be deemed profitable if this total revenue $I^{tot}$ covers the overall bill increase – $C^{tot} = 81$ € here. Following the strategy presented in section 3.3, that income can then be split between the users ($I_n$) respectively to their contribution to the metrics improvements ((32)). The values of those distribution coefficients for the simulated month and the considered baseline are given in Table 7. Users 1 and 4 display higher flexible capabilities, and their contribution to both metrics improvements is very significant – greater values for user 4 are due to its higher consumption level. Thanks to the spread effect in terms of uncertainties, the contribution of both users 2
<figure><img src="image_12.png" /><figcaption>Fig. 9. Community technical performances with and without coordination – a) power smoothness – b) energy deviations.</figcaption></figure>

<table><caption>**Table 6**
Monthly (June) results at the users' and community level.</caption><thead><tr><th rowspan="2"></th><th colspan="3">User 1</th><th colspan="3">User 4</th><th colspan="3">Community Metrics</th></tr><tr><th>bill (€)</th><th>bill (€)</th><th>bill (€)</th><th>bill (€)</th><th>bill (€)</th><th>bill (€)</th><th>(kWh<sup>2</sup>)</th><th>(kWh)</th><th>(kWh)</th></tr></thead><tbody><tr><td>Without coordination</td><td>65.0</td><td>142.5</td><td>295.9</td><td>357.1</td><td>860.6</td><td></td><td>P2<sup>a</sup> = 2154</td><td>Edev<sup>0</sup> = 760</td><td></td></tr><tr><td>With coordination</td><td>78.3</td><td>140.86</td><td>299.4</td><td>423.6</td><td>942.2</td><td></td><td>P2 = 1385</td><td>Edev = 344</td><td></td></tr><tr><td>Difference</td><td>+20 %</td><td>-1 %</td><td>+1 %</td><td>+19 %</td><td>+10 %</td><td></td><td>-35 %</td><td>-55 %</td><td></td></tr></tbody></table>

and 3 for the energy deviations improvement is not negligible.

Along with the profitability, the community is deemed fair if a distribution of the revenues relative to those coefficients allows each participant to cover their bill increase. Ultimately, the community profitability and fairness depend on $c^{P2}$ and $c^{Edev}$ values, as depicted in Fig. 10. As already mentioned, user 2 benefits from participating in the coordination with a monthly bill slightly reduced – i.e. the user is profitable no matter the marginal energy price increase and reserve price. As already mentioned, the community is profitable for any setup of $c^{P2}$ and $c^{Edev}$ that allows to compensate for the overall bill increase on the users' side. However, if the revenues need to be fairly split, reserve and marginal energy prices need to increase so that all the users are individually profitable. The considered community and simulated month ultimately leads to the domain highlighted in the upper right part of Fig. 10.

# 5. Discussions

## 5.1. Valorisation of technical criteria improvement

The paper is built on two previous studies by the same author. In particular [47], assessed the scalability of coordinated control with up to a hundred households, while [17] investigated the impact of forecast accuracy (for load and generation) on the performances of two-stage building management. Here, the main novelty is the revenue distribution scheme to identify in which energetic/economic landscape the proposed coordination will be profitable. The originality also lies in the consideration of technical criteria at the community level (power system

<figure><img src="image_13.png" /><figcaption>Fig. 10. Community profitability and fairness regarding the energy market environment.</figcaption></figure>

technical metrics) beyond economic concerns. Indeed, if the users target a traditional bill minimization of their energy bill, at the community level, the overall performances are assessed with the ability of the system $i$) to smooth the overall community power usage and $ii$) to minimize deviations from committed profiles in real-time operations. The motivation for those services is to improve the integration of distributed energy resources in legacy power with reduced needs for peak generation (e.g. costly/carbon-intensive units) and less requirements for energy reserve for balancing purposes. Also, remaining on the technical side allows to consider the system performances indiscriminately from the economic/regulatory landscape. However, as mentioned, the post-delivery reward scheme proposed allow to assess the contribution of every user to the technical criteria considered. This can then be turned into economic profit for the users while relating the technical metrics to

<table><caption>**Table 7**
Revenue distribution coefficients for the simulated month.</caption><thead><tr><th></th><th>User 1</th><th>User 2</th><th>User 3</th><th>User 4</th></tr></thead><tbody><tr><td>Sharing P2 profits - β<sup>P2</sup><sub>n</sub></td><td>14.5 %</td><td>0.6 %</td><td>1.5 %</td><td>83.4 %</td></tr><tr><td>Sharing Edev profits - β<sup>Edev</sup><sub>n</sub></td><td>29.1 %</td><td>5.3 %</td><td>7.2 %</td><td>58.4 %</td></tr></tbody></table>
peak energy prices $c^{P2}$ (for smoothing criteria), and reserve prices $c^{Edev}$ (for the near real-time deviation criteria), the profitably and fairness depends not only on the marginal energy prices and reserve price. If $c^{Edev}$ is easily derived from the price for reserve on wholesale energy markets data, $c^{P2}$ is not straightforward. As illustrated in Fig. 11, this cost in €/kWh² can be interpreted as the electricity price variation relative to the power demand differences. Greater values correspond to steeper slopes, as is the case in Singapore in comparison to the French system in the example, due to higher price volatility. $c^{P2}$ value can be derived from the interpolation slopes of Fig. 11 scaled with the power/price value in the community - e.g. 2.7 kW average load and 60 c€/kWh average retail prices. With those assumptions, for both illustrative French and Singaporean data, the prices allow the simulated community to be profitable and fair according to the abacus in Fig. 10. That analysis is a first (small) step in order to define regulatory landscapes and tariff design to reward the new services introduced in the paper but a full policy design is beyond the primary scope of this paper.²³

- France: $c^{P2} = 47 \text{ c€/kWh}^2$ and $c^{Edev} = 10 \text{ c€/kWh}$

- Singapore: $c^{P2} = 92 \text{ c€/kWh}^2$ and $c^{Edev} = 1 \text{ c€/kWh}$

A shortcoming of the proposed approach is the need for a baseline case in order to compute the individual contribution of the users. It is done here with a posteriori optimization, assuming that the users' model equations and load/generation profiles can be assessed by a third party (e.g. a community manager as in Ref. [31]). This may not be realistic for practical implementation and to preserve privacy by design. Hence, an alternative approach could consist of relating the expected contribution of the users with their static parameters such as installed DER capacities, load level, HVAC settings, etc, which is deemed outside the scope of the paper, similar to sizing/planning concerns. Finally note that the mechanisms that incentivize the users to join a community and be operated to provide system services (power smoothing and minimum energy deviation here) are not discussed into details in terms of practical implementation. The main driver mentioned in the paper is the revenues the users could expect when joining the community.

## 5.2. Impact of simulated periods

At first order, the results depend on the profiles for household consumption and potential solar generation, which in turn depend on the month in question. This subsection then discusses monthly simulations for other seasons (February, September and December). Fig. 12a shows

<figure><img src="image_14.png" /><figcaption>Fig. 11. Electricity price Vs Electrical demand – normalized variation around the average values.</figcaption></figure>

the monthly discrepancies in solar generation and electricity consumption (i.e. electrical appliances and the HVAC system) at community level, based on an aggregate of the four simulated households. Clearly, more energy is generated in summer, while a significant increase in consumption is observed in December due to the lower mean ambient temperature (heating systems). More interestingly, Fig. 12b displays the corresponding improvements in terms of the decrease in technical criteria from an uncoordinated case ($P2$ for community power smoothing and $Edev$ for energy deviation from the schedule). Overall, $P2$ improves more when the ratio of energy produced to consumed increases (in June and September), as more advantage can be taken from storage charge/discharge arbitrage. The improvement in terms of energy deviations is more consistent throughout the year, as forecast uncertainty and real-time profile volatility are independent of the level of energy procured/consumed.

Similar to the monthly results detailed in Table 6, it is worth noting that improvements in technical metrics come at the cost of an increased energy bill at community level. The greater the decrease in technical metrics, the greater the increase in bills, which is why the discussions relating to the valorisation of technical criteria improvement were held in the previous section.

## 5.3. Impact of energy prices

The retail energy prices are an important hypothesis in the paper and a main input parameters in the simulations carried out. The original rates tested previous [56] display a big spread with seven-slots time of use rates. This implies that end-users can benefit greatly from price arbitrage while controlling their flexibility (i.e. storage and HVAC system here). With such a pricing structure, any control measures implemented at community level may lead to suboptimal solutions at household level, as illustrated by the monthly results (Table 6 and Fig. 12). However, the absolute values of the bills and their increase in a 'community' case depend on the retail rates and their structure. As illustrative examples, two additional setups for retail purchase prices closer to the European context are considered below<fnref n="4" />:

- Peak/off-peak: 0.18 €/kWh from 10 p.m. to 6 a.m. and 0.25 €/kWh otherwise.

- Peak/off-peak and a capacity price of 1.2 €/kW/day.

The results obtained are summarized in Table 8 alongside the original values observed with the original price setup. With lower rates (i.e. the Peak/Off-peak scenario), user bills decrease significantly in absolute value (here, divided by three). However, with only two price periods instead of seven, users benefit less from energy arbitrage over the simulated period. Being coordinated does not increase their bill by much compared to an ideal scenario (4 % instead of 10 %). It is also worth noting that fewer opportunities for price arbitrage lead to less volatile power profiles and implicitly improve 'power smoothing' while optimizing at the household scale (i.e. 1957 kWh² without coordination). This effect is even more significant when a capacity rate is introduced to the individual bill (i.e. $P2$ of 1732 kWh² without coordination). In such a case, the individual objective tends to align with the targeted community criteria, and the improvement decreases when coordinating users (–21 %). As in the previous subsection, it is worth noting that energy deviation values remain consistent across the simulated cases. Indeed, the real-time profiles of volatility and the quality of predictions are independent of the price scenarios. Also, improvements in energy deviation are primarily linked to the flexibility capabilities of the simulated setup.

<footnote n="3">³ https://www.home.emcsg.com/.</footnote>

<footnote n="4">⁴ https://particulier.edf.fr/content/dam/2-Actifs/Documents/Offres/Grille_prix_Tarif_Bleu.pdf.</footnote>
<figure><img src="image_15.png" /><figcaption>Fig. 12. Monthly simulations – a) energy produced/consumed and mean ambient temperature – b) technical criteria improvement (decrease of P2 and Edev) and community bill increase from uncoordinated case.</figcaption></figure>

<table><caption>**Table 8**

Monthly (June) results for different energy prices.</caption><thead><tr><th rowspan="2"></th><th colspan="3">Previous Time of Use Prices</th><th colspan="3">Peak/Off-peak</th><th colspan="3">Peak/Off-peak + capacity</th></tr><tr><th>Bill (€)</th><th>P2 (kWh<sup>2</sup>)</th><th>Edev (kWh)</th><th>Bill (€)</th><th>P2 (kWh<sup>2</sup>)</th><th>Edev (kWh)</th><th>Bill (€)</th><th>P2 (kWh<sup>2</sup>)</th><th>Edev (kWh)</th></tr></thead><tbody><tr><td>Without coordination</td><td>860.6</td><td>2154</td><td>760</td><td>312.2</td><td>1957</td><td>761</td><td>621.6</td><td>1762</td><td>751</td></tr><tr><td>With coordination</td><td>942.2</td><td>1385</td><td>344</td><td>323.9</td><td>1386</td><td>342</td><td>661.5</td><td>1385</td><td>342</td></tr><tr><td>Difference</td><td>+ 10 %</td><td>-35 %</td><td>-55 %</td><td>+ 4 %</td><td>-29 %</td><td>-55 %</td><td>+ 6 %</td><td>-21 %</td><td>-54 %</td></tr></tbody></table>

## 6. Conclusions

In this manuscript, a two-stage energy management was proposed to coordinate users within a residential multi-energy community with HVAC controls, renewables, and energy storage. The setup displays a typical Stackelberg game structure, widely adopted for that class of decentralized problem with consideration of both community and users' objectives. The originality is that technical criteria are considered at the community level, with the need to smooth the overall profile and mitigate deviations around a look-ahead commitment. From the power system perspective, this leads to higher efficiency and better resilience with reduced reserve requirements. The coordination is implemented with an ADMM algorithm for both look-ahead and real-time phases, with an ultimate improvement of the technical metrics – 55 % less reserve requirement and 35 % smoother profile over a monthly simulation. However, this causes the users to deviate from their cost-driven optimum with an overall bill increase of 10 %. In this paper, a reward scheme for the users is proposed based on their marginal contribution to the technical metrics improvement. The cost increase can then be compensated by redistributing the revenue (savings) from the wholesale reserve and energy markets. The community size is kept limited on purpose to four users only to better analyze the results. Especially, different setups for the users are considered in order to assess their impact on the technical criteria considered. Immediate future works shall then consist of scalability tests. Especially, investigation on the number of users may lead to the definition of critical size of the community – e.g. easier reduction of energy deviation in real-time thanks to the spread effect after a given number of users. Along a similar research axis, the sensitivity of the installed renewable and storage capacities will also be of interest. Finally, the next steps shall also focus on the definition of the baseline scenario from which the improvement of the technical metrics is computed. Indeed, in the actual deployment of the control scheme, a baseline without any control is not accessible any longer. In such cases, statistical approaches and measurement correction shall be investigated carefully and validated.

## CRediT authorship contribution statement

**Rémy Rigo-Mariani:** Writing – review & editing, Writing – original draft, Validation, Supervision, Software, Project administration, Methodology, Investigation, Funding acquisition, Conceptualization. **Arif Ahmed:** Software, Data curation.

## 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.

## Acknowledgment

This work has been carried out in the framework of the INT2MEC project – INtelligent Multi-Energy Communities for enhanced distributed resources INtegration in Singapore (Seed Project ITS009-0019). The research is supported by the National Research Foundation, Prime Minister's Office, Singapore under its Campus for Research Excellence and Technological Enterprise (CREATE) program.

## Data availability

Data will be made available on request.

## References

[1] 'Renewables 2023 – analysis', IEA. Accessed: March. 5, 2024 [Online]. Available: https://www.iea.org/reports/renewables-2023.

[2] Vasiliev M, Nur-E-Alam M, Alameh K. Recent developments in solar energy-harvesting technologies for building integration and distributed energy generation. Energies Jan. 2019;12(6):1080. https://doi.org/10.3390/en12061080.

[3] Klingler A-L. Self-consumption with PV+Battery systems: a market diffusion model considering individual consumer behaviour and preferences. Appl Energy Nov. 2017;205:1560–70. https://doi.org/10.1016/j.apenergy.2017.08.159.

[4] Huy THB, Dinh HT, Kim D. Multi-objective framework for a home energy management system with the integration of solar energy and an electric vehicle
[5] using an augmented e-constraint method and lexicographic optimization. Sustain Cities Soc Jan. 2023;88:104289. https://doi.org/10.1016/j.scs.2022.104289.

[6] Sharma S, Verma A, Xu Y, Panigrahi BK. Robustly coordinated Bi-Level energy management of a multi-energy building under multiple uncertainties. IEEE Trans Sustain Energy Jan. 2021;12(1):3–13. https://doi.org/10.1109/TSTE.2019.2962826.

[7] Mir U, Abbasi U, Mir T, Kanwal S, Alamri S. Energy management in smart buildings and homes: current approaches, a hypothetical solution, and open issues and challenges. IEEE Access 2021;9:94132–48. https://doi.org/10.1109/ACCESS.2021.3092304.

[8] A home energy management system with an integrated smart thermostat for demand response in smart grids. Sustain Cities Soc Feb. 2021;65:102639. https://doi.org/10.1016/j.scs.2020.102639.

[9] Optimal scheduling of electrical and thermal resources and appliances in a smart home under uncertainty. Energy Dec. 2022;261:125292. https://doi.org/10.1016/j.energy.2022.125292.

[10] Dadashi-Rad MH, Ghasemi-Marzbali A, Ahangar RA. Modeling and planning of smart buildings energy in power system considering demand response. Energy Dec. 2020;213:118770. https://doi.org/10.1016/j.energy.2020.118770.

[11] Zupancić J, Filipić B, Gams M. Genetic-programming-based multi-objective optimization of strategies for home energy-management systems. Energy Jul. 2020; 203:117769. https://doi.org/10.1016/j.energy.2020.117769.

[12] Mansouri SA, Ahmarinejad A, Nematbakhsh E, Javadi MS, Jordehi AR, Catalão JPS. Energy management in microgrids including smart homes: a multi-objective approach. Sustain Cities Soc Jun. 2021;69:102852. https://doi.org/10.1016/j.scs.2021.102852.

[13] Zamanloo S, Askarian Abyaneh H, Nafisi H, Azimi M. Optimal two-level active and reactive energy management of residential appliances in smart homes. Sustain Cities Soc Aug. 2021;71:102972. https://doi.org/10.1016/j.scs.2021.102972.

[14] Sharma S, Xu Y, Verma A, Panigrahi BK. Time-coordinated multienergy management of smart buildings under uncertainties. IEEE Trans Ind Inf Aug. 2019; 15(8):4788–98. https://doi.org/10.1109/TII.2019.2901120.

[15] Gholamzadehmir M, Del Pero C, Buffa S, Fedrizzi R, Aste N. Adaptive-predictive control strategy for HVAC systems in smart buildings – a review. Sustain Cities Soc Dec. 2020;63:102480. https://doi.org/10.1016/j.scs.2020.102480.

[16] Aznavi S, Fajri P, Asrari A, Khazaei J. Two-stage energy management of smart homes in presence of intermittencies. In: 2019 IEEE transportation electrification conference and expo (ITEC); Jun. 2019. p. 1–5. https://doi.org/10.1109/ITEC.2019.8790479.

[17] Di Piazza MC, La Tona G, Luna M, Di Piazza A. A two-stage energy management system for smart buildings reducing the impact of demand uncertainty. Energy Build Mar. 2017;139:1–9. https://doi.org/10.1016/j.enbuild.2017.01.003.

[18] Rigo-Mariani R, Ahmed A. Smart home energy management with mitigation of power profile uncertainties and model errors. Energy Build Sep. 2023;294:113223. https://doi.org/10.1016/j.enbuild.2023.113223.

[19] Pinto G, Deltetto D, Capozzoli A. Data-driven district energy management with surrogate models and deep reinforcement learning. Appl Energy Dec. 2021;304: 117642. https://doi.org/10.1016/j.apenergy.2021.117642.

[20] Knudsen MD, Petersen S. Economic model predictive control of space heating and dynamic solar shading. Energy Build Feb. 2020;209:109661. https://doi.org/10.1016/j.enbuild.2019.109661.

[21] Wang D, Chen Y, Wang W, Gao C, Wang Z. Field test of model predictive control in residential buildings for utility cost savings. Energy Build Jun. 2023;288:113026. https://doi.org/10.1016/j.enbuild.2023.113026.

[22] Gomes ILR, Ruano MG, Ruano AE. MILP-based model predictive control for home energy management systems: a real case study in Algarve, Portugal. Energy Build Feb. 2023;281:112774. https://doi.org/10.1016/j.enbuild.2023.112774.

[23] Anvari-Moghaddam A, Monsef H, Rahimi-Kian A. Optimal smart home energy management considering energy saving and a comfortable lifestyle. IEEE Trans Smart Grid Jan. 2015;6(1):324–32. https://doi.org/10.1109/TSG.2014.2349352.

[24] Kim I, Kim W. Application of market-based control with thermal energy storage system for demand limiting and real-time pricing control. Energy Jan. 2023;263: 125579. https://doi.org/10.1016/j.energy.2022.125579.

[25] Ye Y, Qiu D, Wu X, Strbac G, Ward J. Model-free real-time autonomous control for a residential multi-energy system using deep reinforcement learning. IEEE Trans Smart Grid Jul. 2020;11(4):3068–82. https://doi.org/10.1109/TSG.2020.2976771.

[26] Gao Y, Li S, Fu X, Dong W, Lu B, Li Z. Energy management and demand response with intelligent learning for multi-thermal-zone buildings. Energy Nov. 2020;210: 118411. https://doi.org/10.1016/j.energy.2020.118411.

[27] Wang J, Li S, Chen H, Yuan Y, Huang Y. Data-driven model predictive control for building climate control: three case studies on different buildings. Build Environ Aug. 2019;160:106204. https://doi.org/10.1016/j.buildenv.2019.106204.

[28] de São José D, Faria P, Vale Z. Smart energy community: a systematic review with metanalysis. Energy Strategy Rev Jul. 2021;36:100678. https://doi.org/10.1016/j.esr.2021.100678.

[29] Cosic A, Stadler M, Mansoor M, Zellinger M. Mixed-integer linear programming based optimization strategies for renewable energy communities. Energy Dec. 2021;237:121559. https://doi.org/10.1016/j.energy.2021.121559.

[30] Fan G, et al. Energy management strategies and multi-objective optimization of a near-zero energy community energy supply system combined with hybrid energy storage. Sustain Cities Soc Aug. 2022;83:103970. https://doi.org/10.1016/j.scs.2022.103970.

[31] Jiang Q, et al. A Stackelberg Game-based planning approach for integrated community energy system considering multiple participants. Energy Nov. 2022; 258:124802. https://doi.org/10.1016/j.energy.2022.124802.

[32] Mustika AD, Rigo-Mariani R, Debusschere V, Pachurka A. A two-stage management strategy for the optimal operation and billing in an energy community with collective self-consumption. Appl Energy Mar. 2022;310:118484. https://doi.org/10.1016/j.apenergy.2021.118484.

[33] Aminlou A, Mohammadi-Ivatloo B, Zare K, Razzaghi R, Anvari-Moghaddam A. Activating demand side flexibility market in a fully decentralized P2P transactive energy trading framework using ADMM algorithm. Sustain Cities Soc Jan. 2024; 100:105021. https://doi.org/10.1016/j.scs.2023.105021.

[34] Goitia-Zabaleta N, Milo A, Gaztañaga H, Fernandez E. Two-stage centralised management of local energy market for prosumers integration in a community-based P2P. Appl Energy Oct. 2023;348:121552. https://doi.org/10.1016/j.apenergy.2023.121552.

[35] Gokcek T, Sengor I, Hayes BP, Erdinc O. A hierarchical approach for P2P energy trading considering community energy storage and PV-enriched system operator. IET Gener, Transm Distrib 2022;16(23):4738–49. https://doi.org/10.1049/gtd2.12636.

[36] Al-Sorour A, Fazeli M, Monfared M, Fahmy A, Searle JR, Lewis RP. Enhancing PV self-consumption within an energy community using MILP-based P2P trading. IEEE Access 2022;10:93760–72. https://doi.org/10.1109/ACCESS.2022.3202649.

[37] Faria AS, et al. P2P market coordination methodologies with distribution grid management. Sustainable Energy, Grids and Networks Jun. 2023;34:101075. https://doi.org/10.1016/j.segan.2023.101075.

[38] Bokkisam HR, Acharya RM, S Mp. Framework of transactive energy market pool for community energy trading and demand response management using an auction-theoretic approach. Int J Elect Power Energyst May 2022;137:107719. https://doi.org/10.1016/j.ijepes.2021.107719.

[39] Stephan M, Abbes D, Hassou-Ouari K, Labrunie A, Robyns B. Distributed optimization of energy profiles to improve photovoltaic self-consumption on a local energy community. Simulat Model Pract Theor Apr. 2021;108:102242. https://doi.org/10.1016/j.simpat.2020.102242.

[40] Tavares T, et al. Operation and simulation of a renewable energy community based on a local post-delivery pool market. In: 2023 19th international conference on the European energy market (EEM); Jun. 2023. p. 1–6. https://doi.org/10.1109/EEM58374.2023.10161761.

[41] Gasca M-V, Rigo-Mariani R, Debusschere V, Sidqi Y. Fairness in energy communities: centralized and decentralized frameworks. Renew Sustain Energy Rev Feb. 2025;208:115045. https://doi.org/10.1016/j.rser.2024.115045.

[42] Cremers S, Robu V, Hofman D, Naber T, Zheng K, Norbu S. Efficient methods for approximating the shapley value for asset sharing in energy communities. In: *Proceedings of the thirteenth ACM international conference on future energy systems*, in e-Energy '22. New York, NY, USA: Association for Computing Machinery; Jun. 2022. p. 320–4. https://doi.org/10.1145/3538637.3538861.

[43] Grzanić M, Morales JM, Pineda S, Capuder T. Electricity cost-sharing in energy communities under dynamic pricing and uncertainty. IEEE Access 2021;9: 30225–41. https://doi.org/10.1109/ACCESS.2021.3059476.

[44] Li Y, Wang B, Yang Z, Li J, Chen C. Hierarchical stochastic scheduling of multi- community integrated energy systems in uncertain environments via Stackelberg game. Appl Energy Feb. 2022;308:118392. https://doi.org/10.1016/j.apenergy.2022.118392.

[45] Mustika AD, Rigo-Mariani R, Debusschere V, Pachurka A. Self-consumption and frequency reserve provision with energy communities. IEEE Access 2023:1. https://doi.org/10.1109/ACCESS.2023.3301159. 1.

[46] Javadi MS, Gough M, Nezhad AE, Santos SF, Shafie-khah M, Catalão JPS. Pool trading model within a local energy community considering flexible loads, photovoltaic generation and energy storage systems. Sustain Cities Soc Apr. 2022; 79:103747. https://doi.org/10.1016/j.scs.2022.103747.

[47] Putratama MA, Rigo-Mariani R, Mustika AD, Debusschere V, Pachurka A, Bésanger Y. A three-stage strategy with settlement for an energy community management under grid constraints. IEEE Trans Smart Grid 2022:1. https://doi.org/10.1109/TSG.2022.3167862. 1.

[48] Rigo-Mariani R, Debusschere V. A two-stage coordination strategy for the control of distributed storage at the household level—Arbitrage between users preferences and distribution grid objectives. Math Comput Simulat Aug. 2023. https://doi.org/10.1016/j matcom.2023.08.033.

[49] Shongwe S, Hanif M. Comparative analysis of different single-diode PV modeling methods. IEEE J Photovoltaics May 2015;5(3):938–46. https://doi.org/10.1109/JPHOTOV.2015.2395137.

[50] Troitzsch S. kaiATtum, tomschelo, and arifa7med, Mesmo-dev/mesmo. Zenodo Nov. 11, 2021 [Online]. Available: https://zenodo.org/record/5674243. [Accessed 11 April 2023].

[51] Boyd S. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends® in Machine Learning 2010;3(1):1–122. https://doi.org/10.1561/2200000016.

[52] Etedadi Aliabadi F, Agbossou K, Kelouwani S, Henao N, Hosseini SS. Coordination of smart home energy management systems in neighborhood areas: a systematic review. IEEE Access 2021;9:36417–43. https://doi.org/10.1109/ACCESS.2021.3061995.

[53] Morstyn T, McCulloch MD. Multiclass energy management for peer-to-peer energy trading driven by prosumer preferences. IEEE Trans Power Syst Sep. 2019;34(5): 4005–14. https://doi.org/10.1109/TPWS.2018.2834472.

[54] Zhu J. Optimization of power system operation. John Wiley & Sons; 2015.

[55] Murray D, Stankovic L, Stankovic V. An electrical load measurements dataset of United Kingdom households from a two-year longitudinal study. Sci Data Jan. 2017;4(1):160122. https://doi.org/10.1038/sdata.2016.122.
[55] Diamond HJ, et al. U.S. climate reference network after one decade of operations: status and assessment. Bull Am Meteorol Soc Apr. 2013;94(4):485-98. https://doi.org/10.1175/BAMS-D-12-00170.1.

[56] Meng Q, Li Y, Ren X, Xiong C, Wang W, You J. A demand-response method to balance electric power-grids via HVAC systems using active energy-storage:

simulation and on-site experiment. Energy Rep Nov. 2021;7:762-77. https://doi.org/10.1016/j.egyr.2021.01.083.

[57] Lofberg J. Yalmip : a toolbox for modeling and optimization in MATLAB. In: 2004 IEEE international conference on robotics and automation. IEEE Cat. No.04CH37508); Sep. 2004. p. 284-9. https://doi.org/10.1109/CACSD.2004.1393890.