A Generalized Framework for Chance-constrained Optimal Power Flow

Deregulated energy markets, demand forecasting, and the continuously increasing share of renewable energy sources call---among others---for a structured consideration of uncertainties in optimal power flow problems. The main challenge is to guarantee power balance while maintaining economic and secure operation. In the presence of Gaussian uncertainties affine feedback policies are known to be viable options for this task. The present paper advocates a general framework for chance-constrained OPF problems in terms of continuous random variables. It is shown that, irrespective of the type of distribution, the random-variable minimizers lead to affine feedback policies. Introducing a three-step methodology that exploits polynomial chaos expansion, the present paper provides a constructive approach to chance-constrained optimal power flow problems that does not assume a specific distribution, e.g. Gaussian, for the uncertainties. We illustrate our findings by means of a tutorial example and a 300-bus test case.

Variance of x

Introduction
The continuing increase in electricity generation from renewable energy sources and liberalized energy markets pose challenges to the operation of power systems [1]; i.e., the importance of uncertainties is on the rise.Uncertainty leads to and/or increases fluctuating reserve capacities, and varying line power flows across the network, among others.The structured consideration of uncertainties is thus paramount in order to ensure the economic and secure operation of power systems in the presence of fluctuating feed-ins and/or uncertain demands.
Optimal power flow (OPF) is a standard tool for operational planning and/or system analysis of power systems.The objective is to minimize operational costs whilst respecting generation limits, line flow limits, and the power flow equations.Assuming no uncertainties are present the solution approaches to this optimization problem are numerous, see for example references listed in [2].In the presence of stochastic uncertainties the OPF problem must be reformulated, ensuring (i) that technical limitations (inequality constraints) are met with a specified probability, and (ii) that the power flow equations (equality constraints) are satisfied for all possible realizations of the uncertainties, i.e. power system stability is achieved.Regarding issue (i), chance-constrained optimal power flow (CC-OPF) is a formulation that allows inequality constraint violations with the probability of constraint violation as a userspecified parameter.Individual chance constraints admit deterministic, distributionally robust convex reformulations of the CC-OPF problem [3].For Gaussian uncertainties these reformulations are exact [3][4][5].Alternatively, it is possible to solve the individually chance-constrained optimization problem by means of multi-dimensional integration [6,7].Scenario-based methods-often applied to multi-stage problems [8][9][10]-are an alternative to chance-constrained approaches; the chance constraints are replaced by sufficiently many deterministic constraints leading to large but purely deterministic problems [11].
Regarding issue (ii), the power flow equations are physical constraints that hold despite fluctuations.This requires feedback control.In particular, automatic generation control (AGC) balances mismatches between load and generation, given sufficient reserves can be activated.Affine policies have been shown to yield power references that satisfy DC power flow in the presence of (multivariate) Gaussian uncertainties [3][4][5]12] (assuming ideal primary control).Existing approaches [3][4][5]12] to single-stage CC-OPF under DC power flow and Gaussian uncertainties directly formulate the CC-OPF problem in terms of the parameters of the affine feedback, leading to finitedimensional second-order cone programs.However, the relevance and advantages of non-Gaussian uncertainties for modeling load patterns and renewables have been emphasized in the literature [13][14][15].Certain non-Gaussian distributions (such as Beta distributions) allow compact supports and skewed probability density functions, which hence overcome modeling shortcomings of purely Gaussian settings.For example, to model a load via a Gaussian random variable always bears a non-zero probability for the load acting as a producer.Arguably, this probability may be small, but an uncertainty description that rules out this possibility by design is physically consistent and desirable.
We remark that how to address the reformulation of inequality constraints in the problem formulation, i.e. issue (i), is a user-specific choice.As such, this choice resembles a trade-off between computational tractability and modeling accuracy.In contrast, the validity of the power flow equations, i.e. issue (ii) imposes a physical equality constraint that has to be accounted for in the problem formulation.The present paper proposes a general framework for chance-constrained OPF that combines modeling uncertainties in terms of continuous random variables of finite variance, and a rigorous mathematical consideration of the power flow equations as equality constraints of the OPF problem.It is shown that a formulation of the CC-OPF problem in terms of random variables naturally leads to engineeringmotivated affine policies.Under the mild assumption that uncertainties are modeled as continuous random variables of finite variance with otherwise arbitrary probability distributions, our findings highlight that the optimal affine policies are indeed random-variable minimizers of an underlying CC-OPF problem.
A consequence of the last item is that the proposed general framework to CC-OPF embeds and extends current approaches [3][4][5]12] which consider purely Gaussian settings.
The key step is to formulate the CC-OPF problem rigorously with random variables as decision variables.This unveils the infinite-dimensional nature of CC-OPF.A three-step methodology concisely describes the proposed approach to CC-OPF: formulation, parameterization, optimization.This results in optimal affine policies that satisfy power balance despite uncertainties.The corresponding optimization problem scales well in terms of the number of uncertainties.For common individual chance-constraint reformulations it leads to a second-order cone program.Polynomial chaos expansion (PCE) is employed to represent all occurring random variables by finitely many deterministic coefficients.
While PCE dates back to the late 30s [16], it has been applied to power systems only recently, for example to design a power converter [17], to design observers in the presence of uncertainties [18], and to solve stochastic power flow [19][20][21][22][23].The applicability of PCE to OPF problems under uncertainty has been demonstrated in [19][20][21][22].The works [21,22] focus on computational details when implementing PCE.In contrast, [19,20] mention that the power flow equations are always satisfied.However, [19,20] do not put PCE approaches to OPF in relation to other existing approaches, and do not show optimality of affine policies.Instead, the present paper takes a different view: starting from existing approaches [3][4][5]12] we show that PCE is a generalization; the more mathematical nature of PCE is thus related to the engineering practice of affine policies.
The present manuscript focuses on a framework for singlestage OPF problems under uncertainty, highlighting the importance of affine control policies rigorously irrespective of the kind of distribution of the uncertainty.Affine policies have also been applied to multi-stage OPF under uncertainty [8,10,24,25], where their use is motivated based on engineering intuition.For multi-stage OPF problems the handling of the inequality constraints is similar to single-stage OPF: it comprises analytically reformulated chance constraints [25], convex reformulations [26], and scenario-based approaches [27].
Summing up, the contributions of our work are as follows: We provide a problem formulation of chance-constrained OPF in terms of random variables that is shown to contain existing approaches [3][4][5]12].We further give a rigorous proof showing when affine policies are optimal.Additionally, we highlight an important dichotomy: optimal policies of chanceconstrained OPF correspond to optimal random variables.Finally, we provide a tractable and scalable reformulation of the random-variable problem in terms of a second-order cone program by leveraging polynomial chaos expansions.The combination of the contributions provide a tractable framework for chance-constrained OPF.
The remainder is organized as follows: Section 2 introduces the CC-OPF problem in terms of random variables, and demonstrates the flexibility of the proposed formulation: existing approaches for Gaussian uncertainties can be obtained as special cases (Section 2.2).The observations at the end of Section 2 lead to a three-step methodology to CC-OPF, presented in Section 4 in greater detail.Section 3 introduces polynomial chaos expansion as a mathematical tool that is required to tackle Section 4. The methodology developed in Section 4 is demonstrated for a tutorial 3-bus example in Section 5.1, and a 300bus test case in Section 5.2.

Preliminaries and Problem Formulation
Consider a connected N-bus electrical transmission network in steady state that is composed of linear components, for which the DC power flow assumptions are valid (lossless lines, unit voltage magnitude constraints, small angle differences).The N l lines have indices N l = {1, . . ., N l }.For simplified presentation each bus i ∈ N = {1, . . ., N} is assumed to be connected to one generation unit, and one fixed but uncertain power demand/generation.The net active power realization p ∈ R N is p = u+d, where u ∈ R N represents adjustable/controllable (generated) power, and d ∈ R N resembles (uncontrollable) power demand in case of d i < 0 for bus i ∈ N, or (uncontrollable) renewable feed-in in case of d j > 0 for bus j ∈ N. The goal of (deterministic) OPF is to minimize generation costs J(u) with J : R N → R such that the power flow equations are satisfied (equality constraints), and generation limits and line flow limits are satisfied (inequality constraints).Under DC power flow conditions the standard formulation for OPF reads where (1b) is the power balance with The generation limits and line limits are u, u ∈ R N and p l , p l ∈ R N l respectively, and φ ∈ R N l ×N is the power transfer distribution factor matrix, which maps the net power p linearly to the line flows p l ∈ R N l .

Stochastic Optimal Power Flow
Deterministic OPF (1) assumes perfect knowledge of the uncontrollable power d ∈ R N .Instead, stochastic OPF models power consumption and/or the power feed-in due to renewables as (non-trivial) continuous second-order random vectors d ∈ L2 (Ω, R N ) with Ω ⊆ R N as the set of possible outcomes. 1 We will show that the probabilistic modeling of d requires a reformulation of the deterministic OPF problem (1) in terms of random variables as decision variables.

Power Balance
Power balance despite probabilistic uncertainties can be achieved by-formally-optimizing over random variables.To see this, choose some fixed power generation u ∈ R N as in the OPF problem (1).Then, this will violate the power balance almost surely, i.e. a.s.∀ ξ ∈ Ω : where d = d( ξ) ∈ R N is the realization of the random variable uncontrollable power d for the outcome ξ ∈ Ω.Hence, 1 More precisely, given a probability space (Ω, F , P) the Hilbert space L 2 (Ω, R) w.r.t.measure P is the set of equivalence classes modulo the almosteverywhere-equality relation of real-valued random variables x : (Ω, F , P) → R with finite variance and inner product x, y = E xy , see [28].We refrain from explicitly mentioning the σ-algebra F and the probability measure P when referring to the Hilbert space.For R n -valued random vectors x : (Ω, F , P) → R n we introduce the shorthand notation x ∈ L 2 (Ω, R n ) w.r.t.probability measure P in the sense that x [x 1 , . . ., x n ] with x i ∈ L 2 (Ω, R).
we introduce a feedback policy u = u(d) ∈ L 2 (Ω, R N ) for the generators.More precisely, the feedback policy d → u(d) maps stochastic uncertainties d to power set points that ensure power balance despite uncertainties.Doing so, the decision variable u of OPF becomes itself a random variable. 2The requirement of power balance leads to the notion of viability [4].
Definition 1 (Viable policy [4]).A feedback policy u = u(d) is called viable if for any realization of the uncertainty d the power flow equations are satisfied. 3iability of the policy u(d) is ensured if the power balance is satisfied in terms of random variables or written in terms of realizations of the random variables where ũ( d) = u(d( ξ)) ∈ R N is the control input, and d = d( ξ) ∈ R N is the realization of the uncontrollable power.The decision variable of stochastic OPF is thus the random vector u ∈ L 2 (Ω, R N ) which corresponds to a feedback control policy.

Cost Function
For stochastic OPF the cost function has to map policies to scalars Ĵ : , where E [•] is the expected value [29].

Inequality Constraints
The presence of uncertainties requires the inequality constraints (1c), (1d) to be reformulated, because inequality constraints formulated in terms of random variables are in general not meaningful.This may be done, for example, either by using chance constraints (individual/joint) or robust counterparts.Possible chance constraint formulations are [5,8,30] joint: where p l, j is the random-variable power flow across line j.
Any feasible feedback policy of ( 6) is viable, see Definition 1.The solution of the infinite-dimensional problem ( 6)assuming it exists-is the optimal viable control policy u (d) that yields power balance for all realizations of the uncertainty d, and satisfies the constraints in a chance-constrained sense.Notice that the random-variable power balance is a direct consequence from modeling the uncertainties d as random variables.Instead, the specific choice of the cost function ( 4) and the chance constraint formulations are modeling degrees of freedom.Further, notice that the CC-OPF ( 6) does not assume a specific probability distribution for the uncertain power d.
Remark 1 (Economic dispatch vs. CC-OPF).Traditionally, an economic dispatch calculation provides base points for each generation unit, given some forcast.Automatic generation control (AGC) with prescribed participation factors accounts for mismatches in generation and demand online, i.e. it reacts to realizations of the uncertainties [31].Chance-constrained OPF attempts to unify both steps while considering the specific stochastic nature of the fluctuations, and ensuring economic and secure operation of the overall system.This also means that the solutions from CC-OPF are applicable on the same time scale as economic dispatch and AGC.
Remark 2 (Online OPF vs. CC-OPF).Online optimal power flow is another approach to tackle OPF under uncertainty [32].The main idea is to measure the realization of the uncertainty, to formulate and solve a corresponding OPF problem, and to apply the generation inputs to the grid.The conceptual advantage of online OPF is that it acts irrespective of the distribution of the uncertainty; the method reacts to realizations "online."However, online OPF relies on accurate online state estimation as well as reliable, fast, repeated, and accurate solutions of large-scale OPF problems.Chance-constrained OPF differs conceptually as it formulates a single optimization problem that determines policies intead of set points.These policies can be applied in real time, similarly to AGC.However, chanceconstrained OPF hinges on both the uncertainty model and the problem formulation.

Gaussian Uncertainties
The purpose of this section is to show that CC-OPF from (6) embeds existing approaches to CC-OPF under DC power flow and Gaussian uncertainties [3,12,33].To this end, we restate the setting from [3,12,33] entirely in random variables.
1.The deterministic cost function J(u) = h u is linear.

The uncertain power demand d is modeled as
with unknown u 0 , α ∈ R N . 4. Inequality constraints are modeled as individual chance constraints, and rewritten using the first and second moment, e.g. for upper bounds where ε ∈ [0, 1] is a user-defined security level. 5o obtain the numerical values of the expected generation u 0 and the coefficients α from Setting 1, [3,33] suggest solving the following optimization problem where p l, j is the j th entry of the line flow p l = φ (u + d) with the matrix of power transfer distribution factors φ.The nominal DC power flow and the summation condition (8b) ensure viability of the feedback policy u, cf.[4, Lemma 2.1].The generation limits and line flow limits are modeled as individual chance constraints that admit the exact reformulation (8c) and (8d) for Gaussian uncertainties [3]; they correspond to the individual chance constraint formulation from (5).Let u 0 , α denote the optimal solution of Problem ( 8)-assuming it exists.Then, the optimal feedback policy is Given the realization ξ of the random variable ξ the corresponding realization ũ of the random variable u becomes ũ = u ( ξ) = u 0 − α 1 N S d ξ, which is the control action.
Remark 3 (Gaussian random variables).Under Setting 1 the power demand d, the feedback policy u, and the line power p l are Gaussian random variables, with all covariance matrices being positive semidefinite.Moreover, all random variables admit an affine parameterization w.r.t. the stochastic germ ξ ∼ N(0, I N ).
Remark 3 shows and emphasizes the dichotomy of u: it is both a random variable and a feedback policy in terms of the (realization of the) stochastic germ, i.e. once the realization of ξ is known the evaluation of u(ξ) yields an applicable control. 6ow we can address the question raised at the beginning of this section, namely how CC-OPF (6) relates to Problem (8).To this end, consider CC-OPF (6) under Setting 1 with the cost formulation Ĵ(u Proposition 1 (Equivalence of ( 8) and ( 10)).Let the optimal solution to Problem (8) be u 0 , α ∈ R N .Furthermore, let the optimal solution to Problem (10) be u ∈ L 2 (Ω, R N ).Then, holds such that u ∼ N(u 0 , (α Proof.First, the cost function (10a) becomes E h u = h u 0 , which is (8a).Using the uncertainty modeling (7) the randomvariable DC power flow (10b) becomes The real-valued random variable x is a linear combination of the Gaussian random variables d and u, hence it is fully described by its mean and variance.The random variable x from (12) has to degenerate to zero according to (10b).This is the case if and only if its mean and variance are zero, This means that random-variable DC power flow under Assumption 1 is equivalent to considering the nominal DC power flow (14a) and the summation condition (14b), cf.(8b). 7he inequality constraints are identical by construction.The infinite-dimensional Problem (10) is equivalently represented by a deterministic finite dimensional problem in terms of u 0 and α.As such it is equivalent to Problem (8), and the optimal feedback follows from (7b).
The consequence of Proposition 1 is that Problem ( 8) is a reformulation of the infinite-dimensional Problem (10) in terms of the mean and variance of the Gaussian decision variable u.Problem ( 10) is thus a generalization of Problem (8).Further, the optimal policies stemming from the solution of Problem (8) are Gaussian random variables.Gaussianity of all occurring random variables follows from linearity of the DC power flow, cf.Remark 3. In fact, linearity of the DC power flow allows a more general statement when interpreted as a mapping: regardless of the distribution of the uncertainty d, the control u has-qualitatively-the same distribution.It hence stands to reason that Problem (10) allows the computation of optimal affine policies that satisfy power balance also for non-Gaussian uncertainties-which is shown in Section 4 by means of a threestep methodology.In preparation, however, we have to introduce polynomial chaos expansion as a tool that allows a structured treatment of random variables.

Polynomial Chaos Expansion
We review the basic elements of polynomial chaos expansion in Section 3.1; refer to [28,35] for a more detailed introduction.

Introduction
Consider n ξ independent second-order random variables ξ i ∈ L 2 (Ω i , R) w.r.t. the measure P i for i = 1, . . ., n ξ .The random vector ξ [ξ 1 , . . ., ξ n ξ ] is called stochastic germ.Denote by the support, and let P = P 1 • • • P n ξ be the product measure.Polynomial chaos then allows to express any random variable x ∈ L 2 (Ω, R) w.r.t.measure P as a linear combination of orthogonal n ξ -variate polynomials.To this end, let the Hilbert space L 2 (Ω, R) be spanned by the set of n ξ -variate polynomials {ψ } ∞ =0 that are orthogonal, i.e.
for all , k ∈ N 0 , where γ is a positive constant, and δ k is the Kronecker-delta.8W.l.o.g.we choose ψ 0 = 1. 9 Polynomial chaos allows to rewrite R n x -valued random vectors x = [x 1 , . . ., x n x ] with elements and The vector x contains all so-called PCE coefficients (16b).For numerical implementations the infinite sum (16a) is truncated after with The truncation error x i − xi is L 2 -optimal, i.e. lim L→∞ x i − xi = 0, in the induced norm • , see [28,35].The dimension of the subspace span {ψ } L =0 ⊆ L 2 (Ω, R) is where n ξ is the dimension of the stochastic germ and n d the highest polynomial degree.Hence, the subspace is spanned by orthogonal basis polynomials in n ξ variables of degree at most n d .Statistics of x can be obtained directly from the PCE coefficients, without having to sample, e.g.[28,35] Remark 4 (Higher-order moments).The fact that moments of the random variable x can be computed from its PCE coefficients alone can be leveraged for moment-based bounds or bounds that consider more than two moments [34].That is, highly skewed distributions may require more than two moments to reduce conservatism in (8c) and (8d).For which moments to include see, e.g.[34].If additional moments are included PCE is still applicable, but comes at a higher computational cost potentially, since convexity may be lost.
The applicability of PCE hinges on the dimension (L + 1) from (18).It is desirable to have both a low dimension and exact expansions.How to achieve this is considered next.

Exact Affine Polynomial Chaos
We are interested in random variables that admit a truncated polynomial chaos expansion that is both exact in the sense that (17) holds with equality, and affine in the sense that the maximum degree of the polynomial basis is one.
i.e., the orthogonal polynomial basis {ψ } L =0 has at most degree one.The R n -valued random vector x ∈ L 2 (Ω, R n ) is said to have an exact affine PCE if every entry x i admits an exact affine PCE (20) for i = 1, . . ., n.

In other words-Definition 2 demands the polynomial basis {ψ } L
=0 to be at most affine, i.e. the stochastic germ ξ appears in no higher order.It remains to discuss how to choose this specific polynomial basis.For a variety of well-known univariate distributions, for example Beta, Gamma, Gaussian, or Uniform distributions, the orthogonal bases that yield exact affine PCEs (17) are known.In the remainder we refer to these uncertainties as canonical uncertainties.

Distribution Support
Polyn.Basis is an exact affine PCE in the basis {ψ } 1 =0 .Example 1.Any univariate Gaussian random variable x ∼ N(µ, σ 2 ) admits the exact affine PCE with respect to the stochastic germ ξ ∼ N(0, 1) where [x 0 , x 1 ] = [µ, σ] are the PCE coefficients, and {ψ } 1 =0 = {He } 1 =0 = {1, ξ} is the affine Hermite polynomial basis that is orthogonal w.r.t. the univariate Gaussian measure, namely As can be seen, the univariate Gaussian admits an exact affine PCE in the Hermite polynomial basis.Of course it is possible to derive a polynomial chaos expansion of a Gaussian random variable in a different orthogonal basis, for example in a Legendre basis.In that case, however, the PCE of x will not be exact and affine with respect to this Legendre basis.
Going beyond canonical uncertainties, the exact affine PCE for any random variable of finite variance is obtained as follows.
Proposition 2 (Exact affine PCE for non-canonical uncertainty).Let x ∈ L 2 (Ω, R) with probability measure P be given.Then, x can be used directly as the stochastic germ, and the PCE of Proof.Direct inspection of ( 21) with the given PCE coefficients shows that x = x.Orthogonality of the basis {ψ } 1 =0 is shown by verifying the orthogonality condition (7b), which completes the proof.
According to Proposition 2, an orthogonal basis is then Both Corollary 1 and Proposition 2 consider a single univariate uncertainty.This may not suffice when modeling uncertainties for CC-OPF problems, where multiple sources of uncertainty are present (for example solar, wind, demand).However, the combination of several independent exact affine PCEs can still be cast as a multivariate exact affine PCE.

Proposition 3 (Multivariate exact affine PCE). Consider n independent random variables with exact affine PCEs
of dimension L + 1 = n + 1, cf. (18) with n ξ = n, and n d = 1.Let e i be the i th unit vector of R n , and let ψ = [ψ 1 , . . ., ψ n ] .Then, the PCE recovers the i th random variable x i .
Proof.The assertion follows from the fact that the space over the product probability space ) is isomorphic to the Hilbert space tensor product of the Hilbert spaces L 2 (Ω i , R), see [28].
Example 3. We illustrate how PCE applies to the multivariate Gaussian random variables from Setting 1: The stochastic germ ξ ∼ N(0, I N ) is R N -valued and standard Gaussian.According to Corollary 1 every univariate ξ i requires a Hermite polynomial basis {He i } 1 =0 = {1, ξ i } of degree at most n d = 1 for all i = 1, . . ., n ξ with n ξ = N.The tensorized PCE-basis from Proposition 3 is the N-variate Hermite polynomial basis {ψ } L =0 = {1, ξ 1 , . . ., ξ N } of dimension L + 1 = N + 1. Orthogonality holds w.r.t. to the multivariate Gaussian measure, i.e. for all i, j = 0, . . ., N The PCE (17) for the uncertain power demand (7a) from Setting 1 is then exact and affine . The R N -valued PCE coefficients d for = 1, . . ., N correspond to the columns of S d .Similarly, the PCE for the feedback policy (7b) from Setting 1 is exact and affine where the real-valued PCE coefficients u for = 1, . . ., N correspond to the columns of −α1 N S d .

Stochastic OPF in Three Steps
Recall that Section 2 concluded that CC-OPF according to Problem (10) provides optimal affine feedback policies irrespective of the probability distribution of d.On the other hand, Example 3 from Section 3 analyzes Setting 1 for CC-OPF from the point of view of PCE.The result is that the affine feedback from Setting 1 is equivalent to a PCE, and the solution to Problem (8) provides the optimal PCE coefficients from (3).In the following, both observations will be connected and it will be shown that the CC-OPF Problem (10) can be reformulated as an optimization problem in terms of PCE coefficents of optimal feedback policies.More precisely, the following three-step methodology is proposed: Step 1 Formulate a random-variable OPF problem.
Step 2 Introduce an affine, viable feedback.
Step 3 Determine the values of the feedback parameters by means of a suitable optimization problem.
We apply the three-step methodology exemplarily and demonstrate the role of PCE in it, more specifically the role of exact affine PCE as introduced in Section 3.2.That is, from this point on we associate with Step 1 the specific CC-OPF problem min Problem ( 25) is studied for the following setting: Setting 2 (Quadr.cost, exact affine PCE [20]).
1.The deterministic cost J(u) = u Hu+h u is quadratic and positive (semi-)definite in u.

The uncertainty d admits an exact affine
and the PCE coefficients d ∈ R N are known w.r.t. the polynomial basis {ψ } L =0 .3. The feedback policy u is given by its finite PCE where the PCE coefficients u ∈ R N are decision variables w.r.t. the polynomial basis {ψ } L =0 .4. The individual chance constraints (5c) are rewritten using the first and second moment, cf.Setting 1.
The main assumption in Setting 2 is finiteness and exactness of the PCE for the uncertainty d-which is no severe restriction, cf.Section 3.10 Setting 2 also addresses Step 2: it contains an affine feedback parameterization.It remains to show that this feedback parameterization is indeed viable.
Theorem 1 (Viable feedback control via PCE).Let the uncertain power demand d admit an exact affine PCE (26a).Then, any viable feedback control (26b) admits an exact affine PCE.
Proof.Viability of the feedback control (26b) follows from linearity of the random-variable DC power flow (10b).Under Setting 2 Equation (10b) becomes The basis {ψ } L =0 -which is at most affine by assumptionspans the (L+1)-dimensional subspace M = span{ψ } L =0 ⊆ L 2 (Ω, R). 11 All entries d i of d are elements of M. To attain a feasible feedback control for (27) it is necessary and sufficient to choose u i ∈ M; hence u is exact affine.To attain zero in (27), which corresponds to viability of the feedback control, L =0 1 N (d + u ) ψ = 0 must hold.Project onto the non-zero basis functions ψ , and exploit orthogonality which holds if and only if In short, Theorem 1 shows that affine policies are viable in case of exact affine PCEs for the uncertainty d.Importantly, viability of the affine feedback is a consequence only of linearity of the random-variable DC power flow.
Finally, Step 3 needs to be addressed, i.e. how to compute the PCE coefficients u tractably and efficiently.To this end, properties of PCE introduced in Section 3 are exploited to reformulate the cost function, the equality constraints, and the inequality constraints from Problem (25) in terms of PCE coefficients.

Cost Function
Under Setting 2 the cost function from Problem ( 25) reads E[J(u)] = E[u Hu + h u] for positive definite H. Exploiting orthogonality of the PCE basis, the cost function becomes [20] where the positive constant γ is computed offline according to (15).The cost (29a) is equal to the sum of the cost of the expected value J(E [u]) = J(u 0 ) and the cost of uncertainty.The cost of uncertainty has two origins: the monetary quadratic costs H, and the genuine cost of uncertainty due to uncertainty encoded by higher-order coefficients u for = 1, . . ., L.

Equality Constraints
Power balance (25b) in terms of random variables holds iff the power balance holds in terms of the PCE coefficients, This has been proved in Theorem 1, and is contained in (26b) from Setting 2.

Inequality Constraints
Moments of a random variable can be rewritten in terms of PCE coefficients, cf.(19).For the control input u this leads to where u i, is the -th PCE coefficient of the control input at bus i.
The same procedure applies to the uncertain line flows p l, j for lines l ∈ N l .

Optimization Problem
Combining the results (29), Step 3 leads to the following convex program [20] min Problem ( 30) is a convex second-order cone program (socp) where the PCE coefficients of the control inputs are decision variables.The optimal policy is obtained from the optimal solution u of socp (30) as follows Given a particular realization d of the uncertain demand, there exists a corresponding realization ξ of the stochastic germ, i.e. d = d( ξ).This, in turn, results in a realization of the feedback policy (31), namely the control input The control action (32) satisfies the DC power flow equations by construction.Similarly, the probability for violations of generation limits and/or line limits is accounted for.

Remark 5 (Realization d).
In practice it is the N-valued realization d of the power demand that is accessible, from which the n ξ -valued realization ξ of the stochastic germ has to be computed.This is straightforward for multivariate exact affine uncertainties for which n ξ = L, see Proposition 3.All basis polynomials of degree one can be concisely written as an R L -valued affine function A mild assumption is N ≥ n ξ = L, i.e. there are as many or more buses in the network than there are modeled sources of uncertainties.If the matrix DB has full column rank, then the system of linear equations (33) admits a unique solution by construction, because the realization ξ must be in the range of the rectangular matrix DB ∈ R N×L .

Numerical Scalability
The socp (30) is a tractable convex reformulation of the CC-OPF Problem (25), and it exhibits structural equivalence: the cost function remains quadratic and positive definite, the random-variable DC power flow remains linear.Also, the reformulated chance constraints are second-order cone constraints.Compared to a standard deterministic DC-OPF Problem (1) with N decision variables u i for i ∈ N, the socp (30) has N(L+1) decision variables u i, for i ∈ N and = 0, . . ., L; for every bus i the (L + 1) PCE coefficients have to be computed.In order to solve Problem (30), the positive numbers γ have to be computed.This can be done offline, for example via Gauss quadrature [28].
In general, the PCE dimension (L + 1) grows rapidly with the number of sources of uncertainty and the required univariate basis dimensions, see (18).However, problems with many sources of uncertainty are intrinsically complex, hence are expected to be challenging both conceptually and numerically.If exact affine uncertainties are used to model uncertainties, then the required dimension of the univariate bases reduces significantly.For example, if every bus is modeled by a distinct exact affine uncertainty, then the number of decision variables of the socp (30) becomes N(L + 1) = N(N + 1).
Remark 6 (Local balancing via PCE).PCE naturally yields local balancing policies [12], because every bus can react to all uncertainties individually, hence especially to its local source of uncertainty.Local imbalances can be accounted for locally, thus avoiding network congestions.Instead, the AGC feedback from Setting 1 is a global balancing policy: the AGC coefficient α j reacts to the sum of all fluctuations.This is motivated by current practice, where the sum of all fluctuations may be the only available broadcast signal by the tso.Then, however, local imbalances are, potentially, accounted for globally, thus possibly creating network congestions.Importantly, the PCE coefficients can be constrained to also yield a global balancing policy by enforcing equality of all non-zero-order PCE coefficients.

Case Studies
This section demonstrates the proposed method to CC-OPF for two test systems.Section 5.1 considers a 3-bus example in a tutorial style: the system is simple enough to provide an analytical solution, hence allows for insightful comparisons; canonical and non-canonical uncertainties are considered.Section 5.2 provides a concise study of the 300-bus test case.All units are given in per-unit values.

Tutorial 3-Bus Example
Consider the grid depicted in Figure 1: a connected 3bus network where buses 1 and 2 each have generators but zero power demand, and bus 3 has no generator but non-zero stochastic power demand.With slight abuse of notation set

Beta Distribution
We consider CC-OPF under Setting 2 with the following data: The separable quadratic cost has parameters Figure 2a shows the skewed probability density function (PDF) f d : [−1.5, −0.9] → R ≥0 of the demand d.Furthermore, an upper generation limit u 1 = 0.85 for the generator at bus 1 is considered via the chance constraint reformulation The chance constraint parameter is β u = √ (1 − ε)/ε for a risk level ε ∈ {0.05, 0.10}, which is a distributionally robust formulation [30].From Theorem 1 it is known that any viable feedback policy has to be exact affine w.r.t. the Jacobi polynomial basis, i.e. u = 1 =0 u ψ .The socp (30) for this setup becomes min with , where B(•, •) is the Beta function.Having solved (36), the optimal PCE becomes u = u 0 + u 1 ψ 1 in terms of the stochastic germ ξ; see Table 1 for numerical values of the optimal PCE coefficients.For practical considerations the optimal feedback policy in terms of the uncertain demand d is of interest.Using (34), this yields the following policies which satisfy the power balance, e.g. for ε = 0.05 The policies (37) are plotted in Figure 3a: generator 1 takes a bigger share in power generation because it is cheaper.A reduced risk level makes the slope of the policy of generator 1 more horizontal, hence more constraint-averse.The policies map a specific realization of the demand to a specific realization of the generation; this does not contain any information about how often certain control actions are taken.To obtain this information about frequency of occurrences the PDFs of the optimal feedback policies have to be studied; they are plotted in Figures 3b and 3c.They show how often certain optimal inputs are applied.One observes that the chance constraint remains (numerically) non-binding for either choice of ε.Analytically, the constraint violation probability becomes where u 1,0 , u 1,1 are the zero-and first-order PCE coefficient of generator 1, and F (a,b) is the cumulative distribution function of the Beta distribution with shape parameters a, b.Inserting the numerical values from Table 1 yields ε = 0.05 : P(u 1 ≤ 0.85) = 1 ≥ 1 − 0.05, (40a) ε = 0.10 : P(u 1 ≤ 0.85) = 1 ≥ 1 − 0.10. (40b) This shows that the employed chance constraint reformulation (35) is conservative for the considered skewed distribution from Figure 2a.To get the least conservative results, the closedform (39) should be used directly in the optimization (36), possibly leading to nonconvexities, hence harder problems to solve.

Sinusoidal Distribution
Sticking to the aforementioned grid from Figure 1  The upper generation limit remains u 1 = 0.85, as does the chance constraint reformulation (35).However, the chance constraint parameter is chosen as β u = Φ −1 (1 − ε) for risk levels ε ∈ {0.05, 0.10}, where Φ −1 is the inverse of the cumulative distribution function of a standard Gaussian random variable.The chance constraint reformulation is exact for Gaussian random variables [30].It is chosen here because the PDF of u is   symmetric and unimodal.Solving (36) yields the optimal PCE coefficients, listed in Table 1.The optimal policies are, using , which satisfy the power balance, e.g. for ε = 0.05 The policies (42) are plotted in Figure 4a: While the risk level does not have a big influence on the policies, the upper constraint generation u 1 is clearly violated for generator 1 for high demands (< −1.7).The PDFs of the generators are plotted in Figures 4b and 4c.The PDF of generator 1 confirms that the constraint violation occurs with non-negligible probability.The empirical constraint violation is given by where u 1,0 , u 1,1 are the zero-and first-order PCE coefficient of generator 1. Inserting the numerical values from Table 1 yields ε = 0.05 : P(u 1 ≤ 0.85) = 0.9511 ≥ 1 − 0.05, (45a) ε = 0.10 : P(u 1 ≤ 0.85) = 0.9105 ≥ 1 − 0.10. (45b) Hence, the employed chance constraint formulation is adequate for this case, because the optimization problem (36) remains convex, yet it is not overly conservative.

300-Bus Example
This subsection considers the ieee 300-bus test case which has N = 300 buses, N g = 69 generation units, and N l = 411 lines.The results build on the simulation study from [20], but the present work considers twice as many sources of uncertainties (20 in the present paper vs. 10 in [20]).
Specifically, we introduce 18 sources of uncertainties for power the demand at buses 17,61,77,120,121,122,139,192,204,217,218,225,228,231,234,235 where buses i ∈ {14, . . ., 218} ⊂ N u are modeled as Gaussians, and buses i ∈ {225, . . ., 246} ⊂ N u are modeled as Beta distributions (Table 2 lists the shape parameters).The mean and variance for the Gaussian uncertainties are computed such that the ±3σ-interval contains ±15 % deviations from the nominal value.Similarly, the support of the Beta distributions is the interval of ±15 % deviations from the nominal value.
Additionally, there is one source of uncertainty for wind power (modeled as a Gaussian), and one source of uncertainty for solar power (modeled as a Beta distribution with shape parameters (7,7)), yielding a total of n ξ = 20 sources of uncertainties.Solar and wind power are modeled to affect all buses.The constraint reformulation parameters β u and β l are chosen as β u = β l = √ (1 − ε)/ε with violation probability ε = 2.5 %.This choice ensures distributionally robust satisfaction of the chance constraints [30].
The optimal PCE coefficients are the solution to the socp (30), from which optimal policies are recovered. 12To  assess the quality of the optimized policies via CC-OPF we compare them to the policies from the most-informative case, namely in-hindsight OPF (hOPF) [36]; in-hindsight policies are obtained by sampling the uncertainties, and then solving a deterministic OPF problem for every sample. 13The policy from hOPF provides the best distribution of optimal inputs and satisfies the constraints strictly for every sample.
For the chance constraint reformulations to be exact, it is important that PCE computes the moments accurately.Let us assess the quality of the standard deviation-which is related to the second moment-as it acts as an uncertainty margin for the chance constraint reformulations, see (30). Figure 5 shows two values for the standard deviations, for all generation buses; one is computed by hOPF, the other is computed by CC-OPF.As can be seen from Figure 5 the numerical values are close.In terms of the 1-norm of the vectors of standard deviations, the power fluctuation from CC-OPF is marginally bigger, namely σ CC-OPF 1 = 1.7035 = σ hOPF 1 +0.0030.A closer look at Figure 5 reveals that the standard deviation from CC-OPF appears to be slightly larger for all buses except for bus 48, where it is significantly lower, σ hOPF − σ CC-OPF ∞ = |σ hOPF 48 − σ CC-OPF 48 | = 0.0090.The generator at bus 48 is connected to line 394 for which the line flow limit becomes binding.Compared to the hOPF solution, CC-OPF is more conservative and reduces the variability of the power injections at bus 48.
To conclude, CC-OPF finds by means of a single optimization problem optimal policies that satisfy the power balance strictly and that satisfy the inequalities in a chance constraint sense.The statistics of the policies from CC-OPF are consistent with the results from the best-informed hOPF solution, yet obtained at lower computation times.

Conclusions and Outlook
Given the continuously increasing share of renewables, the structured consideration of uncertainties for optimal power flow problems is paramount.Existing approaches to chanceconstrained OPF under DC conditions often employ affine feedback policies to account for fluctuations modeled via multivariate Gaussian uncertainties.Starting from a chance-constrained optimal power flow problem written in terms of random variables, this paper shows that the importance of affine policies is not related to the uncertainty model, e.g.Gaussian, but to the power balance constraint that maps random variables to random variables.In addition, the optimal affine policies are random variables whose realizations satisfy the power balance, and satisfy the inequality constraints in the chance constraint sense.The present paper proposes a three-step methodology to solving CC-OPF problems, namely formulation, parameterization, optimization.When formulating CC-OPF problems, it is argued that the choice of the cost function and chance constraint formulation are modeling choices, hence user-specific.In any case, an affine parameterization of the optimal policy is required due to power balance.The resulting parameterized optimization problem can be solved tractably and efficiently using polynomial chaos expansion, which results for example in a second-order cone program that scales well with the number of uncertainties.The proposed methodology is applied to a tutorial 3-bus example both for a standard and non-standard uncertainty model, and to the ieee 300-bus system.
The present paper has not investigated the relation between different problem formulations whatsoever.For example, what can be said about the minimizers if just the cost function formulation is changed?What is the "most meaningful" way to reformulate the cost and the inequalities in the presence of certain inequalities?To find an acceptable trade-off between conservatism and computational complexity is a topic worth pursuing.
The presented results hold for transmission networks under DC power flow assumptions.It is natural to ask whether the method can be extended to the more general case of AC power flow.In fact, [19,37] studied AC-OPF under uncertainty using polynomial chaos and showed that PCE provides policies of higher order than affine policies that satisfy the AC power flow equations numerically; however no rigorous proof is provided.
It remains an open research question what kinds of policies generally satisfy AC power flow.
Finally, in applications the data-driven computation of the PCE of the uncertain demand/feed-in may itself be challenging and subject to uncertainty about the uncertainty.Thus, distributionally robust PCE formulations are of interest in the future.

Figure 1 :
Figure 1: Three-bus system with two generators and one uncertain load.

Figure 2 :
Figure 2: Probability density of uncertain demand d.

Table 2 :
Shape parameters of Beta distributions for 300-bus example.