Decentralized cooperative scheduling of prosumer flexibility under forecast uncertainties

Scheduling of prosumer flexibility is challenging in finding an optimal allocation of energy resources for heterogeneous prosumer goals under various forecast uncertainties and operation constraints. This study addresses this challenge by introducing a bottom-up framework for cooperative flexibility scheduling that relies on a decentralized network of scheduling agents to perform a coordinated decision-making and select a subset of households’ net load schedules that fulfills the techno-socio-economic prosumer objectives in the resource operation modes and ensures the reliability of the grid. The resource flexibility in terms of alternative operation schedules is mathematically modeled with multiobjective optimization that attains economic, environmental, and energy self-sufficiency prosumer goals with respect to their relative importance. The coordination is achieved with a privacy-preserving collective learning algorithm that aims to reduce the aggregated peak demand of the households considering prosumers’ willingness to cooperate and accept a less preferred resource schedule. By utilizing the framework and real-world data, the novel case study is demonstrated for prosumers equipped with solar battery systems in a community microgrid. The findings show that the flexibility scheduling with an optimal prosumer cooperation level decreases the global costs of collective peak shaving by 83% while increasing the local prosumer costs by 28% in comparison with noncooperative scheduling. However, the forecast uncertainty in net load and parameters of the frequency containment reserve causes imbalances in the planned schedules. It is suggested that the imbalances can be decreased if the flexibility modeling takes into account variable specific levels of forecast uncertainty.


Introduction
A transition toward a low-carbon, decentralized, and heavily electrified energy system requires smart grids to cope with the intermittency of supply-side renewable generation [1], sudden distribution network congestions [2], and an increasing need for reserve and peak generating capacity [3]. On the other hand, the proliferation of distributed energy resources (DERs) in low voltage distribution networks along with the advancements in demand-side connectivity and automation technologies offer the potential to intelligently coordinate prosumer flexibility and address the nascent challenges [4]. The prosumer flexibility is based on the capability of DERs to realize alternative operation modes by modulating their feed-in or feed-out active or reactive power in scale and/or time [5]. More specifically, flexible DERs such as battery energy storage systems (BESSs) can adjust or shift energy demand by storing (releasing) energy when an excess (peak demand) occurs in the grid. This operational flexibility can be used for individual and/or systemwide value when providing essential grid services [6] and reacting to direct (i.e., volumetric) or indirect (e.g., price) external signals [7]. R + predicted carbon intensity factor, gCO 2 /kWh + R predicted covariance matrix a [0, 1] relative importance of prosumer goal optimization and coordination solutions with the prosumers faces a combination of interdependent socio-technical challenges of putting ''humans in the loop'', which has received little attention in the literature so far. Below, we review the literature with respect to these challenges.

Literature review
The majority of previous studies in the optimization and coordination of prosumer flexibility have focused on the social welfare through homogeneous, mostly economic, benefits for the owners and the community [16][17][18][19]. The authors in [16] formulated an energy scheduling problem of households' DERs in a neighborhood that aims to achieve the social benefits in terms of electricity bill reduction, whereas cutting of the collective peak load was treated as a by-product. The cost minimization of energy procurement in an energy community was demonstrated in [17] with a day-ahead collaborative scheduling framework of prosumers' DERs in comparison with an independent management approach. Likewise, significant cost savings with respect to the individual optimization of assets were achieved by a communitybased collaborative scheduling framework for power exchanges in [18]. Finally, the optimal operation of an energy community in terms of profitability by provision of reserve services was presented in [19]. Recent research, however, has distinguished the heterogeneous motivations of individual prosumers in adopting [20] and managing [21] DERs and participating in energy communities [22], including autonomy, adoption of technology innovations, or sustainability, to name a few. Neglecting the underlying variation in the goals of prosumers can affect their willingness to co-create flexibility and undermine the potential of prosumer flexibility for the smart grid benefits [23].
In this scenario, the prevailing centralized and top-down control logic of coordination mechanisms, with a central controller or community manager (see [17,19]), falls short of achieving a socially optimal level of DER coordination with prosumer-preferred DER operating models [24,25]. Moreover, the centralized coordination can also be infeasible and impractical for a large population of resources because of high requirements for computational processing and communications infrastructure [24,26], approximation of the actual flexibility potential [27], and possible violation of prosumer data privacy with centralized data collection [26]. Therefore, the decentralized optimization strategies have been proposed to address these problems of centralized coordination, including an alternating direction method of multiplier decomposition [13,17,28], variants of the Dantzig-Wolfe decomposition [29,30], and decentralized combinatorial optimization [31]. In these strategies, the decisions are made locally ensuring the optimality of local goals and compliance with the associated system objectives and constraints. Furthermore, the scheduled household power exchanges with the grid are usually the only information being disclosed for the coordination. These strategies were applied to the energy procurement for local and system-level cost minimization [17,29]; combined electricity and frequency reserve procurement from residential households under thermal comfort constraints [13]; flexibility provision in a customer-aggregator hierarchical framework with multiple local goals or a trade-off between them and system objectives [28]; demand response coordination to maximize the aggregator profit at the system level while ensuring the desired local financial benefits and comfort [30]; and appliance-level scheduling for peak demand reduction at the system level under consumer comfort preferences and participation fairness [31]. Although these studies resolved computational burden, privacy concerns, and scalability limitations, the forecast uncertainties coupled with DER optimization at the local (e.g., household load demand) or system level (e.g., grid frequency) or their outcomes in the form of imbalances have not been treated in most of these works [17,[29][30][31] focusing on deterministic solutions; yet, the knowledge of uncertainty factors is pivotal in the optimization problems of DERs [12].
To hedge against the uncertainty factors, risk-averse robust optimization was applied in order to handle the uncertainty in thermal demand [28], wholesale market price [32], and solar photovoltaic (PV) production, market price, and load [33]. However, the frameworks for scheduling flexible DERs by a VPP [32] and a smart-home aggregator [33] proposed the centralized problem optimization with the caveats discussed above in this paper. Alternatively, stochastic chanceconstrained optimization was applied in day-ahead participation of residential BESSs coupled with heating demand in reserve markets with uncertainties [13]. The chance constraints ensured with some certainty that the level of consumer thermal comfort was not compromised by the amount of activated reserves conditioned on the realized grid frequency deviations. Although this holistic study is among the few devoted to the optimization of DER participation in reserve markets under uncertainties, it focused on the market aspects of this service but neglected its technical effects, such as network congestion caused by synchronized response [34]. In contrast, the network support through peak shaving was given as an option in [28], but DER participation in the FCR service was not considered in this framework among the prosumer objectives despite fulfilling most of the previously discussed socio-technical criteria.

Gaps, novelty, and contributions
Based on the above literature review and to the best of the authors' knowledge, there is a fundamental gap in leveraging the value of prosumer flexibility in the scenario of decentralized scheduling under uncertainty, while fulfilling the heterogeneous prosumer goals related to DER operation and meeting the technical constraints of the shared grid. Neglecting the heterogeneous goals can discourage prosumers to participate in demand-side flexibility programs and stimulate them to go off-grid, thereby disrupting the utility business models [35] and leading to the underutilized socio-economic [8,36] and environmental [14] benefits and loss of operational efficiency. Moreover, the absence of coordination between individual social preferences and technical system constraints can have disastrous consequences for the reliability of supply [34]. Furthermore, the decentralized scheduling of DERs in the future is subject to many uncertainty factors [12]. However, the effects of the uncertainty factors on the outcomes of individual and collective scheduling remain underinvestigated. This paper addresses the gaps listed above and advances the state of the art by proposing a novel flexibility scheduling framework of a community microgrid that effectively models the trade-offs between prosumers' techno-socio-economic goals and coordinates net load schedules across multiple households in a decentralized and cooperative manner ensuring the reliability of the shared grid. In the proposed framework, the prosumers can pursue economic (including provision of the FCR service), environmental, and energy self-sufficiency objectives, and modulate the operation schedule of DERs with respect to the relative importance of these objectives that goes beyond static models of human agency with purely financial motivations. The collective goal of the prosumers is to reduce the aggregated peak demand by selecting those schedules that uniformly distribute the total energy demand of the community microgrid across the day. By using this framework, this paper addresses socio-technical aspects such as the prosumers' willingness to cooperate for a common good, i.e., efficient microgrid operation. The prosumer cooperation is defined in terms of being ''altruistic'' by sacrificing self-interests and accepting a less preferred DER schedule with regard to own motivations for its use. This work builds upon and extends the socio-technical energy and appliance scheduling studied so far in the context of consumer personal discomfort and coordination fairness criteria [31,37,38]. Given the fundamental role of forecast uncertainties combined with the physical DER constraints, this paper also quantitatively studies the effect of these uncertainties on the realization of local prosumer costs, imbalances in the net load schedules of the households and the community, as well as risks of resource unavailability for the schedule execution and service provision.
Thus, the key novelty and contributions of this paper are summarized as follows: (i) A method for operational flexibility modeling of a prosumer household that captures the techno-socio-economic goals of prosumers in the planned DER flexibility usage under forecasts of uncertain factors. (ii) A novel household-level scheduling framework that performs cooperative and privacy-preserving coordination of the schedules across multiple households, aiming to reduce total demand peaks. (iii) A socio-technical impact and optimality analysis (using real-world data 1 ) of varying prosumer cooperation in the optimization process of flexibility scheduling, including individual objectives, a collective community goal, and coordination fairness. (iv) Quantitative findings using real-world data that show the effect of forecast uncertainty factors combined with the physical DER constraints on the realization of local prosumer costs, schedule imbalances, and risks of resource unavailability. (v) Quantitative findings that demonstrate the techno-economic efficiency of providing the FCR service by a population of residential BESSs.

Paper organization
The paper is structured as follows. In Section 2, we introduce the proposed decentralized cooperative flexibility scheduling framework and the experiment scenarios. Section 3 provides the details on the case study, experiment parameters, and implementation. The results are presented in Section 4 and discussed in Section 5. Finally, conclusions are outlined in Section 6.

Methods
This section formulates the methodology of cooperative flexibility scheduling and provides scenarios of its quantitative evaluation. The description of the methodology starts with Section 2.1 that illustrates the system architecture; the core idea of the decentralized cooperative flexibility scheduling framework is introduced in Section 2.2; Section 2.3 explains the multiobjective optimization for local criteria, whereas Section 2.4 presents the system-wide objective; and finally, Section 2.5 describes the experiments used to assess the performance of the proposed flexibility scheduling framework.

System architecture
We consider a residential community microgrid as a cyber-physical system illustrated in Fig. 1. A physical layer of the microgrid consists of a set of prosumer households ℎ ∈  equipped with a BESS, an uncontrollable load, and a solar PV system. The microgrid has a radial topology, and it is permanently connected to the upstream grid through an MV/LV distribution transformer. The solar battery systems are selected as prosumer flexible resources because (i) penetration of grid-connected BESSs combined with solar PV systems is increasing among prosumers; (ii) the unique characteristics of BESSs enable to use them for a variety of self-consumption, peak shaving, and FCR services, or optimal combination of those [39]; and (iii) unlike heat pumps, different operating modes of solar battery systems cause no direct personal discomfort for the prosumers [23], but only in the form of emotional dissatisfaction. A cyber layer consists of a set of scheduling (software) agents indexed by a ∈ , each representing a residential household with DERs and operating on behalf of prosumers. The agents manage the electric energy consumption, production, and storage of the household by modeling and selecting DER operation schedules. The operation schedule is a time series of the DER output or reserved capacity for a finite time horizon with an equal time step resolution [40]. The realization of DER operation schedule, along with the actual load and solar PV production, constitutes the net load profile of the household, i.e., the daily curve of power exchange with the microgrid. As individual net load profiles contribute to the total demand of the microgrid, the agents cooperate to reliably utilize the shared grid. In particular, the agents exchange information and coordinate their decisions using peer-to-peer informational transactions through communication channels.

Scheduling framework
An overview of the flexibility scheduling framework for an agent a is presented in Fig. 2. This framework relies on a decentralized network of the agents to perform coordinated decision-making. Each agent selects a net load schedule 2 that fulfills the prosumer goals in the DER operating modes and ensures the reliable use of the shared medium (i.e., the microgrid) by reducing the aggregated demand peaks. The agents carry out cooperative flexibility scheduling in two phases: (i) schedule generation to locally generate a number of possible net load schedules, (ii) schedule coordination to cooperatively select the optimal net load schedules to execute in such a way that the system-wide objective is achieved.

Scheduling generation phase
To generate a net load schedule, the agent a aims to optimally allocate the DER operation schedules by solving a multiobjective optimization (MOO) problem that fulfills heterogeneous prosumer objectives to the extent of their relative importance. The prosumer goals include the following criteria: (i) economic objective, considering the financial expenses of the electricity time-of-use tariff (ToU) and battery operation and remuneration from FCR service provision and the feed-in tariff (FiT); (ii) social objective of reducing the prosumer's own carbon footprint; and (iii) technical objective in terms of energy self-sufficiency.  These heterogeneous prosumer objectives are formulated as mixedinteger linear programs (MILPs) by applying a normalized weighted sum MOO method to model their importance for each prosumer [41]. The result of the local MOO for each agent consists of a household's net load power schedule nl ,a and the corresponding DER operation schedules { b ,a , fcr ,a }, where fcr ,a is the battery capacity reserved for the FCR service, and b ,a is the scheduled battery power. The results of such optimizations under different initial conditions constitute a set of possible net load schedules  a = { nl 1,a , … , nl ,a } and a related decision set of operation schedules ,a ]}. The variables in the sets are vectors of size ∈ N + with real values for a daily time interval  . The agent's, and hence, the prosumer's preferences for a particular net load schedule nl ,a are measured by a local cost function a ( nl ,a ) ∶ R → R. The schedule priority is determined in the ascending order of the local costs a ( nl 1,a ) ≤ a ( nl 2,a ) ≤ ⋯ ≤ a ( nl ,a ). Intuitively, the lower the local cost of the schedule, the lower the dissatisfaction it imposes on the prosumer.

Scheduling coordination phase
Given the agent's degree of freedom to choose from a finite number of self-determined net load schedules, the agents coordinate their decisions by each selecting a schedule that reduces the aggregated demand peak. This coordination among households' schedules is computationally modeled as the minimization of a nonlinear cost function, which is an NP-hard combinatorial optimization problem [42]. To approximate the problem and find a near-optimal and computationally feasible solution for coordinating the selection of household net load schedules, the agents employ a fully decentralized and privacypreserving learning algorithm I-EPOS 3 (Iterative Economic Planning and Optimized Selections) [38].
Every scheduling agent virtually connects to a self-organized tree topology to perform cooperative decision-making in bottom-up and topdown incremental interactions as in the hierarchical structures of neural networks. The agents collectively adapt their choices of the net load schedules by minimizing monotonously a global cost (.) ∶ R → R, 3 For detailed information about I-EPOS, the readers are referred to [38] and http://epos-net.org/. i.e., the variance of an aggregated net load demand agg = ∑ a∈ nl a during a time interval  . As a result of this system-wide optimization, an optimal combination ⋆ ∈ (,  a ) of the agents' net load schedules with a related community net load ⋆agg is found. Finally, the decision set  ⋆ a of DER operation schedules that corresponds to the selected net load schedules a = ⋆ a is submitted for execution by the agents. The equilibrium between conflicting local a and global objectives is locally controlled by the cooperation parameter , where the larger the parameter is, the stronger are the agent's local preferences over the system-wide objective. The coordination criterion for the agent a is generally defined as follows: For = 0, the agent represents an altruistic individual with cooperative behavior toward the system-wide efficiency (i.e., reducing demand peaks), whereas = 1 represents a selfish (noncooperative) individual, who prioritizes personal satisfaction.

Local optimization
The optimal allocation of DER operation schedules is generally modeled as a constraint optimization problem that should comply with soft constraints (i.e., prosumer goals) and hard constraints (i.e., operational) that restrict a feasible set. In this scenario, the feasible flexibility set contains all possible operation schedules that can be realized by the DER over a given time horizon and will not violate the operational constraints of the resource, providing service, or operating environment. In fact, the operational constraints of flexible resources are usually assessed by a trinity of indices [43], including power ramp rate, power capacity, and energy capacity. For example, the feasible set of operation schedules for a BESS is illustrated in Fig. 3 with power and energy operational constrains indicated by gray areas in both subplots; the solid line in the lower subplot is an example of the operation schedule that causes battery energy variations in the upper subplot.
When scheduling is planned in the future, some DER constraints are affected by variables that are unknown beforehand; in that case, the optimization relies on their expected behavior using forecasts. To give an example of the constraint-affecting variable, the energy-and power-constrained BESS providing the FCR service in Fig. 4 is exposed to stochastic grid frequency variation, and hence, the constraints of the BESS indicated by gray areas in both subplots are also stochastic. This can be seen with the grid areas that cover the possible disturbance to the available power and energy flexibility as a result of the forecast error in the stochastic grid frequency variations.
In what follows, we thoroughly describe the methodology of solving local MOO and constructing the feasible flexibility  a and uncertainty a sets.

Local objective function
The local cost function of the agent a is defined based on a set of objective functions a ∈ a with their relative importance, and it represents a multiobjective MILP-based optimization problem posed as: where is the number of objective functions.
To find a Pareto optimal solution of the MOO problem that respects the agent's preferences for various objectives, we linearly decompose it into a single utility function using a weighted sum method [41]: where a is the weight coefficient and ,min a = argmin  a { a } is the minimum (utopia point) of the objective space. The coefficient a is calculated as a product of the relative importance a of the objective and the normalization factor a : The relative importance is assigned using an a priori articulation preference method, where the importance is known in advance. The normalization factor prevents the numerical dominance of any objective function by restricting the function values in [0, 1] range: where ,max a = argmax  a { a } is the maximum function value (nadir point). The ,min a and ,max a (also known as the Pareto minimum and maximum) are found using a set of optimizations conducted with respect to each objective function a without normalization. Then, The financial costs for the prosumer over the time interval  are determined by the electricity bill with the ToU price tou and the FiT remuneration f it , the battery operating expense b , and the capacity remuneration for the FCR service provision fcr as follows: where nl ℎ, and b a, are the household net load and battery power scheduled at time ;̃↑ ,fcr ,̃↓ ,fcr are the estimated energy variation due to FCR service; and fcr a, b is the submitted reserve capacity.
Domestic ToUs are being gradually introduced by retailers to more efficiently use the grid infrastructure by encouraging electricity consumption at off-peak times. In fact, the rate of electricity price in ToUs varies along the day and can be static (i.e., having fixed peak and offpeak rates) or dynamic when depending on the wholesale electricity price. Normally, the electricity prices are at their lowest during offpeak demand times and highest during peak demand times. The FiT scheme is designed to subsidize microgeneration of renewable energy by mitigating investment risks. For this reason, this scheme assumes long-term guaranteed tariff payments on generation and/or export of renewable energy into the grid.
A prosumer's BESS installed behind-the-meter can enter the liberalized reserve markets and receive a relatively high remuneration [44] for the provision of FCR service to the transmission system operator (TSO). If the FCR bid is accepted in the market, the BESS contracted for this service must adjust its reserved power capacity in proportion to deviations of the grid frequency from the nominal value within a predefined time limit during the entire contracted period. These power adjustments continuously balance the demand and supply in the grid enabling the TSO to maintain system stability.
In order to capture the operating cost of the modeled BESS occurring mainly as a result of its degradation, a linearized battery degradation cost co-efficient b is applied [45]: where cell is the battery cell price, and 2 is the number of charge and discharge cycles that the battery could be operated within certain depth of discharge (DoD) limits lim . After all, the degradation costs are assigned with regard to the amount of energy being charged and discharged during the operating cycles. The environmental concerns of prosumers represent social motives to reduce their greenhouse gas footprint by adopting responsible energy consumption habits. These concerns are taken into account by shifting the consumption away from hours where the carbon intensity factor̃c o 2 is forecasted to be high: The carbon intensity factor (gCO 2 /kWh) is calculated as a ratio of CO 2 emissions from gross electricity production. There is, however, no explicit price for a carbon emission from the demand side and no monetary value for avoiding carbon emissions, but prosumers can have a pro-environmental identity putting environmental concerns above the financial profit. Self-sufficiency through an independence from energy supply companies is usually a dominant motivation factor of prosumers for installing microgeneration sources [46]. This energy autarky behavior is modeled by penalizing the power exchange with the microgrid: Self-sufficiency is estimated as the self-consumed on-site PV generation in ratio to the total electricity consumption. Research suggests that a solar battery system can enable prosumer self-sufficiency within a range of 29%-71%, depending on the control strategy and a reasonable generation-to-consumption ratio [47].

Feasible flexibility set constraints
A household's power flow is illustrated in Fig. 5 and shaped by the operation of an AC-coupled BESS, a household load, and a solar PV system. 4 The battery charging is possible from the microgrid, on-site solar PV production, and down-regulation frequency response in the case of overfrequency. Similarly, the battery can discharge into the microgrid, covering the prosumer's own load demand, or when providing up-regulation frequency response in the case of underfrequency.
In this configuration, the local MOO is parametrized by the feasible flexibility set  a that modulates household's possible net load dynamics in the conditions of the BESS energy and power operational constraints, limitations of the household's grid connection, and requirements for FCR service provision. The net load dynamics and the flexibility set are affected by the uncertain variables, including the uncontrollable net load̃u nc ℎ, and the energy state changes of the BESS caused by the FCR service provisioñ↑ ↓,fcr over the metering period . These uncertain variables are forecasted using historical measurements. Then, the battery operation power schedule b a, , along with the uncertain variables, determines the net load nl ℎ, of the household in a connection point to the microgrid as formulated in Eqs. (11)- (12).
The power flow is directed to the household when the net load power The maximum admissible net load power nl at the prosumer connection point is imposed in Eq. (15) assuming that the households have preinstalled electrical fuses.
This constraint is introduced to prevent a possible power exchange peak over the admissible value that can be, possibly, caused by a simultaneous high load and BESS charging at the maximum power.
In Eq. (16), the BESS charging ch a, and discharging dc a, powers constitute the battery power b a, used for the self-balancing service. b a, = ch a, + dc a, The positive values for the battery power b a, indicate that the battery is discharging, and vice versa, the battery is charging when b a, negative. Eqs. (17) The equality constraint in Eq. (19) guarantees that the BESS energy stored at the end of the optimization period equals the level at the beginning of the period. This condition enables to assess the simulation results without a time-coupled dependence between the simulation rounds. Note that the self-discharge losses of the BESS are neglected in the energy dynamics of the BESS but can be incorporated by subtracting them from Eqs. (17), (19). The energy dynamics of the battery are also constrained by its energy capacity limits b , b and requirements of the FCR service fcr a, : Eqs. (20)-(21) guarantee the requirement of FCR assets to provide 100% of the contracted capacity continuously in both overfrequency and underfrequency directions for a time period .
In Eq. (22)-(24), a, prevents simultaneous charging and discharging and can either be equal to 0 or 1, resulting in charging and discharging states, respectively.
The constraints (22)-(23) share the available BESS power capacity between the prosumer self-balancing purposes and the FCR service based on the amount of the normalized contracted power capacity fcr a, and prediction of maximum up-and down-regulation powers,̃↑ ,fcr and ↓,fcr , respectively. 5

Forecast uncertainty
The set of uncertain variables a includes the values of the prosumer net load̃u nc ℎ , the carbon intensity of electricity generation mix̃c o 2 , and the parameters of the BESS frequency response; the latter predictions consist of the maximum up-and down-regulation power (̃↑ ,fcr ,̃↓ ,fcr ) and the absolute up-and down-regulation energy (̃↑ ,fcr ,̃↓ ,fcr ) for each settlement period according to the methodology presented in [48]. The example of the agent uncertainty set a with predicted quantiles for the uncertain variables is illustrated in Fig. 6. The forecasts for these variables are issued day-ahead, normally from 12 to 36 h ahead, to predict the values of the next day. More specifically, at time step , one aims at predicting a random variable = [ +1 , +2 , … , + ] for future times + 1, + 2, … , + . A combination of DCC-GARCH (Dynamic Conditional-Correlation Generalized Autoregressive Conditional Heteroscedasticity) technique [49], multivariate random sampling, and quantile function is applied to produce the forecasts and represent their uncertainty for multiple horizons. The DCC-GARCH technique is used to predict a conditional A. Mashlakov et al. Then, a multivariate normal random number generator with the predicted meañ( +1)∶( + ) and covariance matrix̃( +1)∶( + ) is used to draw sample scenarios of the multivariate random variablẽwhere the vector̃( ) ( +1)∶( + ) of sample matrix̃is the th ∈  scenario. Next, sample average approximation [50] is employed to derive the mean and standard deviation of the stochastic variablẽ( 1∶ ) + , i.e., by taking each look-ahead time + individually and independently. Finally, the quantilẽ+ with the level ∈ [0, 1] of the random variablẽ( 1∶ ) + for time + is then defined using the inverse of the cumulative distribution function (also known as a probit function) −1 (1∶ ) + ( ) such that: For the forecasted -quantile, the actual value is expected to be lower than the quantile valuẽin 100 ⋅ % of the cases. Finally, the uncertainty set a for an agent is constructed as a set of quantiles with decreasing quantile levels: where is a number of uncertain variables from the set. In Fig. 6, the highest predicted quantile ( = 0.95) assumes that the uncertain variable will reach the largest positive deviation from the central quantile ( = 0.5), whereas the lowest quantile ( = 0.05) attains the largest negative deviation. For example, the largest positive deviation for the net load forecast in Fig. 6f indicates that the expected solar production will be at its minimum, while the load is the highest considering the recent historical data. The same logic is valid for the other uncertain variables in the set. An ARMA (1, 0) -GARCH (1, 1) is used as the univariate estimator for the conditional mean and variance in the DCC model. DCC-GARCH (1,1) rolling forecast is used to predict the time-varying covariance matrix of uncertain variables with model re-estimation every 14 daily periods and a moving window of 100 past measurements. The number of random samples is equal to 100. Predictive distributions are given by = 19 quantiles, whose nominal level range from 0.95 to 0.05 by 0.05 decrements. The uncertainty set is formulated based on the assumption that forecast errors for all uncertain inputs are represented by normal distribution functions. The accuracy of the presented method in the quantile forecast is presented in Appendix A.
These uncertainty predictions at different quantile levels are further used in the above-mentioned MOO to generate a set of net load schedules  a that model the operation flexibility of the household. An example of the operation flexibility modeling obtained based on the described method of the local MOO along with the forecast uncertainty estimation a and the constraints of feasible flexibility set  a is illustrated in Fig. 7. The figure shows how the net load schedules and the BESS operation schedules (i.e., BESS power and submitted FCR power capacity) change from applying the most conservative predictions with the highest quantile ( = 0.95) to the most risky ones with the lowest quantile ( = 0.05). For instance, the net load schedule modeled with the risky predictions is mostly negative during the daylight hours except for the midday dip, when the battery stores the solar production and thus decreases the amount of power capacity offered for the FCR service. The generated set of net load schedules in Fig. 7a is further used for coordination in the system-wide optimization.

System-wide optimization
In the following, we formulate the global objective function of the collective learning.

Global objective function
The net load schedules of all households in the community form the aggregated net demand agg = ∑ a∈ nl a . A global cost function aims to minimize a variance of this demand during the daily optimization period as follows: A. Mashlakov et al. where agg is the net demand at the time and̂a gg is the average net demand for the time interval  . The minimization is achieved by selecting those households' net load schedules that flatten the planned net load at the community level the most. In this case, the agents are considered risk-neutral, i.e., having no preferences toward the level of forecast uncertainty used in the selected net load schedules. The system-wide cost function implicitly considers trade-offs between customer preferences and the interests of distribution system operator (DSO) in peak reduction on the electric delivery equipment (e.g., distribution transformers) to avoid or delay local grid investments to meet the peak demand [51]. Alternatively, the DSOs could explicitly benefit from the community's flexibility by sending an incentive signal to reprofile a net load schedule and prevent a network congestion [52]. In this scenario, other global cost functions are possible in the I-EPOS, such as the root mean square error [37].

Evaluation experiments
The evaluation experiments and their methodology are described in the following.

Impact and optimality of the cooperation level
The experiments study the impact of a varying prosumer cooperation level on the optimization process of flexibility scheduling, including (i) individual local costs, (ii) collective global costs, and (iii) coordination fairness. For the experiment purposes, the cooperation level is set as a system-wide parameter, meaning that all the agents have the same value of . The local a and global costs are calculated using the normalized values obtained with the corresponding objective functions in Eqs. (3) and (27). A social measure of unfairness in the agent coordination is computed by the standard deviation of the local cost a normalized with their mean values for all the selected schedules a : Unfairness is defined by the dispersion of dissatisfaction that prosumers experience (or perceive) with regard to the selection of the planned net load schedule to improve system efficiency. Note that, in contrast to the local and global objectives, the fairness criterion is not explicitly used in Eq. (1) as an optimization variable; yet, this option is available in I-EPOS configuration, we measure the unfairness post-hoc; i.e., after the schedules are selected by all agents. Furthermore, (iv) the optimality of the cooperation level for the conflicting local and global objectives is studied as a set of trade-off solutions, known as a Pareto-optimal front: where is the simulation day and is the number of agents. The choice of a single optimal solution is not straightforward, and in the cases of unavailability of prosumer-specific preferences toward a global wealth, a knee point or knee region of the Pareto front are naturally preferred. The knee points constitute a subset of Pareto optimal solutions, for which a gain in one objective will result in a severe sacrifice in at least another one, whereas a knee region constitutes a set of knee points.
Here, a Kneedle approach [53] is applied to calculate the knee region using the mathematical concept of maximum curvature for all the simulation days . Then, the optimal knee point is found as an average of the values in the knee region. The optimal cooperation level is then calculated as the one that gives the smallest mean square error between the optimal knee point and the global costs of all simulation days. By applying the methodology above, this experiment studies the necessary level of cooperation by prosumers to meet their local preferences and still achieve an effective peak demand reduction. The technical aspects of the flexibility scheduling framework are studied to evaluate (v) the system-wide effect of the selected schedules on the planned net load schedule of the community using a net load factor (NLF) metric. This indicator is equal to the ratio of the averagê agg ∈ and the maximum daily power agg ∈ consumed from and injected into the main grid: Similarly, the NLF can be calculated for a planned net load schedule of a single household: The higher the NLF, the smoother the net load profile throughout a day, and hence, the lower the peak net load demand.

Assessment of schedule imbalances and forecast errors
The operation schedules in the local MOO are calculated based on the forecasted variables with different quantile levels that represent the forecast uncertainty. The uncertainty assumes a varying level of possible deviation of forecasted values from their actual realization. As a consequence, this divergence affects the operation constraints (see Fig. 4) and causes an imbalance between the planned and realized schedules. In this study, the potential costs of imbalances were not included explicitly in the formulation of the local MOO in Section 2.3.1; yet, it is important to assess the level and effect of such imbalances to take into account the imbalance risks in further studies. Therefore, we evaluate the effect of various forecast uncertainty levels on the realization of (i) local costs, (ii) net load imbalances at the household and community levels, (iii) forecast error of the predicted frequency regulation signal, and (iv) risks of BESS unavailability for the execution of the planned schedule and provision of the FCR service.
In order to investigate possible imbalances of the selected net load schedules ( nl⋆ ℎ, , agg⋆ ) with their realization ( nl ℎ, , agg ) at time ∈ , we use household  NL ℎ, and community  NL schedule imbalance indices: Then, the daily absolute net load imbalances per household are defined as follows: Similar to the schedules, the imbalances for the NLF are calculated as follows: The lower imbalances in the net load and NLF are preferred to minimize their effect on the agent costs and realization of the prosumer goals. The scheduled BESS power capacity is shared among the selfbalancing and FCR service with the predicted maximum up-and down-regulation power deviations,̃↑ ,fcr and̃↓ ,fcr in Eqs. (22)- (23). The error in the prediction of these maximum power deviations can potentially violate the provision of the FCR service. Therefore, we study the forecast error of the maximum up-and down-regulation signals as follows: where b⋆ a, is the required grid frequency response at time . The absolute daily sum of these forecast errors is then calculated as follows: The knowledge of the appropriate uncertainty level can enable the FCR service provision ensuring that the reserve capacity remains available during the contracted period. Furthermore, the execution of the BESS operation schedule is also intervened by the stochasticity of the FCR service. For instance, over some time periods of the FCR service provision under stochastic grid frequency, the BESS energy charge can reach the upper or lower threshold making it temporally unavailable to react to the grid frequency signal or follow the planned operation schedule (Fig. 4). Therefore, we evaluate the BESS unavailability for any service provision as follows: where b⋆ a, + b⋆ a, is the required BESS power at time , and ch a, and dc a, are possible charging and discharging BESS powers compliant with the power and energy constraints of the current time step 1∕ (in seconds): The absolute daily sum of the BESS unavailability is then calculated as follows: If the BESS asset is being unavailable to provide the FCR service, it violates the balancing mechanism and can face penalties charged by the TSO. In the same way, the unavailability of the BESS for self-balancing leads to prosumer dissatisfaction.

Efficiency of frequency reserve provision
This experiment studies the techno-economic aspects of providing FCR with a population of residential BESSs. The technical and economic metrics, namely service performance measure (SPM) and availability factor (AF), are used for the evaluation. Technical SPM enables to Table 1 Availability factor (AF) as a function of service performance measure (SPM) [54].
estimate the reliability of residential BESSs contracted for the FCR service to react to the grid frequency deviation signals under its stochastic variations and BESSs' operational constraints. This index  a, is calculated as an average of the second-by-second SPM  a, over the settlement period (in seconds) [54]: where is a second-based interval in the settlement period, R le and R ue are the lower and upper envelope limits of the required regulation power 6 ; is the accuracy threshold, being 0.01; anḋa , is the normalized response provided by the FCR assets, calculated as: where b a, (kW) is the actual response at the second before normalization, and fcr a, b (kW) is the contracted FCR capacity for the time period . For instance, when the actual response is within the delivery envelope,  a, takes the best value equal to 1. If the actual response remains outside the envelope, the  a, is reduced according to the magnitude of deviation from the upper or lower limits.
The AF is calculated based on the SPM to decide the proportion of remuneration that the FCR provider can obtain for each settlement period, as detailed in Table 1.

Case study
In this section, the experimental settings, input data, and implementation details are described for a case study of a residential community microgrid virtually located in the United Kingdom (UK).

Experimental settings
The simulation experiment for the assessment of the flexibility scheduling framework consists of the related day-ahead and intraday stages. The former stage includes the flexibility scheduling described in Section 2.2, whereas the latter is a real-time simulation of the selected schedules described in Appendix B by Algorithm 1. The experiments are carried out in a time-decoupled fashion, meaning that the BESS state at the end of day is not used for the next day. Instead, the energy charge of the BESS is set at the 50% level of the available capacity at the start of each day. The simulation experiment is performed for = 150 agents during a finite time horizon of = 150 days with a rolling window approach, where each window is indexed by ∈ . Moreover, 100 days prior to the first simulation day are used to fit the forecasting models, whereas the rest of the predictions are issued using a rolling window approach. The intraday simulation is implemented with high resolution data = 1 s, whereas for the forecasting and scheduling, the datasets are sampled to half-hour periods = 30 min according to the UK electricity tariffs, which, in total, gives 48 time intervals for each billing day .

Input data
In the following, we describe the input data used for the experiment simulation.

Prosumer preferences
The prosumer preferences are chosen based on a best-worst scaling survey estimation of the motivation factors regarding the adoption of microgeneration technologies in the UK [20]. The results of the relative importance are illustrated in Table 2.

Net load profiles
For the households' net load data, we use a real-life dataset collected during a smart grid pilot project with the time period from December 2012 to October 2013 [55]. The dataset consists of net load (solar PV generation and electricity demand) measurements at 1 min resolution for the households located in the northeast of Great Britain (GB). We assume that the power exchange with the grid is limited for the households by an 80 A electrical fuse, which corresponds to nl = 18.4 kW.

Battery energy storage
The battery energy storage is modeled based on the specification of a fully integrated AC-coupled BESS Sonnen Eco 9.43/7.5 [56], whose parameters are presented in Table 3.

Electricity and feed-in tariffs
For the electricity tariff, we adopt the ToU scheme with daily and night rates (Economy 7 Tariff) for the unit price of electricity. In Eq. (7), the off-peak electricity price corresponds to the electricity unit price during the night (from 00:30 to 07:30 in the northeast region) tou ∈of f −peak = 0.1020 £/kWh and the peak price for consumption during the daily hours tou ∈peak = 0.1662 £/kWh. The feed-in tariff scheme is set according to the Smart Export Guarantee mechanism in the UK, which only remunerates the export of the excess electricity to the grid, and the remuneration level is set by the electricity retailer tariffs. Here, we assume a FiT payment equal to f it = 0.055 £/kWh.

Carbon intensity index
In order to model the preferences of prosumers for sustainable consumption and reduction of CO 2 , the GB half-hourly historical carbon intensity factor (gCO 2 ∕kWh) [57] for the year 2019 is used. The halfhourly values of the carbon intensity factor are presented in Fig. 8 and demonstrate a wave-based distribution along the day with morning and evening peaks.
Here, the average carbon intensity per country is assumed, where the changes in the prosumer consumption pattern cause no influence on the total intensity. Alternatively, estimating the marginal carbon intensity, which is due to added demand, can be implemented [58].

Frequency reserve service
For the simulation of the FCR service, we apply the rules of enhanced frequency response (EFR) with ±0.05 Hz dead band (Service 1) that was predominantly designed for the BESSs in GB [59]. Detailed information about the EFR service is available in [54,59]. In addition, the following assumptions about the provision of the EFR service by the residential BESSs are adopted: (1) all BESSs have passed a prequalification procedure for the provision of the service; (2) the bid requirement for the minimum capacity (10 MW) is met assuming that the BESSs are part of a larger fleet aggregated in a VPP; (3) the capacity bid per household varies daily based on the results of the selected operation schedules; (4) the capacity remuneration price is fixed to a mean value of the first EFR tender winning bids fcr = 0.0978 £/kW/h; (5) the battery storage assets must be able to deliver 100% of the contracted capacity for a minimum of = 15 min; (6) the frequency measurements are taken from the year 2019 [60].

Implementation details
The multiobjective MILP-based optimization was performed using the Gurobi solver [61] and the CVXR package [62] in the R programming language. The GARCH-DCC functions were used from the ''rmgarch'' package [49] in R. The collective learning experiments with the I-EPOS 7 are run using 30 learning iterations, and each experiment is repeated 50 times with a random assignment of the agents over a balanced binary tree topology. The simulations were carried out using a virtual environment with an Intel Xeon (Skylake, IBRS) 2.2 GHz processor with 32 GiB memory.

Results
This section illustrates the results based on the experiment scenarios in Section 2.5 and the case study in Section 3.

Impact and optimality of the cooperation level
The cooperation parameter represents the agents' perspective in the trade-off of individual (local) vs. collective (global) criteria based on which the schedule coordination is performed. The results of the sensitivity analysis of the agent cooperation on the system performance are presented in Fig. 9. The results can be interpreted as follows: when individuals express noncooperative behavior and prioritize their goals (high values), collective efficiency is sacrificed in terms of global cost, but improved in terms of unfairness. However, the results suggest that A. Mashlakov et al.  these parameters are especially sensitive to in the very last 1% of its values, where a trade-off solution between the criteria can be found. Fig. 10a illustrates the normalized local and global costs with a Pareto-efficient solution obtained at the average knee point. This point is found at 0.209 pu of the average global costs, whereas the closest (i.e., by the lowest mean square error in Fig. 10b) cooperation level corresponding to these costs during the simulation days belongs to = 0.9998.
In that case, the results in Figs. 9a and 9b demonstrate that compared with noncooperative scheduling, the Pareto-efficient solution achieves an average reduction in the global costs by 83.3%, whereas the local costs are increased by 28.3%. Therefore, there is a good tradeoff for individuals: a very high reduction in global cost, while the local cost remains low.
The results of the planned net load schedules at the community level for uncoordinated and cooperative scheduling between the agents are presented in Fig. 11. The uncoordinated scheduling is modeled for the case of selfish agents (i.e., not participating in the cooperative scheduling), whereas the cooperative scheduling is modeled for the case of the Pareto-optimal participation level with = 0.9998. The results suggest that the Pareto-optimal cooperative scheduling achieves more flattened net load distribution with the reduced net load peaks (e.g., in the best case by a factor of three) compared with the uncoordinated scheduling. The reason for the high peaks in the uncoordinated scheduling can be due to the coincidence of the scheduled charging (i.e., positive night peak), discharging (i.e., negative evening peak) and domestic net load (i.e., solar production and demand) in the conditions of the systemwide settings for prosumers' relative importance and comparable sizes of households, BESSs, and solar PV systems.
The distributions of the NLF values for the uncoordinated and cooperative scheduling are illustrated in Fig. 12. The distribution of the cooperative scheduling is centered higher than that of the uncoordinated scheduling, which indicates more flattened net load schedules, which along with the lower net load demand peaks in Fig. 11 lead to less stress for the grid equipment.

Imbalance assessment
The net load schedules are modeled with the uncertain variables having a varying forecast uncertainty in the form of quantiles that have positive and negative deviations from the expected mean (i.e., 0.5 quantile) and thus affect the local costs of the schedules. The normalized values of local costs for all the agents during the experiment are illustrated in Fig. 13. The results show that (i) the distribution of the local costs under varying forecast uncertainty is asymmetric and skewed right from the mean with a center in the 0.35 quantile; (ii) the lowest values of the local costs mostly correspond to the areas of high and low deviation from the center, i.e., they belong to the conservative (i.e., high quantiles) or risky (i.e., low quantiles) schedules. Therefore, the net load schedules at these quantiles are prioritized by the agent choice during the schedule coordination.
The forecast uncertainty in the net load and FCR regulation power cause the imbalances between the planned and realized net load schedules. The results of the mean half-hourly net load imbalances during the simulation days are presented in Fig. 14. The results demonstrate that most of the net load deviations correspond to the daylight hours, where the uncertainty of both the solar PV production and the household's demand are usually high. In these hours, the maximum expected deviations are close to the level of ±1.25 kW per household in Fig.  14b. At the community level in Fig. 14a, the imbalances can achieve values close to ±180 kW, yet such cases are rare. In contrast to the daylight hours, the night hours have much lower levels of imbalances, and hence, they can be used to hedge the scheduling in future works. As one might expect, the net load uncertainty plays a major role in the amplitude of the these imbalances, whereas the FCR response uncertainty is minor because the FCR service is provided during the A. Mashlakov et al. Fig. 11. Impact of (a) uncoordinated and (b) cooperative scheduling on the peak net load of the community microgrid.  night and daylight hours, but the amplitude of night imbalances is much lower in Fig. 14b. Fig. 15 provides details about the NLF imbalances at the household and community levels. The results indicate that the imbalances of household NLFs vary significantly, but the most values reside within ±0.2 pu deviation from zero imbalance. In addition, the imbalance median has a positive bias, meaning that on average the realized NLFs are worse than the planned ones. Furthermore, Fig. 15 shows that the distribution of the community NLF imbalances is concentrated on a narrower region than the household imbalances, which can be explained by the mutual compensation of the latter imbalances.
The uncertainty of FCR power regulation also causes the imbalances in the planned BESS operation schedule. The results related to the performance of the residential BESSs are provided in Fig. 16, where the BESS energy charge and mean half-hourly battery unavailability are illustrated together with the average forecast error in the maximum FCR regulation power. Fig. 16a shows that the BESS operation schedules repeat a similar pattern that consists of the night charging, morning discharging to cover the peaks, which follows the daily charging, and finally, the evening discharging. The results also demonstrate that the level of the BESS charge at the end of the day varies from the required (i.e., 4.125 kWh according to Eq. (19) and Table 3) with the maximum deviation of almost 2 kWh (30% of the available energy capacity). Fig.  16b indicates that the level of the BESS unavailability is negligible with rare cases occurring close to 08:00, 16:00, and 20:00 h. The nature of up-regulation unavailability (i.e., positive imbalances in Fig.  16b) can be attributed to the scheduling conflicts between the selfbalancing power and the required FCR response, whereas the reason for the down-regulation unavailability (i.e., negative imbalances in Fig. 16b) is probably a consequence of the full BESS energy charge that prevents further BESS charging. The results of the error of the forecasted maximum up-and down-regulation power in Fig. 16c reveal that the average forecast errors are uniformly distributed along the day and lie within ±5% of the contracted battery capacity, which is a relatively low error value. A dependence between the quantile level of uncertain variables in the selected schedules and the corresponding absolute daily sum of imbalances is presented in Fig. 17. The results in Fig. 17a suggest that the absolute sum of net load imbalances has a concave upward curvature along the quantile levels in contrast to the local costs having a reversed shape in Fig. 13. In that case, the schedules with the lowest costs mostly correspond to the highest net load imbalances, and vice versa. Taking into account the amplitude of the imbalances, the area of the quantiles levels for net load should be further restricted around the lowest net load imbalances in Fig. 17a. Furthermore, Fig.  17b shows that the level of BESS unavailability in terms of absolute sum of power imbalances remains below 1.8 kW. In addition, the BESS power imbalances occur relatively rarely, and most of them are concentrated equally along the quantiles with a slightly higher density at the lowest quantiles. Fig. 17c shows that the absolute sum of forecast error in the maximum up-and down-regulation power has an exponential dependence on the quantile level and varies from 0 to 1.7 pu with respect to the contracted capacity. The results illustrate that selecting the highest quantile level guarantees almost zero error, but can be overconservative. Values above 0.65 quantile provide only a 10% error of maximum deviation in the majority of the cases and can be regarded as reasonable for further consideration. Therefore, the imbalances of the net load schedule, BESS power unavailability, and the forecast error of the maximum FCR regulation power have a minimum at different quantile levels; this result suggests that the consideration of individual quantile levels for the uncertain variables seems to decrease the expected imbalances.

Efficiency of frequency regulation
Under the BESS power unavailability and errors in the forecasted BESS regulation power, the battery may be unable to respond to the     grid frequency deviation, and hence, put the power system stability at risk. The techno-economic performance of BESSs for the FCR service under forecast uncertainties is provided in Fig. 18. The results indicate that (i) the worst SPM deviates by no more than 1.5% from the optimal, which corresponds to the high quality of the service provision; (ii) the technical service performance also leads to a maximum AF (100%) along all the simulation periods, which guarantees the maximum prosumer remuneration for the reserved capacity of the BESS. Therefore, a population of residential BESSs can provide reliable FCR service under the assumptions of the flexible participation scheme (see Section 3.2.6).

Discussion
Below, we summarize the main research findings, discuss the input data assumptions, outline future perspectives of flexibility scheduling, and provide the framework adjustments for the real-life implementation.

Research findings
The key findings of the performed experiments are summarized as follows: • Flexibility scheduling with the optimal prosumer cooperation level (Fig. 10) reduces the net load peaks of the planned schedules (Figs. 11, 12) and decreases collective costs of peak shaving by 83% compared with the uncoordinated scheduling (Fig. 9a); whereas the average prosumer dissatisfaction with respect to the selected net load schedules remains below 28% (Fig. 9b). • Quantile risky and conservative net load schedules (i.e., modeled with the uncertain variables having the highest positive or negative deviation from the central quantile) produce the lowest local costs and are prioritized by the agents (Fig. 13); yet, due to the prediction error these schedules cause a larger absolute sum of household net load imbalances per day (up to 115 kW) compared with the more quantile-centered schedules (Fig. 17a). • A high forecast uncertainty of the net load during the daylight hours leads to significant imbalances in the planned net load schedule of the community (±180 kW per metering period), and hence, endangers the system-wide optimality of the cooperative scheduling and the operation efficiency of the microgrid (Fig. 14). • The forecast uncertainty of the FCR parameters results in a low impact on the battery storage unavailability to provide selfbalancing or FCR service (Figs. 16b, 17b), but causes a battery energy state deviation up to 30% from the planned value at the end of the scheduling periods (Fig. 16a). • The techno-economical indicators of the FCR service provided by a population of residential battery storages remain at the highest quality levels with the service performance above 98.5% and 100% availability (Fig. 18); apart from this, the forecast imbalances in the FCR maximum up-and down-regulation power of the batteries create an exponential dependence on the forecast uncertainty (Fig. 17c).
Overall, the results show that the optimal realization of the flexibility scheduling heavily depends on the consideration of the forecast uncertainty and potential imbalances. In the proposed approach, the use of distinct quantile levels or regions for the uncertain variables instead of analogous ones for all seems to decrease the imbalances related to the flexibility scheduling, and thus, improve the optimality of the framework.

General applicability
The developed flexibility scheduling framework is not strictly bound to the UK regulatory environment and could potentially be used in any other European country. Some minor adjustments may only be required for the rules of the FCR service. In particular, the droop curve parameters, participation requirements, and service performance indicators can be different, but should be equally substituted with the operating principles of the primary frequency control commonly adopted by TSOs across Europe. For the rest of the input parameters and variables (e.g., ToU and FiT prices, DoD of the batteries, or the time interval of the automatic meter readings), only numerical adjustments are needed. Moreover, this framework can also be used in a variety of scales, including neighborhoods, districts, and cities besides community microgrids.

Real-life implementation considerations
The real-life implementation of the proposed scheduling framework in battery energy management systems requires some adjustments. For instance, the time-coupled dependence between simulation rounds is not required in the proposed form and can be modified or neglected. The modification option can be an inequality constraint in Eq. (19) ensuring to provide a certain BESS energy charge at the end of the optimization period. Alternatively, this constraint can be neglected if the framework runs a model predictive control with a receding horizon of several days ahead.
However, as shown in the results, the BESS energy state is subject to imbalances caused by uncertainties of the grid frequency. In this context, the energy state can still be coordinated using power adjustments at each step along the optimization period to bring the real BESS energy charge closer to the scheduled one. For example, if providing FCR service, the BESS recharging can be done when the frequency is within the dead band limits.
In the experiment, the load and solar production were bound into a single net load variable because of the input data format. In reality, the consumption and solar PV production measurements can be obtained separately, from smart electricity meters and solar PV inverters, respectively. In this case, the net load variable in Eq. (12) should be split into two variables to take into account this condition.
In addition, the assumptions of the system-wide settings of the cooperation level and the relative importance of prosumer objectives should be revised, and the framework should be adopted to a personalized approach (similarly to [31]) to better represent the real-life diversity of prosumer objectives.

Future trends
The widespread adoption of flexibility scheduling and coordination methods heavily depends on the availability of prosumer flexibility in the near future. Overall, the return on investment for the PV battery system from solely self-consumption as the most valuable application for the customers is currently questionable [63], and the future uptake rate in installations of such systems depends on many interdependent factors at the customer, market, and electricity supply levels [64]. Nowadays, Germany is one of the leading countries in the installation of residential PV battery systems. In fact, for the period from 2018 to the end of 2019, the total number of residential PV battery systems in Germany was doubled from 100,000 units to 200,000, and about 90% of all the BESS installations are joint installations with solar PV systems [65]. However, according to the analysis in [66], France and the UK have the highest technical potential for residential solar PV in Europe based on the total number of residential dwellings.
A recent study in [23] identified the owners of solar battery systems as ones of the most inclined toward the role of flexibility providers, which suggests their possible future game-changing role in the organization of smart grids. In that case, flexibility provision of upstream grid services by BESSs can be an additional source of revenue for the prosumers and a support to the grid in preventing potential blackouts [67]. Frequency reserve services remain economically the most lucrative BESS application [44], and it should be noted that changes in the electricity generation mix will probably increase the future requirement for a fast reserve to control grid frequency variations, and thereby, highly likely increase the costs of these services. For instance, the demand for these services is currently being seen in the UK at the moments of low load in the power system caused by prolonged lockdowns due to the COVID-19 pandemic and a high share of renewables in the generation mix. Furthermore, FCR applications of aggregated solar batteries start to appear in real-world projects. Just recently, a VPP pilot project was completed in the south of England, which allows prosumers to maximize the potential of their solar batteries by combining self-consumption and dynamic firm frequency response services [68]. Therefore, one can expect more commercial interest in intelligent solutions for flexibility scheduling in the coming years.

Conclusion
This study proposed a decentralized and privacy-preserving flexibility scheduling framework that coordinates households' net load schedules to improve the operation efficiency of a community microgrid. The framework enables bottom-up flexibility coordination that considers a trade-off between the individual techno-socio-economic goals of prosumers for flexible resource utilization (including provision of frequency containment reserve service) and the collective goal of peak demand reduction at the community level.
We found a significant impact of the design parameters on the socio-technical performance indicators of the flexibility scheduling. For instance, the optimal value of prosumer cooperation reduces the collective costs of peak shaving by 83%, while leading to a minor sacrifice in prosumer goals with the local costs increasing by 28%. However, the assessment of the framework shows that the optimal implementation of the flexibility scheduling heavily depends on the consideration of forecast uncertainty. In particular, the impact of forecast uncertainty on the net load and response parameters of the frequency containment reserve causes (i) imbalances into the planned net load schedule, (ii) battery unavailability for its operation schedule execution and service provision, and (iii) forecast errors in the maximum up-and downregulation power. Overall, the battery unavailability remains low, and the forecast errors are relatively small for the maximum regulation power. Indeed, the residential batteries demonstrate efficient technoeconomic performance for the reserve service, but the uncertainty in the reserve response leads to a deviation in the battery energy charge up to 30% from the planned value at the end of the scheduling periods. As a consequence, such a deviation may undermine the prosumer satisfaction with the realization of their goals. Furthermore, the impact of imbalances on the community net load schedule is significant (up to ±180 kW per a metering period) to put the optimality of cooperative scheduling at risk. This paper concludes that the use of distinct quantile levels for the specific uncertain variables instead of identical ones for all can decrease the particular imbalances of the planned flexibility scheduling. Therefore, the findings of the present study can be used by flexibility providers, aggregators, and system operators to design and adopt effective measures to leverage the value of prosumer flexibility in smart grid solutions.
Furthermore, future research should investigate how to consider the imbalance risks in the local agent decision-making, e.g., by extending the local optimization with chance constraint [69] or robust optimization [70]. Moreover, the cooperative flexibility scheduling can be further enhanced by deploying an adaptive receding horizon rescheduling and by adding new types of agents in the coordination loop, e.g., system operators.