tn2 opf derivatives
TRANSCRIPT
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 1/25
AC Power Flows, Generalized OPF Costs and theirDerivatives using Complex Matrix Notation
Ray D. Zimmerman
February 24, 2010∗
Matpower Technical Note 2
c 2010 Power Systems Engineering Research Center (Pserc)
All Rights Reserved
∗First draft February 29, 2008
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 2/25
CONTENTS CONTENTS
Contents
1 Notation 4
2 Introduction 5
3 Voltages 6
3.1 Bus Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.1.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 63.1.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Branch Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.2.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Bus Injections 7
4.1 Complex Current Injections . . . . . . . . . . . . . . . . . . . . . . . 7
4.1.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 Complex Power Injections . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 84.2.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Branch Flows 11
5.1 Complex Currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115.1.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 115.1.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 11
5.2 Complex Power Flows . . . . . . . . . . . . . . . . . . . . . . . . . . 125.2.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 125.2.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 13
5.3 Squared Current Magnitudes . . . . . . . . . . . . . . . . . . . . . . . 155.3.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 165.3.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 16
5.4 Squared Apparent Power Magnitudes . . . . . . . . . . . . . . . . . . 175.4.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 175.4.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 17
5.5 Squared Real Power Magnitudes . . . . . . . . . . . . . . . . . . . . . 185.5.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 185.5.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 18
2
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 3/25
CONTENTS CONTENTS
6 Generalized AC OPF Costs 19
6.1 Polynomial Generator Costs . . . . . . . . . . . . . . . . . . . . . . . 196.1.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.1.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 206.2 Piecewise Linear Generator Costs . . . . . . . . . . . . . . . . . . . . 206.2.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 21
6.3 General Cost Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.3.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 226.3.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 23
6.4 Full Cost Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.4.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 236.4.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 23
7 Lagrangian of the AC OPF 247.1 First Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247.2 Second Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 4/25
1 NOTATION
1 Notation
nb, ng, nl number of buses, generators, branches, respectively
|vi|, θi bus voltage magnitude and angle at bus i
vi complex bus voltage at bus i, that is |vi|e jθi
V , Θ nb × 1 vectors of bus voltage magnitudes and angles
V nb × 1 vector of complex bus voltages vi
I bus nb × 1 vector of complex bus current injections
I f , I t nl × 1 vectors of complex branch current injections, from and to ends
S bus nb × 1 vector of complex bus power injections
S f , S t nl × 1 vectors of complex branch power flows, from and to ends
S g ng × 1 vector of generator complex power injections
P, Q real and reactive power flows/injections, S = P + jQ
M, N real and imaginary parts of current flows/injections, I = M + jN
Y bus nb × nb system bus admittance matrix
Y f nl × nb system branch admittance matrix, from end
Y t nl × nb system branch admittance matrix, to end
C g nb × ng generator connection matrix(i, j)th element is 1 if generator j is located at bus i, 0 otherwise
C f , C t nl × nb branch connection matrices, from and to ends,(i, j)th element is 1 if from end, or to end, respectively, of branch i isconnected to bus j , 0 otherwise
[A] diagonal matrix with vector A on the diagonal
AT (non-conjugate) transpose of matrix A
A∗ complex conjugate of A
1n n × 1 vector of all ones
4
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 5/25
2 INTRODUCTION
2 Introduction
The purpose of this document is to show how the AC power balance and flow equa-
tions used in power flow and optimal power flow computations can be expressed interms of complex matrices, and how their first and second derivatives can be com-puted efficiently using complex sparse matrix manipulations. Similarly, the deriva-tives of the generalized AC OPF cost function used by Matpower and the corre-sponding OPF Lagrangian function are developed.
We will be looking at complex functions of the real valued vector
X =
ΘV P gQg
(1)
For a complex scalar function f :Rn → C of a real vector X =
x1 x2 · · · xnT
,we use the following notation for the first derivatives (transpose of the gradient)
f X = ∂f
∂X =
∂f ∂x1
∂f ∂x2
· · · ∂f ∂xn
(2)
The matrix of second partial derivatives, the Hessian of f , is
f XX = ∂ 2f
∂X 2 =
∂
∂X
∂f
∂X
T=
∂ 2f
∂x21
· · · ∂ 2f ∂x1∂xn
... . . .
...
∂ 2
f ∂xn∂x1 · · · ∂ 2
f ∂x2n
(3)
For a complex vector function F :Rn → Cm of a vector X , where
F (X ) =
f 1(X ) f 2(X ) · · · f m(X )T
(4)
the first derivatives form the Jacobian matrix, where row i is the transpose of thegradient of f i
F X = ∂F
∂X =
∂f 1∂x1
· · · ∂f 1∂xn
... . . .
...∂f m
∂x1 · · ·
∂f m
∂xn
(5)
In these derivations, the full 3-dimensional set of second partial derivatives of F willnot be computed. Instead a matrix of partial derivatives will be formed by computing
5
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 6/25
3 VOLTAGES
the Jacobian of the vector function obtained by multiplying the transpose of theJacobian of F by a vector λ, using the following notation
F XX (λ) =
∂
∂X F X
T
λ (6)Just to clarify the notation, if Y and Z are subvectors of X , then
F Y Z (λ) = ∂
∂Z
F Y
Tλ
(7)
One common operation encountered in these derivations is the element-wise mul-tiplication of a vector A by a vector B to form a new vector C of the same dimension,which can be expressed in either of the following forms
C = [A] B = [B] A (8)
It is useful to note that the derivative of such a vector can be calculated by the chainrule as
C X = ∂C
∂X = [A]
∂ B
∂X + [B]
∂A
∂X = [A] BX + [B] AX (9)
3 Voltages
3.1 Bus Voltages
V is the nb × 1 vector of complex bus voltages. The element for bus i is vi = |vi|e jθi.
V and Θ are the vectors of bus voltage magnitudes and angles. Let
E = [V ]−1 V (10)
3.1.1 First Derivatives
V Θ = ∂V
∂ Θ = j [V ] (11)
V V = ∂V
∂ V = [V ] [V ]−1 = [E ] (12)
E Θ = ∂E
∂ Θ = j [E ] (13)
E V = ∂E
∂ V = 0 (14)
6
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 7/25
3.2 Branch Voltages 4 BUS INJECTIONS
3.1.2 Second Derivatives
It may be useful in later derivations to note that
V VV (λ) = ∂ ∂ V
∂V ∂ V
T
λ = [λ] E V = 0 (15)
3.2 Branch Voltages
The nl × 1 vectors of complex voltages at the from and to ends of all branches are,respectively
V f = C f V (16)
V t = C tV (17)
3.2.1 First Derivatives
∂V f
∂ Θ = C f
∂V
∂ Θ = jC f [V ] (18)
∂V f
∂ V = C f
∂V
∂ V = C f [V ] [V ]−1 = C f [E ] (19)
4 Bus Injections
4.1 Complex Current InjectionsI bus = Y busV (20)
4.1.1 First Derivatives
∂I bus
∂X =
∂I bus
∂ Θ∂I bus
∂ V 0 0
(21)
∂I bus
∂ Θ = Y bus
∂V
∂ Θ = jY bus [V ] (22)
∂I bus
∂ V = Y bus
∂V
∂ V = Y bus [V ] [V ]−1 = Y bus [E ] (23)
7
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 8/25
4.2 Complex Power Injections 4 BUS INJECTIONS
4.2 Complex Power Injections
Consider the complex power balance equation, Gs(X ) = 0, where
Gs(X ) = S bus + S d − C gS g (24)
and
S bus = [V ] I bus∗ (25)
4.2.1 First Derivatives
GsX =
∂Gs
∂X =
Gs
Θ GsV Gs
P g Gs
Qg
(26)
GsΘ = ∂S bus
∂ Θ = [I bus
∗] ∂ V ∂ Θ
+ [V ] ∂I bus∗
∂ Θ (27)
= [I bus∗] j [V ] + [V ] ( jY bus [V ])∗ (28)
= j [V ] ([I bus∗] − Y bus
∗ [V ∗]) (29)
GsV =
∂S bus
∂ V = [I bus
∗] ∂ V
∂ V + [V ]
∂I bus∗
∂ V (30)
= [I bus∗] [E ] + [V ] Y bus
∗ [E ∗] (31)
= [V ] ([I bus∗] + Y bus
∗ [V ∗]) [V ]−1 (32)
GsP g
= −C g (33)
GsQg
= − jC g (34)
4.2.2 Second Derivatives
GsXX (λ) =
∂
∂X
Gs
X Tλ
(35)
= Gs
ΘΘ(λ) GsΘV (λ) 0 0
Gs
V Θ(λ) Gs
VV (λ) 0 00 0 0 00 0 0 0
(36)
8
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 9/25
4.2 Complex Power Injections 4 BUS INJECTIONS
GsΘΘ(λ) =
∂
∂ Θ
Gs
ΘTλ
(37)
= ∂
∂ Θ j
[I bus
∗] − [V ∗] Y bus∗T
[V ] λ
(38)
= j ∂
∂ Θ
[I bus
∗] [V ] λ − [V ∗] Y bus∗T [V ] λ
(39)
= j
[V ] [λ] (− jY bus
∗ [V ∗]) ∂I bus
∗
∂ Θ
+ [I bus∗] [λ] ( j [V ])
∂V ∂ Θ
− [V ∗] Y bus∗T [λ] ( j [V ])
∂V ∂ Θ
−
Y bus∗T [V ] λ
(− j [V ∗])
∂V ∗
∂ Θ
(40)
= [V ∗]Y bus∗T [V ] [λ] − Y bus
∗T [V ] λ+ [λ] [V ] (Y bus
∗ [V ∗] − [I bus∗]) (41)
= E + F (42)
GsV Θ(λ) =
∂
∂ Θ
GsV Tλ
(43)
= ∂
∂ Θ
[E ] [I bus
∗] λ + [E ∗] Y bus∗T [V ] λ
(44)
= [E ] [λ] (− jY bus∗ [V ∗])
∂I bus∗
∂ Θ
+ [I bus∗] [λ] j [E ]
∂E∂ Θ
+ [E ∗] Y bus∗T [λ] j [V ]
∂V ∂ Θ
+
Y bus∗T [V ] λ
(− j [E ∗])
∂E∗
∂ Θ
(45)
= j
[E ∗]
Y bus∗T [V ] [λ] −
Y bus
∗T [V ] λ
− [λ] [E ] (Y bus∗ [V ∗] − [I bus
∗])
(46)
= j [V ]−1
[V ∗]
Y bus∗T [V ] [λ] −
Y bus
∗T [V ] λ
− [λ] [V ] (Y bus∗ [V ∗] − [I bus
∗]) (47)
= jG (E − F ) (48)
9
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 10/25
4.2 Complex Power Injections 4 BUS INJECTIONS
GsΘV (λ) =
∂
∂ V
Gs
ΘTλ
(49)
= j
[λ] [V ] Y bus
∗ −
Y bus
∗T [V ] λ
[V ∗]
−[V ∗] Y bus∗T − I bus
∗ [V ] [λ] [V ]−1 (50)
= GsV Θ
T(λ) (51)
GsVV (λ) =
∂
∂ V
GsV Tλ
(52)
= ∂
∂ V
[E ] [I bus
∗] λ + [E ∗] Y bus∗T [V ] λ
(53)
= [E ] [λ] Y bus∗ [E ∗]
∂I bus
∗
∂ V
+ [I bus∗] [λ] 0
∂E∂ V
+ [E ∗] Y bus∗T [λ] [E ]
∂V ∂ V
+ Y bus∗T [V ] λ 0
∂E∗
∂ V
(54)
= [V ]−1
[λ] [V ] Y bus∗ [V ∗] + [V ∗] Y bus
∗T [V ] [λ]
[V ]−1 (55)
= G (C + C T)G (56)
Computational savings can be achieved by storing and reusing certain interme-diate terms during the computation of these second derivatives, as follows:
A = [λ] [V ] (57)B = Y bus [V ] (58)
C = AB ∗ (59)
D = Y bus∗T [V ] (60)
E = [V ∗] (D [λ] − [Dλ]) (61)
F = C − A [I bus∗] = j [λ] Gs
Θ (62)
G = [V ]−1 (63)
GsΘΘ(λ) = E + F (64)
GsV Θ(λ) = jG (E − F ) (65)
GsΘV (λ) = Gs
V ΘT(λ) (66)
GsVV (λ) = G (C + C T)G (67)
10
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 11/25
5 BRANCH FLOWS
5 Branch Flows
Consider the line flow constraints of the form H (X ) < 0. This section examines 3
variations based on the square of the magnitude of the current, apparent power andreal power, respectively. The relationships are derived first for the complex flows atthe from ends of the branches. Derivations for the to end are identical (i.e. justreplace all f sub/super-scripts with t).
5.1 Complex Currents
I f = Y f V (68)
I t = Y tV (69)
5.1.1 First Derivatives
I f X =
∂I f
∂X =
I
f Θ I
f V I
f P g
I f Qg
(70)
I f Θ = Y f
∂V
∂ Θ
= jY f [V ] (71)
I f V = Y f
∂V
∂ V
= Y f [V ] [V ]−1 = Y f [E ] (72)
I f P g
= 0 (73)
I f Qg
= 0 (74)
5.1.2 Second Derivatives
I f XX (µ) =
∂
∂X
I f
X
T
µ
(75)
=
I f ΘΘ(µ) I f
ΘV (µ) 0 0
I f V Θ(µ) I f
VV (µ) 0 00 0 0 00 0 0 0
(76)
I f ΘΘ(µ) =
∂
∂ Θ
I f
Θ
T
µ
(77)
11
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 12/25
5.2 Complex Power Flows 5 BRANCH FLOWS
= ∂
∂ Θ
j [V ] Y f
Tµ
(78)
= −
Y f
Tµ
[V ] (79)
I f V Θ(µ) =
∂
∂ Θ
I
f V
T
µ
(80)
= ∂
∂ Θ
[E ] Y f
Tµ
(81)
= j
Y f Tµ
[E ] (82)
= − jI f ΘΘ(µ) [V ]−1 (83)
I f ΘV (µ) =
∂
∂ V
I f
Θ
T
µ
(84)
= ∂ ∂ V j [V ] Y f Tµ (85)
= j
Y f Tµ
[E ] (86)
= I f V Θ(µ) (87)
I f VV (µ) =
∂
∂ V
I
f V
T
µ
(88)
= ∂
∂ V
[E ] Y f
Tµ
(89)
= 0 (90)
5.2 Complex Power Flows
S f = [V f ] I f ∗ (91)
S t = [V t] I t∗
(92)
5.2.1 First Derivatives
S f X =
∂S f
∂X =
S f
Θ S f V S f
P g S f
Qg
(93)
=
I f ∗ ∂V f
∂X + [V f ]
∂ I f ∗
∂X (94)
12
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 13/25
5.2 Complex Power Flows 5 BRANCH FLOWS
S f Θ =
I f ∗
∂V f
∂ Θ + [V f ]
∂ I f ∗
∂ Θ (95)
=
I f ∗
jC f [V ] + [C f V ] ( jY f [V ])∗ (96)
= j(I f ∗C f [V ] − [C f V ] Y f ∗ [V ∗]) (97)
S f V =
I f ∗
∂V f
∂ V + [V f ]
∂ I f ∗
∂ V (98)
=
I f ∗
C f [E ] + [C f V ] Y f ∗ [E ∗] (99)
S f P g
= 0 (100)
S f
Qg = 0 (101)
5.2.2 Second Derivatives
S f XX (µ) =
∂
∂X
S f
X
T
µ
(102)
=
S f ΘΘ(µ) S f
ΘV (µ) 0 0
S f V Θ(µ) S f
VV (µ) 0 00 0 0 00 0 0 0
(103)
S f ΘΘ(µ) =
∂
∂ Θ
S f
Θ
T
µ
(104)
= ∂
∂ Θ
j
[V ] C f T
I f ∗
− [V ∗] Y f
∗T [C f V ]
µ
(105)
= j ∂
∂ Θ
[V ] C f
T
I f ∗
µ − [V ∗] Y f
∗T [C f V ] µ
(106)
= j
[V ] C f T [µ] (− jY f
∗ [V ∗])
∂I f ∗
∂ Θ
+
C f T
I f ∗
µ
j [V ]
∂V ∂ Θ
13
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 14/25
5.2 Complex Power Flows 5 BRANCH FLOWS
− [V ∗] Y f ∗T [µ] C f j [V ]
∂V ∂ Θ
−
Y f ∗T [C f V ] µ
(− j [V ∗])
∂V ∗
∂ Θ
(107)
= [V ∗] Y f ∗T [µ] C f [V ] + [V ] C f
T [µ] Y f ∗ [V ∗]
−
Y f ∗T [µ] C f V
[V ∗] −
C f
T [µ] Y f ∗V ∗
[V ] (108)
= F f − Df − E f (109)
S f V Θ(µ) =
∂
∂ Θ
S f V
T
µ
(110)
= ∂
∂ Θ
[E ] C f
T
I f ∗
µ + [E ∗] Y f
∗T [C f V ] µ
(111)
= [E ] C f T [µ] (− jY f
∗ [V ∗]) ∂I f
∗
∂ Θ
+ C f T
I f ∗
µ j [E ] ∂E∂ Θ
+ [E ∗] Y f ∗T [µ] C f j [V ]
∂V ∂ Θ
+
Y f ∗T [C f V ] µ
(− j [E ∗])
∂E∗
∂ Θ
(112)
= j
[E ∗] Y f ∗T [µ] C f [V ] − [E ] C f
T [µ] Y f ∗ [V ∗]
−
Y f ∗T [µ] C f V
[E ∗] +
C f
T [µ] Y f ∗V ∗
[E ]
(113)
= j [V ]−1
[V ∗] Y f ∗T [µ] C f [V ] − [V ] C f
T [µ] Y f ∗ [V ∗]
− Y f ∗T
[µ] C f V [V ∗] + C f T
[µ] Y f ∗V ∗ [V ] (114)
= jG (B f − B f T − Df + E f ) (115)
S f ΘV (µ) =
∂
∂ V
S f
Θ
T
µ
(116)
= j
[V ] C f T [µ] Y f
∗ [V ∗] − [V ∗] Y f ∗T [µ] C f [V ]
−
Y f ∗T [µ] C f V
[V ∗] +
C f
T [µ] Y f ∗V ∗
[V ]
[V ]−1 (117)
= S f V Θ
T
(µ) (118)
S f VV (µ) =
∂
∂ V
S
f V
T
µ
(119)
14
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 15/25
5.3 Squared Current Magnitudes 5 BRANCH FLOWS
= ∂
∂ V
[E ] C f
T
I f ∗
µ + [E ∗] Y f
∗T [C f V ] µ
(120)
= [E ] C f T [µ] Y f
∗ [E ∗]
∂I f ∗
∂ V
+
C f
T
I f ∗
µ
0
∂E∂ V
+ [E ∗] Y f ∗T [µ] C f [E ]
∂V ∂ V
+
Y f ∗T [C f V ] µ
0 ∂E∗
∂ V
(121)
= [V ]−1
[V ∗] Y f ∗T [µ] C f [V ] + [V ] C f
T [µ] Y f ∗ [V ∗]
[V ]−1 (122)
= GF f G (123)
Computational savings can be achieved by storing and reusing certain interme-diate terms during the computation of these second derivatives, as follows:
Af = Y f ∗T [µ] C f (124)
B f = [V ∗] Af [V ] (125)
Df = [Af V ] [V ∗] (126)
E f =
Af TV ∗
[V ] (127)
F f = B f + B f T (128)
G = [V ]−1 (129)
S f ΘΘ(µ) = F f − Df − E f (130)
S f V Θ(µ) = jG (B f − B f
T − Df + E f ) (131)
S f ΘV (µ) = S f
V Θ
T
(µ) (132)
S f VV (µ) = GF f G (133)
5.3 Squared Current Magnitudes
Let I 2max denote the vector of the squares of the current magnitude limits. Then theflow constraint function H (X ) can be defined in terms of the square of the currentmagnitudes as follows:
H f (X ) = I f ∗
I f − I 2max (134)
=
M f M f +
N f N f − I 2max (135)
where I f = M f + jN f .
15
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 16/25
5.3 Squared Current Magnitudes 5 BRANCH FLOWS
5.3.1 First Derivatives
H f X =
I f ∗
I
f X +
I f
I
f X
∗(136)
= I f ∗ I f X +
I f ∗ I f X ∗ (137)
= 2 ·
I f ∗
I f X
(138)
=
M f − jN f
(M f X + jN f
X ) +
M f + jN f
(M f X − jN f
X ) (139)
= 2
M f
M f X +
N f
N f
X
(140)
= 2
I f
I f X
+
I f
I f X
(141)
5.3.2 Second Derivatives
H f XX (µ) =
∂
∂X
H f
X
T
µ
(142)
=
H f ΘΘ(µ) H f
ΘV (µ) 0 0
H f V Θ(µ) H
f VV (µ) 0 0
0 0 0 00 0 0 0
(143)
H f XX (µ) =
∂
∂X
H f
X
T
µ
(144)
= ∂ ∂X
I f X T I f ∗µ + I f
X ∗T I f µ (145)
= I f XX (
I f ∗
µ) + I f
X
T
[µ] I f X
∗+ I f
XX
∗(
I f
µ) + I f X
∗T[µ] I f
X (146)
= 2 ·
I f XX (
I f ∗
µ) + I f
X
T
[µ] I f X
∗
(147)
H f ΘΘ(µ) = 2 ·
I f
ΘΘ(
I f ∗
µ) + I f Θ
T
[µ] I f Θ
∗
(148)
H f V Θ(µ) = 2 ·
I f V Θ(
I f ∗
µ) + I f
V
T
[µ] I f Θ
∗
(149)
H f ΘV (µ) = 2 · I f
ΘV (I f ∗µ) + I f Θ
T
[µ] I f V ∗ (150)
H f VV (µ) = 2 ·
I f VV (
I f ∗
µ) + I f
V
T
[µ] I f V
∗
(151)
16
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 17/25
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 18/25
5.5 Squared Real Power Magnitudes 5 BRANCH FLOWS
H f ΘΘ(µ) = 2 ·
S f
ΘΘ(
S f ∗
µ) + S f Θ
T
[µ] S f Θ
∗
(166)
H f V Θ(µ) = 2 · S f
V Θ(S f ∗µ) + S f V T [µ] S f
Θ∗ (167)
H f ΘV (µ) = 2 ·
S f
ΘV (
S f ∗
µ) + S f Θ
T
[µ] S f V
∗
(168)
H f VV (µ) = 2 ·
S f VV (
S f ∗
µ) + S f
V
T
[µ] S f V
∗
(169)
5.5 Squared Real Power Magnitudes
Let P 2max denote the vector of the squares of the real power flow limits. Then the flowconstraint function H (X ) can be defined in terms of the square of the real powerflows as follows:
H f (X ) =
S f
S f
− P 2max (170)
=
P f
P f − P 2max (171)
5.5.1 First Derivatives
H f X = 2
P f
P f X (172)
= 2
S f
S f X
(173)
5.5.2 Second Derivatives
H f XX (µ) =
∂
∂X
H f
X
T
µ
(174)
=
H f ΘΘ(µ) H f
ΘV (µ) 0 0
H f V Θ(µ) H
f VV (µ) 0 0
0 0 0 00 0 0 0
(175)
H f XX (µ) = ∂
∂X H f X
T
µ (176)
= ∂
∂X
2P
f X
T P f
µ
(177)
18
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 19/25
6 GENERALIZED AC OPF COSTS
= 2
P f XX (
P f
µ) + P f X
T
[µ] P f X
(178)
= 2
S f XX (
S f
µ)
+
S f X
T
[µ]
S f X
(179)
H f ΘΘ(µ) = 2
S f ΘΘ(
S f
µ)
+
S f Θ
T
[µ]
S f Θ
(180)
H f V Θ(µ) = 2
S f V Θ(
S f
µ)
+
S f V
T
[µ]
S f Θ
(181)
H f ΘV (µ) = 2
S f ΘV (
S f
µ)
+
S f Θ
T
[µ]
S f V
(182)
H f VV (µ) = 2
S f VV (
S f
µ)
+
S f V
T
[µ]
S f V
(183)
6 Generalized AC OPF CostsThe generalized cost function for the AC OPF consists of three parts,
f (X ) = f a(X ) + f b(X ) + f c(X ) (184)
expressed as functions of the full set of optimization variables.
X =
ΘV P gQg
Y
Z
(185)
where Y is the ny×1 vector of cost variables associated with piecewise linear generatorcosts and Z is an nz × 1 vector of additional linearly constrained user variables.
6.1 Polynomial Generator Costs
Let f iP ( pig) and f iQ(q ig) be polynomial cost functions for real and reactive power for
generator i and F P and F Q be the ng × 1 vectors of these costs.
F P (P g) = f 1P ( p1g)
...f
ngP ( p
ngg )
(186)
19
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 20/25
6.2 Piecewise Linear Generator Costs 6 GENERALIZED AC OPF COSTS
F Q(Qg) =
f 1Q(q 1g )...
f ngQ (q
ngg )
(187)
f a(X ) = 1Tng
F P (P g) + F Q(Qg)
(188)
6.1.1 First Derivatives
We will use F P and F P to represent the vectors of first and second derivatives of each of these real power cost functions with respect to the corresponding generatoroutput. Likewise for the reactive power costs.
f aX = ∂f a
∂X
(189)
=
f aΘ f aV f aP g f aQg
f aY f aZ
(190)
=
0 0 (F P )T
(F Q)T
0 0
(191)
6.1.2 Second Derivatives
f aXX = ∂f aX
T
∂X (192)
=
0 0 0 0 0 00 0 0 0 0 00 0 f aP gP g
0 0 0
0 0 0 f aQgQg 0 0
0 0 0 0 0 00 0 0 0 0 0
(193)
where
f aP gP g =
F P
(194)
f aQgQg =
F Q
(195)
6.2 Piecewise Linear Generator Costs
f b(X ) = 1TnyY (196)
20
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 21/25
6.3 General Cost Term 6 GENERALIZED AC OPF COSTS
6.2.1 First Derivatives
f b
X
= ∂f b
∂X (197)
=
f bΘ f bV f bP g f bQg
f bY f bZ
(198)
=
0 0 0 0 1Tny 0
(199)
6.2.2 Second Derivatives
f bXX = 0 (200)
6.3 General Cost Term
Let the general cost be defined in terms of the nw × nw matrix H w and nw × 1vector C w of coefficients and the parameters specified in the nw × nx matrix N andthe nw × 1 vectors D, R, K , and M. The parameters N and R provide a lineartransformation and shift to the full set of optimization variables X , resulting in anew set of variables R.
R = N X − R (201)
Each element of K specifies the size of a “dead zone” in which the cost is zero forthe corresponding element of R. The elements ki are used to define nw × 1 vectorsU , K̄ and R̄, where
ui
= 0, −ki ≤ ri ≤ ki
1, otherwise (202)
k̄i =
ki, ri < −ki
0, −ki ≤ ri ≤ ki
−ki, ri > ki
(203)
The “dead zone” costs are zeroed by multiplying by [U ]. The remaining elementsare shifted toward zero by the size of the “dead zone” by adding K̄ , before applyinga cost.
R̄ = R + K̄ (204)
Each element of D specifies whether to apply a linear or quadratic function to
the corresponding element of R̄. This can be done via two more nw × 1 vectors, DL
21
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 22/25
6.3 General Cost Term 6 GENERALIZED AC OPF COSTS
and DQ, defined as follows
dLi =
1, di = 10, otherwise
(205)
dQi =
1, di = 20, otherwise
(206)
The result is scaled by the corresponding element of M to form a new nw × 1vector
W = [M] [U ]
DL
+
DQ
R̄
R̄ (207)
=
DL + DQ
R̄
R̄ (208)
where
DL = [M] [U ]
DL
(209)
DQ = [M] [U ] DQ (210)
The full general cost term is then expressed as a quadratic function of W asfollows
f c(X ) = 1
2W TH wW + C wTW (211)
6.3.1 First Derivatives
For simplicity of derivation and computation, we defined A and B as follows
A = W R̄ = ∂W
∂ R̄ = DL + 2 DQ R̄ (212)
B = f cW = ∂f c
∂W = W TH w + C wT (213)
R̄X = ∂ R̄
∂X = N (214)
W X = ∂W
∂X = W ̄R · R̄X (215)
= AN (216)
f cX = ∂f c
∂X = f cW · W X (217)
= BAN (218)
22
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 23/25
6.4 Full Cost Function 6 GENERALIZED AC OPF COSTS
6.3.2 Second Derivatives
f cXX = ∂
∂X f cX T
(219)
= ∂
∂X
N TAB T
(220)
= N T
A ∂
∂X (H wW + C w) + 2 DQ
B T ∂ R̄
∂X
(221)
= N T
AH wW X + 2 DQ
B T
R̄X
(222)
= N T
AH wA + 2 DQ
B T
N (223)
6.4 Full Cost Function
f (X ) = f a(X ) + f b(X ) + f c(X ) (224)
= 1Tng
F P (P g) + F Q(Qg)
+ 1TnyY +
1
2W TH wW + C wTW (225)
6.4.1 First Derivatives
f X = ∂f
∂X = f aX + f bX + f cX (226)
=
0 0 (F P )T
(F Q)T
1Tny 0
+ BAN (227)
6.4.2 Second Derivatives
f XX = ∂ 2f
∂X 2 = f aXX + f bXX + f cXX (228)
=
0 0 0 0 0 00 0 0 0 0 0
0 0
F P
0 0 0
0 0 0
F Q
0 0
0 0 0 0 0 0
0 0 0 0 0 0
+ N T
AH wA + 2 DQ
B T
N (229)
23
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 24/25
7 LAGRANGIAN OF THE AC OPF
7 Lagrangian of the AC OPF
Consider the following AC OPF problem formulation, where X is defined as in (185),f
is the generalized cost function described above, and X represents the reduced formof X , consisting of only Θ, V , P g and Qg, without Y and Z .
minX
f (X ) (230)
subject to
G(X ) = 0 (231)
H (X ) ≤ 0 (232)
where
G(
X ) =
{Gs(X )}
{Gs
(X )}AE X − BE (233)
and
H (X ) =
H f (X )
H t(X )AI X − BI
(234)
Partitioning the corresponding multipliers λ and µ similarly,
λ =
λP
λQ
λE
, µ =
µf
µt
µI
(235)
the Lagrangian for this problem can be written as
L(X,λ ,µ) = f (X ) + λTG(X ) + µTH (X ) (236)
7.1 First Derivatives
LX (X,λ ,µ) = f X + GX Tλ + H X
Tµ (237)
Lλ(X,λ ,µ) = GT(X ) (238)
Lµ(X,λ ,µ) = H T(X ) (239)
where
GX =
{GsX } 0 0
{GsX } 0 0
AE
=
{GsΘ} {Gs
V } −C g 0 0 0{Gs
Θ} {GsV } 0 −C g 0 0
AE
(240)
24
8/9/2019 TN2 OPF Derivatives
http://slidepdf.com/reader/full/tn2-opf-derivatives 25/25
7.2 Second Derivatives 7 LAGRANGIAN OF THE AC OPF
and
H X =
H
f X 0 0
H tX 0 0
AI
=
H
f Θ H
f V 0 0 0 0
H tΘ H tV 0 0 0 0
AI
(241)
7.2 Second Derivatives
LXX (X,λ ,µ) = f XX + GXX (λ) + H XX (µ) (242)
where
GXX (λ) =
{Gs
XX (λP )} + {GsXX (λQ)} 0 0
0 0 00 0 0
(243)
=
GsΘΘ(λP ) Gs
ΘV (λP ) 0 0 0 0
GsV Θ(λP ) GsVV (λP ) 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
+
GsΘΘ(λQ) Gs
ΘV (λQ) 0 0 0 0GsV Θ(λQ) Gs
VV (λQ) 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
0 0 0 0 0 0
(244)
and
H XX (µ) =
H f
XX (µf ) + H tXX (µt) 0 00 0 00 0 0
(245)
=
H f ΘΘ(µf ) + H tΘΘ(µt) H f
ΘV (µf ) + H tΘV (µt) 0 0 0 0
H f V Θ(µf ) + H tV Θ(µt) H f
VV (µf ) + H tVV (µt) 0 0 0 00 0 0 0 0 00 0 0 0 0 0
0 0 0 0 0 00 0 0 0 0 0
(246)
25