{'fraction_non_alphanumeric': 0.033592644978783594, 'fraction_numerical': 0.009411380698509412, 'mean_word_length': 4.718618758749416, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Grid-aware Distributed Model Predictive Control of Heterogeneous Resources in a Distribution Network: Theory and Experimental Validation

In this paper, we propose and experimentally validate a scheduling and control framework for distributed energy resources (DERs) that achieves to track a day-ahead dispatch plan of a distribution network hosting controllable and stochastic heterogeneous resources while respecting the local grid constraints on nodal voltages and lines ampacities. The framework consists of two algorithmic layers. In the first one (day-ahead scheduling), we determine an aggregated dispatch plan. In the second layer (real-time control), a distributed model predictive control (MPC) determines the active and reactive power set-points of the DERs so that their aggregated contribution tracks the dispatch plan while obeying to DERs operational constraints as well as the grids ones. The proposed framework is experimentally validated on a real-scale microgrid that reproduces the network specifications of the CIGRE microgrid benchmark system.


I. INTRODUCTION
Controlling heterogeneous and stochastic energy resources connected to medium and low voltage power grids is crucial * Corresponding author: rahul.gupta@epfl.ch.
to displace centralized electricity generation in favor of renewables. This change of paradigm inputs the planning and operational practices of both distribution system operators (DSOs) and transmission system operators (TSOs). Indeed, DSOs may face significant issues associated with grid reinforcements and capability of being dispatched, while TSOs will experience increasing needs for allocating and deploying regulating power.
Day-ahead and intra-day scheduling of distributed energy resources (DERs) and, in general, heterogeneous DERs has been advocated in the literature as a way to minimize the effect of uncertainties. It consists in determining an average power trajectory (dispatch plan) at a certain resolution before operations that is then followed during real-time operation. Different scheduling problems have been proposed. E.g., works in [1]- [4] aim at minimizing power imbalances and in [5] at maximizing economic benefit. During operation, the realized power profile deviates from the dispatch plan because of forecast errors causing issues such as: power imbalance, lines/transformers congestion, voltage outside bounds etc. To tackle these issues, several works proposed real-time controls and energy management schemes [6]- [9] with different objectives. The work in [6] proposed a real-time control for voltage regulation, in [7] for congestion management, in [8] for energy management and dispatch tracking, and in [9] for frequency regulation. An extensive literature review on microgrids controls and energy management schemes is presented in [10].
In this work, we develop and experimentally validate a framework for scheduling and real-time control of heterogeneous DERs while accounting for local grid constraints. In the scheduling phase on the day before operations, a stochastic optimization problem computes an aggregated dispatch plan at the grid connection point (GCP), accounting for the uncertainties of DERs and demand with scenarios, and constraints of the grid and DERs with models. In the real-time phase, a gridaware model predictive control (MPC) computes the active and reactive power set-points of the heterogeneous DERs so that their aggregated contribution tracks the dispatch plan at the GCP while obeying to their constraints and those of the grid. The MPC problem leverages a distributed formulation to achieve a privacy-preserving and scalable configuration. It is solved with the alternating direction method of multipliers (ADMM), in which each DER solves its own constrained optimization problem, and an aggregator performs an optimal power flow (OPF) to enforce grid constraints and track the dispatch plan, considering grid losses. We model the grid with arXiv:2008.02848v1 [eess.SY] 6 Aug 2020 a linearized model based on the sensitivity coefficients [11], [12] to retain the convexity and tractability of the underlying optimization problem and achieve the high computational performance necessary for the hard real-time control.
The proposed framework is experimentally validated in a grid-connected microgrid that reproduces the CIGRE benchmark system for microgrids [13]. It connects stochastic demand, a battery energy storage system (BESS) and two curtailable PV power plants and is equipped with a phasor measurement units (PMU)-based monitoring system. We perform experiments for two distinct days characterized by different irradiance patterns, including real-life forecasters, also described in the paper.
The main contributions of this paper compared to the existing literature are the formulation of a generic and computationally-efficient scheduling and control framework to dispatch heterogeneous resources while accounting for grid constraints and its experimental validation in a real-life setup. With respect to previous efforts of experimental validation in [1], [4], [8], [9] and MPC-based control in [14]- [18], we report the first experimental validation of a rigorous distributed MPCbased framework on a real-scale microgrid accounting for the grid constraints.
The paper is organized as follows. Section II states the problem, Section III describes the day-ahead problem, Section IV presents the real-time controller, Section V presents the experimental setup, Section VI presents the experimental results and Section VII summarizes the outcomes and findings of the paper.
II. PROBLEM STATEMENT We consider a distribution grid interfacing controllable and uncontrollable DERs. The grid is dispatched at its GCP according to a pre-determined dispatch plan. The dispatch action is achieved by coordinating the DERs operations while respecting their own constraints along with those of the grid. We refer to the following two-stage mechanism. • Day-ahead scheduling: the operator computes a dispatch plan for the next day based on the forecast of the stochastic generation and demand, the status of controllable resources, and local grid constraints. The dispatch plan not only reflects the point-predictions of the stochastic quantities but also ensures that DERs have a suitable level of flexibility to track the dispatch plan in real-time. We assume that the dispatch plan has a 30-sec resolution and is computed at 23.00 UTC the day before operations. This phase is detailed in Sec. III. • Real-time operations: DERs are controlled in real-time, so to compensate for power mismatches at the GCP between the realization and dispatch plan. The control problem is formulated as a distributed MPC. It accounts for future uncertainties along the optimization horizon, and DERs' and grid's constraints. The distributed formulation decouples the DERs' and the grid's problems, which can be solved iteratively until convergence. Real-time operations start at 00.00 UTC and end at 23.59.59 UTC. The formulation is detailed in Sec. IV.
In both stages, we model the grid with sensitivity coefficients (SCs), which express the nodal voltages, line currents, and grid losses as a linearized function of the nodal complex power injections. Let us consider a generic distribution grid with n b nodes and n l branches. Vectors v ∈ R (n b −1) and i ∈ R n l represent direct sequence nodal voltages magnitudes and branch currents magnitudes, respectively, and p ∈ R (n b −1) and q ∈ R (n b −1) the three-phase total nodal active and reactive controllable injections for all nodes except the slack node. Scalars p l , q l ∈ R are the total active and reactive transmission losses as seen at the GCP. The linearized nodal voltages, branch currents and the losses seen at the GCP are 1 : where and b l t ∈ R 2 are parameters for linearizations determined by SCs for time index t. They are determined with the method in [11] by solving a system of linear equations (that admits a single solution, as proven in [19]) as a function of the grid's admittance matrix and the knowledge of the system state. In the day-ahead phase, the SCs along the whole scheduling horizon are calculated using point predictions of the nodal injections. In the realtime phase, the SCs are updated at each control step using the most recent information on the grid state.

A. Design requirements of the dispatch plan
The objective of the day-ahead scheduling is to compute the dispatch plan, mainly the active power trajectory that the targeted distribution network should follow at its GCP during operations. The design requirements of the dispatch plan are: • stochastic variations from the dispatch plan due to distributed generation and demand should be compensated by the controllable resources while respecting their operational constraints; • the regulation made by the controllable resources does not violate grid constraints; • the power factor at the GCP should be near unity. The dispatch plan is computed with a stochastic optimization framework, where the stochastic injections of distributed generation and demand are modelled through forecast scenarios. Grid constraints are modelled with the linearized grid model discussed in the previous section. Operational constraints of the controllable resources are modelled accounting for the PQ capability of their power converters and state-of-energy constraints.

B. Computation of the dispatch plan
Let r = 1, . . . , R be the index of the controllable resources that can participate to the dispatch, T = [t 0 , t 0 + 1 . . . , t N ] the set of time indices of the scheduling horizon delimited by t 0 and t N . The set Ω collects the scenario ω for stochastic uncontrollable generation and demand. The active and reactive nodal power injections of controllable and uncontrollable resources for scenario ω are denoted by p ω t , q ω t and p unc,ω t , q unc,ω t respectively, where those last are from scenario forecasts. The nodal injections of the controllable resources are the decision variables of the problem and are collected in the vector x ω r,t = [p ω r,t , q ω r,t ]. Let s ω 0,t the complex power at the slack bus for time t and scenario ω. Let the complex number the decision variable for the dispatch plan for time t, where p disp t and q disp t refer to the active and reactive power respectively.
The main idea behind the proposed formulation is to determine a dispatch plan that can be tracked for any of the forecast scenarios. The problem consists in determining the injections of the controllable resources so as to minimize the deviation between the dispatch plan s disp and slack power for all the scenarios s ω 0 , ω ∈ Ω. Moreover, the cost function includes a resource-specific term f D r (x r,t ) that reflects the willingness of each controllable resource to provide regulating power (specific cost functions are described in Sec V-B1) and a coefficient λ r to weight them. Both the cost function and the coefficient can be designed by the modeller, for instance, based on a combination of resource's operating conditions (such as minimize wear and tear, power ramping, power variations etc.) or the monetary cost associated to it's operation. The cost function should be convex in order to keep the convexity of the overall problem formulation. The impact of the term λ r is investigated in the Appendix. The problem that we solve is: subject to the power flow at the GCP as a function of the nodal injections and losses power factor constraint at the GCP imposed by cos(θ) min linear voltage and current constraints (v min , v max are voltage limits, and i max lines' ampacities) and constraints for all controllable resources Once the problem in (4) is solved, the dispatch plan is the real part of its solutionŝ disp : C. Relaxation of the non-convex power factor constraint Eq. (4e) is non-convex and infeasible when the real power at the GCP is zero. As proposed in [20], we express the active power at the GCP as and replace Eq. (4e) with the following set of linear constraints: for all t ∈ T , ω ∈ Ω, where θ m refers to the angle corresponding to cos(θ) min . The two terms of (6) (p +,ω 0,t , p −,ω 0,t ) should be mutually exclusive. To this end, we augment the cost function (4a) with the following new term that promotes p +,ω 0,t , p −,ω 0,t being mutually exclusive, where v ≥ 0 weighs the significance of obeying power factor constraints.
IV. REAL-TIME OPERATION In the following, we describe the real-time control problem for tracking the day-ahead dispatch plan. Its objective is to determine the set-point for the controllable resources to track the dispatch plan while respecting the grid and resources constraints. Since the problem requires the knowledge of the state of the grid (i.e., nodal voltages and line currents), of all the components, and power flow at the grid connection point, the problem is initially formulated as a centralized MPC. We then acknowledge that the problem can be solved by consensus among multiple sub-problems as in [21], [22], and we derive a distributed formulation solved by means of the ADMM technique.
a) Centralized MPC: During real-time operations, the controllable resources are controlled so to track the dispatch plan at the GCP. The decision variable for the active and reactive nodal injection for resources r at time t is denoted by x r,t = [p r,t , q r,t ] and collected in x r = [x r,t , . . . , x r,t H ] for the length of the optimization horizon delimited by current time interval t and the control horizon t H . Let f r (x r,t ) denote the actuation cost of a generic resource r (the specific cost functions are described in Sec V-B2) andp disp t the dispatch plan set-point at time t from (5). The real-time control problem is formulated as MPC. The problem consists in minimizing the actuation costs of the resources subject to their operational constraints, dispatch plan objective, local grid constraints, and power factor limitations over the length of the optimization horizon. The problem is: subject to the dispatch constraint the power factor constraint at the GCP, imposed by cos (θ) min the constraints for all controllable resources and the constraints of the grid The formulation in (11) is convex thanks to the quadratic objective and linear constraints. For convenience in the following formulation, we denote the inequality (11d), (11f) and Solving the problem in (11) entails knowing the individual resource models and accessing their state during real-time operations. It is, therefore, referred to as centralized. Due to the privacy and security concerns for the resources' owners, the centralized approach may be impractical. For this reason, we resort to a distributed formulation that also assures better scalability with respect to the number of controllable resources.
b) Distributed MPC with ADMM: As in [12], a barrier function g is zero cost when the tracking error in (11b) is respected and infinity otherwise. We introduce a set of auxiliary variables z r that mimic the behaviour of the original variables x r , allowing the centralized problem to be separable in x r . Finally, using a sequence of Lagrangian multipliers, denoted by y r , and using scaled version of the ADMM sharing problem, the centralized problem (11) can be solved in following three iterative updates.
1) Original variables update: x k+1 3) Dual variable updates: Here, ||.|| 2 refers to the euclidean-norm, k is the ADMM iteration index, and u r = y r /ρ is a sequence of scaled dual variables, ρ being the standard ADMM penalty parameter. The original variable updates (also referred to as resource problems) (12) are computed in parallel for each resource, r = 1, . . . , R, then the copied variable update (grid aggregator problem) (13) solves an OPF accounting for the local solutions from each resource, and finally dual variables are updated in (14). Then, the updated solutions of the grid aggregator (copied and dual variables) are sent to the resources for next iteration. Eq. (12), (13) and (14) are solved till convergence. The problem in (12)- (14) is distributed because the resource problems (12) can be solved in parallel and independently without requiring the knowledge of the model of other resources as well as those of the grid. The resource problem requires just the updated solution from the grid (referred to as copied variable) through a communication channel. The diagram of the distributed computation is shown in Fig. 1. The convergence criterion is met when the primal residual norm r k = ||X k − Z k || 2 and the dual residual norm s k = ρ||Z k+1 − Z k || 2 are both smaller than a feasibility tolerance as in [22], where X = [x 1 ; . . . ; x R ], Z = [z 1 ; . . . ; z R ]. For the penalty parameter ρ, we follow a self-adaptive scheme [22], [23]: where τ incr and τ decr apply an adjustment scheme to guide the primal and dual residual norms to converge to zero. We fix µ = 10 and τ incr = 2 and τ decr = 2 as reported in [23].

A. Microgrid setup and Distributed Energy Resources
We validate our control and scheduling algorithms on the real-scale microgrid of the Distributed Electrical Systems Laboratory at EPFL. The setup of the microgrid is inspired by the CIGRE low voltage benchmark microgrid [13]. Its setup is shown in Fig. 2 that reports the grid topology, the ampacity limits of the cables, locations of the DERs, and the locations of the PMU-based monitoring equipment. The microgrid is operated at 400 V and is connected to a 20 kV medium voltage feeder through a 630 kVA 20/0.4 kV transformer. The microgrid interfaces a number of DERs. For this experimental validation, we consider a load emulator to reproduce stochastic demand, a controllable battery, and two curtailable PV plants, with specifications as reported in Table I. They are shown in Fig 3. The resources are interfaced with the microgrid by power electronics converters. The capability of each resource and associated power converter defines the feasible active and reactive power that can be drawn from each resource.  Fig. 2. The microgrid setup used for the experimental validation. We consider three controllable resources (a battery B at bus 5, and two curtailable PV plants PV1 and PV2 at bus 11 and 9) and a load emulator (L1 at bus 3).

B. Adaptation of the algorithmic framework to the selected DERs
We show how to customize the algorithms of sections III and IV to fit our experimental setup.
1) Day-ahead stage: In the day-ahead stage, we consider the battery to be the only controllable resource( 2 ). Its schedule is computed as described in the next paragraph. PV generation and demand are treated as stochastic injections and modelled with forecasts, as discussed later.
and the constraint set where SOE t is the BESS state-of-energy, T s is the sampling time (30 sec), and 0 ≤ a < 0.5 specifies a back-off margin from the SOE limits. Eq. (17b) constrains the battery's apparent power within its four-quadrant converter capability, which is shown in Fig. 4(a). We account for BESS power losses by integrating its equivalent series resistance into the network admittance matrix as described in [20]. b) Forecast scenarios of PV generation and demand: PV generation is forecasted starting from hourly point predictions of the global horizontal irradiance (GHI). These are from a weather forecast service provider (meteotest.ch) for the location of the experimental microgrid (46.5183 • N, 6.5652 • E). As forecasts do not include prediction intervals, we use the following procedure to infer scenarios (to model uncertainty) and increase their time resolution: • starting from historical GHI point predictions and measurements from the microgrid pyranometer, we create a training data set consisting of the 1-day-long series of point predictions and associated GHI realizations; • given with the GHI point predictions for the target day, we compute its (norm-2) distance from the historical point predictions, take the nearest s (where s is a parameter and is discussed later) and select the associated GHI realizations as potential scenarios of the GHI. The training data set includes two years of measurements from January 2017 at a time resolution of 30 sec. GHI data are scaled by the clear-sky irradiance to remove daily and seasonal components using the PVlib implementation of the Ineichen's clear-sky model [24]. PV generation is computed by transposing the GHI data and applying a physical model of PV generation accounting for the air temperature as in [25].
For the demand, we use the same method as in [4]. It consists in selecting s of 1-day long time series of historical measurements of the demand according to calendar information (working day/weekend, day of the week, the period of the year) of the day for which forecasts are to compute.
The selection of s is beyond the scope of the paper and it is defined by the user. In our case, it has been chosen as a trade-off between availability of historical measurements and forecasting performance. In particular, it was verified that including a larger number of scenarios from historical measurements was leading to a marginal improvement of the predicted densities and a negligible impact on the scheduling performance. If parametric forecasting methods are used instead (where the modeller can choose the number of scenarios to generate), s can be designed to achieve a target robustness level as proposed in [26].
2) Real-time operation stage: In real-time operations, all the controllable resources participate in achieving the dispatch objective by leveraging the distributed MPC presented in Sec. IV-0b. The local problem customized for the specific resources under consideration are discussed in the following. The resolution of the control action is 30 sec and the length of the optimization rolling horizon is 30 minutes. 3 a) Battery: the objective is to compute the active and reactive power set-points x b,t = [p b,t , q b,t ] while obeying to power rating and energy capacity limits. With reference to the resource problem in (12) the battery cost function is b) PV power plants: PV power plants can accept a control signal to curtail generation and implement a reactive power set-point. However, the curtailment action should be kept at a minimum to avoid an excessive impact on the PV capacity factor. The objective of this problem is determining active and reactive power set-points x g,t = [p g,t , q g,t ] so as to minimize the curtailment and operate at near-unity power factor while subject to the apparent power limit S g max of the 3 The choice of time resolution for the control action and the length of MPC optimization horizon is based on the combined time (ADMM computation + communication + implementation) taken by the real-time controller. Fig. 4. Feasible PQ set for the available DERs: a) battery can be controlled to provide both +/-active (P) and reactive powers (Q), b) PV1 can only provide + P (PV1 converter is not designed to receive external reactive set-points), and c) PV2 can be controlled to provide + P and +/-Q.
. converter. As PV generation is stochastic, the active power injection p g,t is upper-bounded by the theoretical maximum generation potential, that depends primarily on local irradiance conditions. We denote the upper bound of p g,t by p g,t . It is derived from short-term point predictions of the irradiance for the horizon 30 sec-30 min by applying the same physical modelling tool-chain described for the day-ahead stage. Short-term point predictions for the whole horizon are from averaging measurements over the last 2 minutes interval. While doing this, we assume irradiance persistence, that is often regarded to as the reference forecasting model for very-short term lookahead times [25]. In this work, we rely on short-term point predictions that are continuously updated by leveraging realtime measurements. In the case of slower refresh times of the control, one could implement prediction intervals to derive robust decisions as in [27]- [29] to hedge against longer-term uncertainties. With reference to the resource problem in (12), the PV cost function is subject to the constraint set Φ g (x g,t ) Equations (19b) and (19c) are the constraints on active and reactive power injections that account for power converter's capability and PV generation potential.
In the experiments, we use two curtailable PV units. They differ because they are interfaced to the grid with different power converters. Especially, one of them cannot accept reactive power set-points, whereas the other one can. Their capability curves are shown in Fig. 4(b) and 4(c), and are encoded in the constraint (19b) and (19c). c) Short-term forecast for the demand: Given the short look-ahead time, we use a persistent predictor to forecast the demand for the whole optimization horizon. from Phasor Management Units (PMUs), collected with the setup described in [30], [31] that is capable to deliver the measurements at 50 frames per second. A discrete Kalman filter-based state estimator processes the measurements [32] and provides the estimates of the voltage and current phasors of all the nodes and lines with a total latency of less than 80 ms w.r.t. the UTC-GPS time tag of the PMU measurements.
b) Real-time sensing and processing hardware: Each controllable resource is equipped with a micro-controller (National Instruments CRIO 9068). It is responsible for handling low-level communication tasks such as collecting resourcespecific measurements, implementing feasible set-points, and receive set-points from an upper-level controller (i.e., our real-time controller). These functionalities are implemented in LabView.
c) Communication infrastructure: the microgrid and its resources communicate over a dedicated IPv4 communication network [30]. It provides redundant packets routing using the iPRP redundancy protocol [33] and secure the messages with the multicast security approach proposed in [34]. A centralized time series database based on InfluxDB facilitates the exchange of information among the resources and the realtime distributed controllers. Fig. 5 shows the sequence of operations and communication flow among of the day-ahead scheduler and real-time controller. In the former phase (upper dashed rectangle), the dispatch plan is computed and stored in the time series database. In the latter (lower dashed rectangle), a real-time local SCADA, the short-term forecasters, and controllable resources save their outputs in the same database (at 1 sec resolution). The real-time controllers access this information to compute the control actions, which are then sent to the controllable resources for actuation through UDP. The setpoints are sent continuously to minimize packet losses. The ADMM resource problems are solved in parallel; the intermediate variables are also exchanged through UDP.  23.00 UTC daybefore operation, using the PV and load forecasts, and is stored on the central data-server. Real-time operations start at 00.00 UTC. SCADA and short-term forecasters store their outputs to the data server each second, and ADMM computes power set-points and implements each 30 sec.  a) Day-ahead operations: Fig. 6 shows the input and output information of the day-ahead dispatch process. The scenarios of the net demand (i.e., aggregated stochastic demand minus generation) at the GCP are shown in Fig. 6a which are inputs to the dispatch plan. The dispatch plan determined by the algorithm is shown in Fig. 6b (in red) along with the active power profile scenarios at the GCP (in different colors). The dispatch plan is at a 30 sec resolution. The corresponding battery's power and SOC are shown in Fig. 6c. As we can see from Fig. 6b, the dispatch plan appears to be tracked with high fidelity in all the scenarios thanks to the compensation action of the battery. Also, to avoid curtailing PV generation and saturating the battery flexibility, the dispatch plan is negative in the central part of the day, denoting that the microgrid exports active power to the upper-level grid. The initial SOC is 0.75, which is the SOC of the battery before the start of the real-time operation.

D. Implementation of the algorithms
b) Real-time operations: The real-time stage starts at 00.00 UTC. The active and reactive power set-points of the   controllable resources are computed with the distributed MPC algorithm illustrated in Section IV. The dispatch plan is tracked at a 30 sec resolution.
The control actions are computed one interval in advance with respect to the actuation time (i.e., 30 sec earlier) and then sent to the resources for being actuated at the designed time interval. Fig. 7a shows the power at the GCP with and without the dispatch control action (in shaded gray and solid red), and the dispatch plan (in black). As it can be seen, the dispatch plan is tracked with very high fidelity. Fig. 7b shows in the upper panel the battery's active power injection, and SOC evolution in the lower panel. Fig. 7c shows the measured PV production (in shaded gray and green) and their generation potentials (in dotted blue and red). In this case, there is no curtailment as the battery action alone is sufficient to track the dispatch plan.
To evaluate the dispatch plan-tracking performance, we compute the root mean square error (RMSE), mean, and maximum absolute error (MAE) of the difference between the achieved power at the GCP and the dispatch plan, normalized by the mean of the dispatch plan, with and without control. Results for day 1 are summarised in Table II and show that the control action achieves way better scores than a simple dispatch plan purely based on forecasts. The mean, max and standard deviations (SD) of the time and number of iterations to solve the distributed MPC problem are shown in Table III. As we can see, the mean and maximum time are well within the 30 sec deadline for the control action actuation.   Fig. 8a. Compared to day 1 that featured clear-sky conditions, day 2 is partly cloudy and exhibits lower PV generation levels. As a consequence, the dispatch plan, shown in Fig. 8b, is positive during all day. The corresponding battery's power and SOC are shown in Fig. 8c. Again, we can see that the dispatch plan is being tracked with high fidelity in all the scenarios thanks to the compensation action of the battery. b) Real-time operations: Fig. 9a shows the power at the GCP with and without the dispatch control action, and the dispatch plan. As visible, the dispatch plan overestimates the net demand in the central part of the day and early afternoon.
To track the dispatch plan, the controller charges the battery, which, however, approaches a situation of depleted flexibility as it is near the upper SOC limit. As a consequence, the controller curtails both PV power plants starting from 14h, as shown in Fig. 9c. The curtailment action is paramount to follow the dispatch plan at the GCP, which is accurately tracked as visible in Fig. 9a.
The tracking performance reported in Table II scores slightly worse RMSE than day 1 because of the partly cloudy sky conditions which determine higher PV generation variability. Computation performance in Table III denotes that the control actions are successfully computed within the 30 sec deadline.

B. Further analysis
This section is devoted to the following analyses: i) we perform a sensitivity analysis on the performance of the distributed approach by increasing the number of controllable elements and ii) we compare the performance (i.e., optimality (a) Dispatch plan (in black), measured power at the GCP (shaded gray) and power at the GCP without control (red).
(b) Top: realised battery power injection, bottom: SOC and its limits.
(c) Realised generation for PV1 (shaded gray), realised generation for PV2 (shaded green), maximum power for PV1 and PV2 (dashed blue and red).  and computation time) of the centralized vs the distributed formulations. The analysis is performed by considering the same conditions as day 1. 1) Analysis of the algorithms performance with respect to the number of controllable units: This analysis is carried out by dedicated simulations with different number of distributed BESSs. These resources are considered to have identical power rating and total energy capacity equal to the one of the BESS in the experimental validation. The largest number of controllable BESS is equal to 4 units since it appears a reasonable estimate of the possible largest number of BESSs that could be installed in a low-voltage distribution network as the one that we have considered. Indeed, a larger number of BESSs would result in excessively small BESS power ratings (compared to the nominal power of the nodes) and would multiply grid connection costs. The additional BESSs are placed at nodes 5, 6, 7, 8 respectively. Table IV reports the corresponding computational performance. Fig. 10 shows the boxplots of the computation time taken by each resource and the grid for the distributed scheme (the figure refers to a daily time horizon). The total computation time is given by the maximum  2) Performance comparison of the centralised vs the decentralised algorithms: Table V shows the results of the comparison in terms of dispatch tracking (measured by RMSE, mean and MAE in % of the mean of the dispatch plan) and computation time performance of the two proposed algorithms. As visible from Table V, the dispatching performance in both cases is very similar. The computation time of the centralized algorithm is shorter than the distributed one. This is to be expected because the distributed optimization formulation requires multiple iterations of the optimization problems to converge to a solution, whereas the centralized algorithm solves a single optimization problem. However, the latter needs to know the complete models of PV and BESS resources, which might not be available in real-life especially when resources belong to different owners. Another advantage of the distributed algorithm is that it is solved by several computers usually characterised by low computing power, whereas the centralized algorithm does require a single computer with significantly larger computing power.

VII. CONCLUSIONS
We proposed and experimentally validated a scheduling and control framework for DERs that achieves to track a dispatch plan at the GCP of a distribution network that interconnects heterogeneous resources while respecting constraints on nodal voltages and lines ampacities of the local grid. In the scheduling phase, we determine an aggregated dispatch plan at the GCP by accounting for forecasts of stochastic generation and demand, the state of the controllable resources, and constraints of the grid. During real-time operations, a distributed MPC adjusts the power injections of the controllable DERs to track the dispatch plan subject to grid's and DERs' operational constraints. We leverage a distributed formulation for improved scalability and privacy-preserving properties. To achieve a tractable formulation of the control problem, we used a linearized grid model based on sensitivity coefficients, computed considering point predictions in the scheduling phase, and updated by using the most recent grid state during real-time operations.
The framework is experimentally validated in a real-scale microgrid hosting heterogeneous controllable resources and monitored with PMUs. The dispatch plan, which is at a 30 sec resolution, is computed the day before operations for the next calendar day. The real-time control set-points are implemented every 30 sec for all day. Experimental results, carried out on two distinct days characterized by different irradiance and PV generation patterns, showed that the proposed framework achieves a reliable and accurate dispatch on a 30 sec basis, with RMS and mean tracking errors smaller than 5% and 2%, respectively, while respecting all grid constraints. APPENDIX A. Sensitivity of dispatch plan quality with weighing coefficient We vary the weighing coefficient λ r over a range of values and recompute the dispatch plan. To quantify the reliability of dispatch plan, we use the mean of RMSE (mRMSE) between each prosumption scenario and the obtained dispatch plan. mRMSE is normalized and expressed in % of the mean of the dispatch plan. As an example, Table VI lists the mRMSE for different λ r for the dispatch computation on Day 2. It can be seen that the variation in the mRMSE for different values of λ r , expressed as percentage of the average dispatch plan, is small (less than 4 % for λ r variation from 0.5e-5 to 0.5) and thus the performance of the proposed problem formulation appears invariant with respect to the value of λ r .