{'fraction_non_alphanumeric': 0.028817166164213513, 'fraction_numerical': 0.007137790388366732, 'mean_word_length': 4.943873517786561, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Improved microgrid resiliency through distributionally robust optimization under a policy-mode framework

Critical energy infrastructure are constantly under stress due to the ever increasing disruptions caused by wildfires, hurricanes, other weather related extreme events and cyber-attacks. Hence it becomes important to make critical infrastructure resilient to threats from such cyber-physical events. However, such events are hard to predict and numerous in nature and type and it becomes infeasible to make a system resilient to every possible such cyber-physical event. Such an approach can make the system operation overly conservative and impractical to operate. Furthermore, distributions of such events are hard to predict and historical data available on such events can be very sparse, making the problem even harder to solve. To deal with these issues, in this paper we present a policy-mode framework that enumerates and predicts the probability of various cyber-physical events and then a distributionally robust optimization (DRO) formulation that is robust to the sparsity of the available historical data. The proposed algorithm is illustrated on an islanded microgrid example: a modified IEEE 123-node feeder with distributed energy resources (DERs) and energy storage. Simulations are carried to validate the resiliency metrics under the sampled disruption events.

together locally as a single controllable entity [6]. In our framework, we assess the risk associated with various cyberphysical events and based on the risk assessment operate the system under a particular policy-mode. This allows us to be resilient against the risks without being overly conservative. Then in order to deal with the sparsity of data available on such cyber-physical events, we develop a distributionally robust optimization (DRO) formulation that is robust to a range of disturbance distributions.
Literature review/related work: Chance constraints constitute a means to provide certain guarantees on constraint satisfaction under uncertainty [7] and have found applications in several domains including in power system optimization under uncertainty. The authors in [8] provide a chance constraint formulation for distribution systems with renewable energy resources to enforce voltage regulation with prescribed probability and employ convex approximations of the chance constraints to obtain a computationally tractable formulation. A similar chance constraint formulation is utilized for transmission systems in [9], where a tractable formulation is obtained via partial linearization and a sample based reformulation. A real-time implementation of chance-constrained decision making is provided in [10], where the feasible region of the chance constraint optimization is updated based on real-time measurements. However, a major drawback of chance constraint formulations is that they only consider the probability of constraint violation and not the impact. In many critical infrastructure systems, minimizing the impact of uncertainties is far more significant. Furthermore, many of these methods require assumptions on the probability distribution of the uncertainty and convex reformulations exist only for a very small set of such distributions (e.g., Gaussian), which may not hold in practice.
Distributionally robust chance constraint problems have been well studied in the literature [11]. In power systems, to deal with the distributional robustness, the authors in [12] consider a family of uncertainty distributions and provide convex reformulations for them. They also consider a conditional value at risk (CVaR) approach that accounts for the risk in constraint violation, as opposed to the probability. Similarly, the authors in [13] formulate a tractable problem for log-concave distributions and in [14] the authors formulate a moment based ambiguity set for joint chance constraint formulation, whereas in [15] a primal-dual subgradient method is considered to optimize risk constrained optimization problems. Even though, these methods consider the risk in constraint violations, they can often be overly conservative and furthermore still require assumptions on the underlying distribution (e.g., moments) to be accurate.
In case the uncertainty distribution is not known beforehand, sample based approaches have been used in literature [16]. However, in case of rare events sampling based approaches cannot be applied directly, since they would require an impractical number of samples to yield reasonable solutions [17], something which may not be available in practice. To deal with this issue, Wasserstein ambiguity sets have been considered in the literature [18] where the chance and risk constraints are required to hold for a family of distributions within a distance (Wasserstein distance) from the observed realizations of uncertainty. The Wassersteindistance based ambiguity set constructed from historical data is applied for solving the OPF problem in [19] and a reformulated linearization technique is used to obtain a deterministic LP formulation in [20]. In [21] the data-driven Wasserstein ambiguity set is utilized to compute control policies in the multi-stage OPF problem. The Wasserstein ambiguity set based DRO is applied to the islanded microgrid case in [22] and to the multi-microgrid case in [23].
Even though these methods are distributionally robust, they can be overly conservative in certain situations, especially when there are a large possible number of events and sources of uncertainty present in the system. To deal with the large number of physical events that can disrupt critical infrastructure systems in a manner that is not overly conservative, we formulate a policy-mode based DRO formulation. The policy-mode decides the mode in which the system is operated under from amongst a finite number of modes. The operational policy-mode in turn is decided based on the risk-prediction of various events. Several works in literature have developed risk-based approaches that predict the risk of outages [24] and various events such as proactively deenergizing grid components in the context of extreme wildfire risk [25]. Such risk-prediction can often be based upon publicly available data, such as the wildfire risk data from the United States Geological Survey, in case of predicting events such as Public Safety Power Shutoff (PSPS) [26]. In this work, we assume the availability of such riskpredictions of various events and then utilize the historical data of such events to formulate a data-driven risk-based DRO formulation for a microgrid. The main advantages of our approach is that it is robust to discrepancies in sampled distribution from historical data by utilizing the Wasserstein ambiguity set, while at the same time avoids being overly conservative by considering the risk-prediction of various events and based on the risk-prediction metrics operate the system under a particular policy-mode considering only a subset of possible events.
The rest of the paper is organized as follows: Sec. II provides the modeling of the microgrid setup and it's various chance constraint and risk constraint formulations. Sec. III introduces the Policy-mode framework that considers the risk-prediction of various events and based on these operates the system under a particular policy-mode to avoid being overly conservative. Sec. IV presents the distributionally robust formulation that utilizes the Wasserstein ambiguity set framework. Sec. V provides the simulation results that showcase the efficacy of the proposed approach and, finally, Sec. VI provides conclusions and the scope for future work.

II. MODELING AND PROBLEM FORMULATION A. Baseline optimization
We consider a microgrid with various distributed energy resources, including solar photovoltaics (PVs), diesel generators (DGs), and energy storage (ES) units. The distribution network power-flow can be expressed by the following linear equations in Branch Flow Model (BFM) format [27]: where: W n,k := V n,k ·V * n,k , I n,m,k := i n,m,k · i * n,m,k . and where V n,k denotes the multi-phase voltage vector at bus n ∈ N , i n,m,k denotes the multi-phase current flowing from bus n to bus m, S n,m,k , P n,m,k and Q n,m,k denote the apparent, active and reactive branch power flow from n → m, Z m,n be the impedance matrix of branch (n, m) ∈ L , S net n,k = P net n,k + jQ net n,k be the net apparent power injection at bus n and where N denotes the set of buses, L ⊂ N × N denotes the set of all branches and k denotes the time-step. Table lists the symbols denoting the apparent, active and reactive power associated with each of the energy resources and loads. In addition the following operational reliability The full description of these constraints and other constraints on battery State-of-charge (SoC) and solar and load curtailment is omitted here for lack of space and can be found in [28]. The decision variables in this problem are: where x denotes the decision variables (e.g., DG dispatch), f (x) is the problem objective (e.g., minimize operating cost) and g(x) are the system constraint (e.g., line limits) The optimization problem in (3) does not consider uncertainty in system parameters or forecasts, which are critical for practical applications. The next section will consider the optimization problem under uncertainty.

B. Optimization under uncertainty
Uncertainty in the system can arise from various adversarial cyber-physical events, like a DG outage, a load-masking attack or a sudden loss in solar generation. In order to be resilient against such events, it is important to have sufficient reserves in the dispatchable resources (DG, PV, storage, and interruptible load) so that these can adjust their output in response to adversarial events. The purpose of this work is to formulate probabilistic methods that determine the amount of reserves requires to deal with such adversarial events in a resilient and cost-effective manner. If we consider a bounded set of uncertainty w ∈ Ω W , then the stochastic optimization problem can be expressed as: where x also includes additional decision variables in the form of reserves. However, the above optimization problem is infinite dimensional and cannot be solved in a scalable manner. In the next section, we briefly describe some of the traditional probabilistic methods that are used to solve (4).

C. Chance constraint formulations
In this section, we briefly present various stochastic optimization reformulations to solve (4). One common approach is to robustify (4) against a specified set of adversarial events. In the most general form, the robust optimization problem can be expressed as: The above optimization problem can be reformulated using the explicit maximization method, details of which can be found in [28], [29]. However, a robust approach can be overly conservative, especially when the set w ∈ Ω W is large. In such situations, chance constraints based methods can be better employed that avoid constraint violation with a certain probability. The general chance constraint optimization can be expressed as: where ρ is the pre-specified allowable constraint violation. More details about the chance constraint techniques and their convex reformulations can be found in [8], [9]. One of the main drawbacks of chance constraint methods is that is considers the probability of an event and not the magnitude of constraint violation (risk) of the event. In order to consider the risk of constraint violation, the Conditional value at risk or CVaR method has been employed in the literature [12], [17], especially to deal with low probability high impact events, that would otherwise be neglected by the chance constraint formulation.
In general the CVaR formulation can be expressed as: Even though CVaR methods account for low probability high impact events, they have an underlying assumption on the probability distribution of the uncertainty, i.e., the historical data used to represent w ∈ Ω W matches the actual distribution. However, in many practical situations the historical data on adversarial events can be very sparse and hence may not represent the true distribution of such adversarial events. In such cases, distributionally robust optimization (DRO) methods have shown promise [18], [19]. However, they do not deal with the potential conservativeness of such methods when the adversarial set is large. In the next section, we present a Policy-mode based framework that selects a subset of events to consider in the DRO formulation.

III. POLICY MODE FRAMEWORK
In this section we present a Policy-mode framework implementation for the DRO formulation which is depicted in Fig. 1. In the first stage, shown by the Scenario Generation block, we enumerate the different events, adversarial attacks, breakdowns, faults and forecast error that can happen in the system. For the microgrid test case shown in Fig. 2, we list the various events in Table II. The list of possible events is then passed on to an Event Predictor block that based on recent and historical information on the events, determines the probability of various events occurring along with the location of their occurrence. Examples of methods that could be utilized for such event prediction exist in literature for outages caused by wildfires and other weather related events [24]- [26]. The output of the Event Predictor block is an Event-Location probability matrix that predicts the probability of an event occurring at a particular location as illustrated in Fig. 1. For the microgrid test case, the probability distributions for the events is depicted in Fig. 3, which highlights the heterogeneity amongst different events and why a single distribution cannot be used to represent all of these events. Next, the Event Probability matrix is fed into the Mode Selector block that decides the system mode of operation using simple if then else rules on the Event Probability matrix. As an example, Fig. 1 lists the modes that the system can operate in and depending upon the values in the Event probability matrix, the Mode Selector block chooses to operate the system in one or a combination of these modes. For the microgrid test case, the mode selection  can be based upon the impact of various events at different times as shown in Fig. 4, which can be used to demarcate the time periods into different modes of operation. The reason for using a Mode Selector is to avoid being overly conservative as over a given time horizon only a subset of adversarial events will have significant probability of causing violations in the system constraints. Finally, the modes of operation along the Event probability matrix is fed to the D.R.Optimization block, that solves a DRO problem and provides resilient operating points and reserves required by the system to operate in a safe manner.

FORMULATION
In this Section we will present the Distributionally robust optimization (DRO) formulation. Several works in literature including [19], [20], [22] have used the Wasserstein ambiguity set technique for DRO. The next section outlines the Wasserstein ambiguity set approach that will then be embedded within the DRO framework.

A. Wasserstein Ambiguity Set
Here we present an overview of the Wasserstein ambiguity set method for DRO. In general, the Wasserstein distance between marginal distributions Q 1 and Q 2 is defined as: where π is the joint distribution of ζ 1 and ζ 2 , with marginal distributions Q 1 , Q 2 ∈ P(Ξ). In our case, the Wasserstein distance between the true distribution P and sample probability distributionP N is used to define the ambiguity setP N given by: where:P whereζ (k) ∈ R N and the samples of distribution and N is the number of such samples available. The value of ε(N) is chosen as: where β is the confidence level of the constraint satisfaction that is required (e.g., β = 0.05 when the constraints are (a) (b) Fig. 4: Impact of various events over time that can be used to decide the mode of system operation required to be satisfied with a 95% chance).
In the above expression, the value of C is calculated as: whereμ is the sample mean and the minimization over α can be solved using the bisection search method as outlined in [19]. Based on the above Wasserstein ambiguity set expression and given stochastic constraints of the form: can be expressed equivalently [19] to finding a set U such that: Consider the transformation v =Σ −1/2 (w −μ), which implies that: where based on the set V , the expression in (14) can also be equivalently expressed as [30]: where the set V can be expressed as: where σ can be found from solving the optimization problem: where: where the above optimization problem can again be solved with the bisection search method as outlined in [19].
Based on the solution of σ , the set V (σ ) can be expressed as: where Conv represents the convex combination and then the set U can be expressed as: This results in the following deterministic DRO formulation based on Wasserstein ambiguity set: Since the set U can be calculated beforehand, the optimization problem (23) can be solved in a scalable manner using off the shelf convex optimization solvers. The next section will provide simulation results on an IEEE-123 node microgrid system that showcases the efficacy of the developed DRO formulation and also compares it with the CVaR formulation.

V. SIMULATION RESULTS
To illustrate the DRO formulation, we peforms simulations on a modified three-phase IEEE-123 node systems [31] shown in Fig. 2, which is converted into an islanded microgrid by disconnecting the substation from the utility. Table II lists all the possible disturbance events along with their location in the system. These list of scenarios are fed to the Event Predictor block that predicts the probability of various events. Next the Event probability matrix is fed to the Mode Predictor, which based on the impact of different events, decides to operate the system in a particular mode from amongst a finite number of modes. In this case, Fig. 4a and 4b shows the impact of the different events over the given time-horizon. Hence based on these figures, Mode Selector chooses to operate the system in Mode 1 (Normal operation) from 0-15 minutes, in Mode 2 (Cyber threat mode) from 15-30 minutes, in Mode 3 (Extreme load loss) from 30-45 minutes and in Mode 4 (Blackout mode) from 45-60 minutes. This mode information along with the impact of different events is next used to solve the DRO formulation.
We solve the DRO with the event prediction risk probabilities and the forecast of distributions of uncertainty (based on historical data) based on the selected mode of operation. The output of the DRO provides the operating point of the generation and curtailment, along with the reserve values that would be required when the uncertainty reveals itself. It is assumed that the disturbance can be measured through the imbalance in supply and demand which manifests itself in the form of frequency deviation in the system. This frequency measurement is utilized by the flexible resources to dispatch their reserves when the disturbance event occurs [28]. To validate the resiliency of the optimization, we perform a series of simulations in GridLab-D [32] by sampling from the true uncertainty distribution. For each sample simulation, the output is calculated as the amount of violation in network constraints (specifically supply-demand imbalance in this case). After running N such simulations from sampled data of the true distribution, we obtain N cases of constraint violations. Based on these N outputs, we next calculate the probability of constraint violation utilizing CVaR metrics [12]. The results are validated if the risk of constraint violation from the simulation results is less than the chosen metric in the Wasserstein ambiguity set.
In the ideal case, we assume that the sampled distribution (based on historical data) matches the actual distribution of disturbance events as shown in Fig. 5. In this situation, we apply the CVaR formulation shown in (7) to solve the optimization problem and obtain the operating point and the reserve values. We then sample from the actual distribution to validate the results of the CVaR formulation. As can be seen from Fig. 6, in this case the reserves obtained from the CVaR formulation as sufficient (within the chosen 95% percentile) to manage system resiliency. If on the other hand, the sampled distribution does not match the actual distribution, as depicted in Fig. 7, then the assumptions of the CVaR formulation break-down and as a result we observe large constraint violations as depicted in Fig. 8. Next we apply the DRO formulation based on Wasserstein ambiguity set on the same set of sampled and actual distributions. As seen by the results in Fig. 9, the calculated reserves are able to manage the uncertainty in this case, as it accounts for the disparity between the sampled distribution and actual distribution. However, if the sampled and actual distributions match, then the method may be conservative as depicted in Fig. 10. Hence, it makes sense to apply the DRO method when there is ambiguity in the available historical data to accurately represent the true distribution of adversarial events. Furthermore, the results in Fig. 11 compare the constraint violation (supply-demand imbalance) between CVaR and DRO in the case when sample distribution is different from actual distribution (Fig. 7), which shows the large constraint violation in the CVaR case. Finally, to highlight the trade-off between resiliency (available reserves) and efficiency (inverse of cost), Fig. 12 shows the trade-off under 4 different modes of operation, when using CVaR in Fig. 12a and when using DRO in Fig. 12b, highlighting the larger resiliency in case of DRO but at the cost of lower efficiency.

VI. CONCLUSIONS
This paper presented a Policy-mode framework that based on available risk-predictions of various events, formulates a data-driven distributionally robust optimization (DRO) formulation for a microgrid. Wasserstein ambiguity set framework is utilized to deal with the sparsity in available historical data. Through simulation results we showcase the efficacy of our approach as compared to other probabilistic or risk based methods. Future work will look into further reducing the conservativeness of DRO methods and also investigate     the applicability of this approach to larger systems (e.g., networked microgrids).