Professional Documents
Culture Documents
Optimal Power Flow (DC and AC OPF)
Optimal Power Flow (DC and AC OPF)
Spyros Chatzivasileiadis
What is optimal power flow?
2 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Optimal Power Flow (OPF)
• In its most realistic form, the OPF is a non-linear, non-convex problem,
which includes both binary and continuous variables.
• Goal: minimize an objective function, respecting all physical, operational,
and technical constraints, such as:
• Ohm’s law and Kirchhoff laws
• Operational limits of generators
• Loading limits of transmission lines
• Voltage levels
• and many, many others
• Disclaimer:
• Realistic OPF implementations include thousands of variables and
constraints
• Here we focus on the most “fundamental” formulations of OPF
• These can be extended with several additional constraints to
accurately model the problem and/or system at hand
3 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Use of OPF in the industry
• RTE, France: they invented the OPF! (Carpentier,
1962)
• Their focus is mostly on the optimization of the
system operation and not so much on markets
• They are working on the application of convex
relaxations of OPF on their system (see Dan
Molzahn’s talk!)
4 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Use of OPF in the industry
• EUPHEMIA
• one common algorithm to calculate electricity prices across Europe, and
allocate cross border capacity on a day-ahead basis
• 19 European countries, over 150 million EUR in matched trades daily
• PLEXOS
• June 2000: PLEXOS was first-to-market with electric power market
simulation based entirely on mathematical programming
• Features: generation capacity expansion planning, transmission expansion
planning, hydro-thermal coordination, ancillary services
5 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Summarizing
• DC-OPF
• market clearing uses DC-OPF (at the moment)
• convex
• can solve fast; can be applied in very large problems
• AC-OPF
• primarily used for optimization of operation and control actions
• non-convex (in its original form)
• continuous efforts to decrease computation time and increase system
size
• Trends
• Incorporating uncertainty
• Decomposition (and other) methods to solve very large problems
• Guarantees for a global minimum (convex relaxations)
• Market design
• Coupled energy networks and markets, e.g. gas and electricity
6 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Outline
• Economic Dispatch
• DC-OPF
• AC-OPF
7 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Outline
• Economic Dispatch
• used in power exchanges, e.g. EPEX, etc.
• Supply must meet demand
• Generator limits
8 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Outline
• Economic Dispatch
• used in power exchanges, e.g. EPEX, etc.
• Supply must meet demand
• Generator limits
• DC-OPF
• extends Economic Dispatch
• considers the power flows! (in a linearized form)
• includes the power flow limits of the lines
• only active power; no losses
8 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Outline
• Economic Dispatch
• used in power exchanges, e.g. EPEX, etc.
• Supply must meet demand
• Generator limits
• DC-OPF
• extends Economic Dispatch
• considers the power flows! (in a linearized form)
• includes the power flow limits of the lines
• only active power; no losses
• AC-OPF
• full AC power flow equations
• active and reactive power flow
• current, voltage
• losses
8 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Economic Dispatch
∑
min c i P Gi
i
subject to:
PGi = PD
i
9 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Economic Dispatch
∑
min c i P Gi
i
subject to:
PGi = PD
i
• The Economic Dispatch does not consider any network flows or network
constraints!
9 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Economic Dispatch
∑
min c i P Gi
i
subject to:
PGi = PD
i
• The Economic Dispatch does not consider any network flows or network
constraints!
9 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Can we solve the economic dispatch problem without using an
optimization solver?
10 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Can we solve the economic dispatch problem without using an
optimization solver?
10 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
The Merit-Order Curve
price
cG4
max
A = PG1
cG3
max
B = A + PG2
max
C = B + PG3
cG2
max
D = C + PG4
cG1
0 A B C D power
11 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
The Merit-Order Curve
price
cG4
max
A = PG1
cG3
max
B = A + PG2
max
C = B + PG3
cG2
max
D = C + PG4
cG1
0 A B C D power
PD
11 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
The Merit-Order Curve
• cG3 is the system
marginal price
price
• Gens G1 and G2
cG4
are fully
cG3 dispatched
• Gen G4 is not
dispatched at all
cG2
• Gen G3 is partially
cG1 dispatched
• G3 is the
0 A B C D power
PD “marginal
generator”
12 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
The Merit-Order Curve: An Example
13 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Merit-Order Curve, Marginal Generators,
and Line Congestion
• Although G3 has
price enough capacity,
it cannot produce
cG4 enough to cover
cG3
the demand due
to line congestion
• Instead G4, a
cG2 more expensive
gen that does not
cG1
contribute to the
line congestion,
0 A B C D power must produce the
PD
missing power
subject to:
PGmin
i
≤ PGi ≤ PGmax
i
15 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
DC-OPF
∑
min c i P Gi
i
subject to:
PGmin
i
≤ PGi ≤ PGmax
i
B · θ = PG − PD
1
(θi − θj ) ≤ Pij,max
xij
15 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
DC-OPF
∑
min c i P Gi
i
subject to:
PGmin
i
≤ PGi ≤ PGmax
i
B · θ = PG − PD
1
(θi − θj ) ≤ Pij,max
xij
• The DC-OPF with the standard power flow equations contains both the
power generation PG and the voltage angles θ in the vector of the
optimization variables.
15 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Exercise
cG1 = 60 $/MWh, cG2 = 120 $/MWh
Pload = 150 MW
3
1 What are the optimization variables? Form
the optimization vector
16 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
DC-OPF in Matlab
17 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Discussion Points
• sin δ ≈ δ
• δ is in rad!
18 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Discussion Points
• sin δ ≈ δ
• δ is in rad!
•B·θ =P
• B is in p.u.
• θ is in rad, ⇒ dimensionless
• P must be in p.u.
18 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Discussion Points
• sin δ ≈ δ
• δ is in rad!
•B·θ =P
• B is in p.u.
• θ is in rad, ⇒ dimensionless
• P must be in p.u.
18 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Discussion Points
• sin δ ≈ δ
• δ is in rad!
•B·θ =P
• B is in p.u.
• θ is in rad, ⇒ dimensionless
• P must be in p.u.
19 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Convex vs. Non-convex Problem
x x
One global minimum Several local minima
20 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Several local minima: So what?
Example: Optimal Power Flow Problem
• Assume that the difference in the
cost function of a local minimum
versus a global minimum is 5%
f (x)
• The total electric energy cost in Cost
the US is ≈ 400 Billion$/year
21 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Convexifying the Optimal Power Flow problem
(OPF)
f (x)
Cost
• Convex relaxations transform the
OPF to a convex Semi-Definite
Program (SDP)
Convex Relaxation
1 Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:
f (x)
Cost f˜(x)
• Convex relaxations transform the
OPF to a convex Semi-Definite
Program (SDP)
Convex Relaxation
1 Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:
f (x)
Cost f˜(x)
• Convex relaxations transform the
OPF to a convex Semi-Definite
Program (SDP)
Convex Relaxation
1 Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:
23 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
AC-OPF
• Minimize
• subject to:
24 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
AC-OPF
• Minimize
• subject to:
24 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
AC-OPF
• Minimize
• subject to:
24 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
AC-OPF
• Minimize
• subject to:
numbers. (·)∗ denotes the complex conjugate. To simplify notation, the bar denoting a complex
number is dropped in the following slides. Attention! The current flow constraints are defined as
vectors, i.e. for all lines. The apparent power line constraints are defined per line.
25 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Current flow along a line
Vi Vj
It is:
1
Rij + jXij yij =
Rij + jXij
jBij jBij
Bij
2 2 ysh,i = j + other shunt
2
elements connected to that bus
26 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Current flow along a line
Vi Vj
It is:
1
Rij + jXij yij =
Rij + jXij
jBij jBij
Bij
2 2 ysh,i = j + other shunt
2
elements connected to that bus
26 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Current flow along a line
Vi Vj
It is:
1
Rij + jXij yij =
Rij + jXij
jBij jBij
Bij
2 2 ysh,i = j + other shunt
2
elements connected to that bus
1
• yij = is the admittance of line ij
Rij + jXij
• ysh,i is the shunt capacitance jBij /2 of the π-model of the line
• We must create two Yline matrices. One for i → j and one for j → i
27 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Bus Admittance Matrix Ybus
Si = Vi Ii∗
∑
Ii = Iik , where k are all the buses connected to bus i
k
Ii = Iim + Iin
i→m
= (ysh,i + yim )Vi − yim Vm + (ysh,i
i→n
+ yin )Vi − yin Vn
i→m
= (ysh,i i→n
+ yim + ysh,i + yin )Vi − yim Vm − yin Vn
28 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Bus Admittance Matrix Ybus
• Ybus is an N × N matrix, where N is the number of nodes
∑
• diagonal elements: Ybus,ii = ysh,i + k yik , where k are all the buses
connected to bus i
• off-diagonal elements:
• Ybus,ij = −yij if nodes i and j are connected by a line3
• Ybus,ij = 0 if nodes i and j are not connected
1
• yij = is the admittance of line ij
Rij + jXij
• ysh,i are all shunt elements connected to bus i, including the shunt
capacitance of the π-model of the line
3 If there are more than one lines connecting the same nodes, then they must all be added to
Si = Vi Ii∗
∗
= Vi Ybus V∗
30 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
From AC to DC Power Flow Equations
• The power flow along a line is:
1
Iij∗ = − jbsh,i Vi + j (Vi − (Vj cos δ − jVj sin δ))
xij
1 1 1
= − jbsh,i Vi + j Vi − j Vj cos δ − Vj sin δ
xij xij xij
31 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
From AC to DC Power Flow Equations (cont.)
• Since Vi is a real number, it is:
1
Pij =ℜ{Sij } = Vi ℜ{Iij∗ } = − Vi Vj sin δ
xij
• With δ = θj − θi , it is:
1
Pij = Vi Vj sin(θi − θj )
xij
• We further make the assumptions that:
• Vi , Vj are constant and equal to 1 p.u.
• sin θ ≈ θ, θ must be in rad
Then
1
Pij = (θi − θj )
xij
32 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Some additional points...
• Nodal prices
In a market context, the nodal prices are:
• the lagrangian multipliers of the equality constraints Bθ = P
• of a DC-OPF (at the moment)
• with objective function the minimization of costs
33 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Some additional points...
• Nodal prices
In a market context, the nodal prices are:
• the lagrangian multipliers of the equality constraints Bθ = P
• of a DC-OPF (at the moment)
• with objective function the minimization of costs
33 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
AC-OPF
https://www.ferc.gov/industries/electric/indus-act/
market-planning/opf-papers.asp
34 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017
Wrap-up
DC-OPF AC-OPF
• market clearing uses DC-OPF (at • primarily used for optimization of
the moment) operation and control actions
• convex • full AC power flow equations
• can solve fast; can be applied in but
very large problems
• non-convex (in its original form) →
but no guarantee that we find the
global optimum
• only active power flow
• computationally expensive and
• no losses and no voltage levels
possibly intractable for very large
systems
spchatz@elektro.dtu.dk
36 DTU Electrical Engineering Optimal Power Flow (DC-OPF and AC-OPF) Jun 12, 2017