In this post, we will write the DC optimal power flow (DC OPF) problem in matrix form and show how to differentiate the optimal solution with respect to the network parameters. This post largely follows the notation from our recent e-Energy paper, except that we will use the "Bθ" formulation of the DC power flow approximation.
Let d∈Rn be a vetor of nodal demands, and let g∈Rk be a vector of nodal generation. Let θ∈(−π,π]n be the bus voltage phase angles. Let f∈Rm be the line flows. The DC approximation of the power flow equations is p=Cg−d=−Bθ, where C∈{0,1}n×k is a node-to-generator incidence matrix such that Ci,u=1 if generator u is connected to node i and 0 otherwise.
The susceptance matrix can be written as B=A⊤diag(b)A, where A∈{−1,0,1}m×n is a line-to-node incidence matrix, and bij:=Im(1/zij)=rij2+xij2−xij is the imaginary component of the inverse of the series impedance of line (i,j). %Hereafter, we set L=−B=A⊤WA to be the Laplacian matrix that describes the DC power flow approximation, with W=−diag(b).
The decision variables are collected in the vector x=[θ⊤,g⊤]⊤∈Rn+k. The parameterized DC OPF program is the solution mapx⋆:Rn→Rn+k, which takes the form
where Q∈R(n+k)×(n+k), G∈R2(m+k)×n+k, and F∈Rn×(n+k). The parameter τ>0 is a small regularization parameter to yield a strongly convex objective. In a similar manner, we define the vectors
w=[0nβ],h=[f⊤,f⊤,g⊤,−g⊤]⊤,
then, DCOPF program (1) is equivalent to the standard quadratic program
xmins.t.21x⊤Qx+w⊤xFx=dGx≤h.
Let z=(x,μ,ν) be the vector of primal and dual variables associated with the DC OPF program, where x∈Rn+k, μ∈R2(m+k), and ν∈Rn, where the vector ν are the locational marginal prices (LMPs). The entries of μ are defined as
μ=(μf,μf,μg,μg).
The Lagrangian of the DC OPF program is
L(z;θ)=21x⊤Qx+w⊤x+μ⊤(Gx−h)+ν⊤(Fx−d).
Next, we construct a non-linear system of equations that describes the Karush-Kuhn-Tucker conditions for optimality of the program (4). Let z∗ be a solution to the program (4). The stationarity, complimentary slackness, and equality constraint feasibility conditions form a system of equations k(⋅) whose root is z∗. It is an exercise to show that the KKT operator k(⋅) is then
At an optimal solution z⋆, the Jacobian of the optimal solution with respect to the problem parameters θ is then given in closed form by the implicit function theorem as
∂θ∂z⋆=−(∂z∂k(z⋆;θ))−1∂θ∂k(z⋆;θ).
For example, if the parameters are the demands, θ=d, we solve the system
∂θ∂k(z⋆;θ)=⎣⎡0(n+k)×n02(m+k)×n−In×n⎦⎤,
thus, for an infintesimal change in demand Δd, and infinitesimal changes in the primal and dual variables Δx,Δμ,Δν, we want to solve the following linear system of equations: