Lecture 23: Optimal Power Flow: Prof. Tom Overbye Dept. of Electrical and Computer Engineering Texas A&M University
Lecture 23: Optimal Power Flow: Prof. Tom Overbye Dept. of Electrical and Computer Engineering Texas A&M University
2
LP Optimal Power Flow
• LP OPF was introduced in
– B. Stott, E. Hobson, “Power System Security Control
Calculations using Linear Programming,” (Parts 1 and 2)
IEEE Trans. Power App and Syst., Sept/Oct 1978
– O. Alsac, J. Bright, M. Prais, B. Stott, “Further Developments
in LP-based Optimal Power Flow,” IEEE Trans. Power
Systems, August 1990
• It is a widely used technique, particularly for real power
optimization; it is the technique used in PowerWorld
3
LP Optimal Power Flow
• Idea is to iterate between solving the power flow, and
solving an LP with just a selected number of
constraints enforced
• The power flow (which could be ac or dc) enforces
the standard power flow constraints
• The LP equality constraints include enforcing area
interchange, while the inequality constraints include
enforcing line limits; controls include changes in
generator outputs
• LP results are transferred to the power flow, which is
then resolved
4
LP OPF Introductory Example
• In PowerWorld load the B3LP case and then
display the LP OPF Dialog (select Add-Ons, OPF
Options and Results)
• Use Solve LP OPF to Bus 2
60 MW 60 MW
Bus 1
slack
Bus 3
120 MW
10.00 $/MWh
to economic dispatch
180 MW
0 MW
6
LP OPF Introductory Example, cont
• On use Options, Constraint Options to enable the
enforcement of the Line/Transformer MVA limits
7
LP OPF Introductory Example, cont.
20 MW 20 MW
Bus 2 Bus 1
10.00 $/MWh
slack
180 MW
0 MW
8
Example 6_23 Optimal Power Flow
On the Options,
Environment
page the simulation can be
set to solve an OPF when
simulating
11
Example 6_23 Optimal Power Flow
with Load Scale = 1.72
• LP Sensitivity Matrix (A Matrix)
12
Example 6_23 Optimal Power Flow
with Load Scale = 1.82
• This situation is infeasible, at least with available
controls. There is a solution because the OPF is
allowing one of the constraints to violate (at high
cost)
13
Generator Cost Curve Modeling
• LP algorithms require linear cost curves, with
piecewise linear curves used to approximate a
nonlinear cost function
• Two common ways
of entering cost
information are
– Quadratic function
– Piecewise linear curve
• The PowerWorld OPF
supports both types
14
Security Constrained OPF
• Security constrained optimal power flow (SCOPF)
is similar to OPF except it also includes
contingency constraints
– Again the goal is to minimize some objective function,
usually the current system cost, subject to a variety of
equality and inequality constraints
– This adds significantly more computation, but is required
to simulate how the system is actually operated (with N-1
reliability)
• A common solution is to alternate between solving
a power flow and contingency analysis, and an LP
15
Security Constrained OPF, cont.
• With the inclusion of contingencies, there needs to
be a distinction between what control actions must
be done pre-contingent, and which ones can be
done post-contingent
– The advantage of post-contingent control actions is they
would only need to be done in the unlikely event the
contingency actually occurs
• Pre-contingent control actions are usually done for
line overloads, while post-contingent control
actions are done for most reactive power control
and generator outage re-dispatch
16
SCOPF Example
• We’ll again consider Example 6_23, except now it has
been enhanced to include contingencies and we’ve also
greatly increased the capacity on the line between buses
4 and 5
82 MW 82 MW 26 MW 26 MW 78 MW 82 MW 82 MW 26 MW 26 MW 78 MW
A A A A
36% 80% A
A 84 MW 36% 80% A
A 84 MW
MVA MVA
100% 268% AGC ON MVA MVA
100% 80%
AGC ON
MVA MVA
MVA MVA
91 MW 91 MW
0 MW 127 MW 0 MW 127 MW
53 MW 53 MW
96 MW 96 MW
1.04 pu 0 MW 0.82 pu 1.04 pu 0 MW 0.82 pu
14.20 $/MWh 5 1540.19 $/MWh 14.20 $/MWh 5 15.05 $/MWh
2 2
39 MW 173 MW 127.4 MW 39 MW 173 MW 127.4 MW
20 Mvar AGC ON 39.2 Mvar 20 Mvar AGC ON 39.2 Mvar
Total Hourly Cost: 5729.74 $/h Load Scalar: 1.00 Total Hourly Cost: 5729.74 $/h Load Scalar: 1.00
Total Area Load: 392.0 MW Total Area Load: 392.0 MW
Marginal Cost ($/MWh): 319.73 $/MWh Marginal Cost ($/MWh): 14.70 $/MWh
Original with line 4-5 limit Modified with line 4-5 limit
of 60 MW with 2-5 out of 200 MVA with 2-5 out
17
PowerWorld SCOPF Application
Just click the button to solve
Number of times
to redo contingency
analysis
18
LP OPF and SCOPF Issues
• The LP approach is widely used for the OPF and
SCOPF, particularly when implementing a dc power
flow approach
• A key issue is determining the number of binding
constraints to enforce in the LP tableau
– Enforcing too many is time-consuming, enforcing too few
results in excessive iterations
• The LP approach is limited by the degree of linearity
in the power system
– Real power constraints are fairly linear, reactive power
constraints much less so
19
OPF Solution by Newton’s Method
• An alternative to using the LP approach is to use
Newton’s method, in which all the equations are
solved simultaneously
• Key paper in area is
– D.I. Sun, B. Ashley, B. Brewer, B.A. Hughes, and W.F.
Tinney, "Optimal Power Flow by Newton Approach", IEEE
Trans. Power App and Syst., October 1984
• Problem is For simplicity x represents
all the variables and we can
Minimize f ( x)
use h to impose limits on
s.t. g(x)= 0 individual variables
h(x) 0
20
OPF Solution by Newton’s Method
• During the solution the inequality constraints are
either binding (=0) or nonbinding (<0)
– The nonbinding constraints do not impact the final
solution
• We’ll modify the problem to split the h vector into
the binding constraints, h1 and the nonbinding
constraints, h2
Minimize f ( x)
s.t. g(x)= 0
h1 (x) 0
h 2 (x) 0
21
OPF Solution by Newton’s Method
• To solve first define the Lagrangian
L(x, λ1 , λ 2 ) f (x) μT g(x)+λ T h1 (x)
Let z = x μ λ
• A necessary condition for a minimum is that the
gradient is zero Both and are
L(z ) Lagrange Multipliers
z
1
L(z )
L ( z ) 0
z2
22
OPF Solution by Newton’s Method
• Solve using Newton’s method. To do this we need
to define the Hessian matrix
2 L(z ) 2 L( z ) 2 L( z )
xi x j xi j xi j
2
L ( z ) 2 L(z )
2 L( z ) H ( z ) 0 0
zi z i x j
2
L(z ) 0 0
x
ji
• Because this is a second order method, as opposed
to a first order linearization, it can better handle
system nonlinearities
23
OPF Solution by Newton’s Method
• Solution is then via the standard Newton’s method.
That is
Set iteration counter k=0, set k max
Set convergence tolerance
(k) No iteration is
Guess z needed for a
While L(z ) and k < k max quadratic function
with linear
z H ( z ) L ( z )
(k 1) (k) 1
z constraints
k=k+1
End While
24
Example
• Solve
Minimize x12 x 22 such that x 1 x2 2 0
Solve initially assuming the constraint is binding
L x, x12 x 22 3x1 x2 2
L No iteration is
x
1 2x1 3 needed so any
L
L x, 2x 2 “guess” is fine.
x
2 3x1 x2 2 Pick (1,1,0)
L
1
2 0 3 x1 1 2 0 1 2 0.6
2 L x, H x, 0 2 1 x2 1 0 2 1 2 0.2
3 1 0 0 1 1 0 2 0.4
26
Mixed-Integer Programming
• A mixed-integer program (MIP) is an optimization
problem of the form
Minimize c x
s.t. Ax b
x0
where x n-dimensional column vector
c n-dimensional row vector
b m-dimensional column vector
A m×n matrix
some or all x j integer
27
Mixed-Integer Programming
• The advances in the algorithms have been substantial
Speedups
from 2009
to 2015 were
about a factor
of 30!
Notes are partially based on a presentation at Feb 2015 US National Academies Analytic
Foundations of the Next Generation Grid by Robert Bixby from Gurobi Optimization titled
“Advances in Mixed-Integer Programming and the Impact on Managing Electrical Power Grids” 28
Mixed-Integer Programming
• Suppose you were given the following choices?
– Solve a MIP with today’s solution technology on a 1991
machine
– Solve a MIP with a 1991 solution on a machine from today?
• The answer is to choose option 1, by a factor of
approximately 300
• This leads to the current debate of whether the OPF
(and SCOPF) should be solved using generic solvers or
more customized code (which could also have quite
good solvers!)
Notes are partially based on a presentation at Feb 2015 US National Academies Analytic
Foundations of the Next Generation Grid by Robert Bixby from Gurobi Optimization titled
“Advances in Mixed-Integer Programming and the Impact on Managing Electrical Power Grids” 29
More General Solvers Overview
• OPF is currently an area of active research
• Many formulations and solution methods exist…
– As do many tools for highly complex, large-scale
computing!
30
Gurobi and CPLEX
• Gurobi and CPLEX are two well-known
commercial optimization solvers/packages for
linear programming (LP), quadratic
programming (QP), quadratically constrained
programming (QCP), and the mixed integer (MI)
counterparts of LP/QP/QCP
• Gurobi and CPLEX are accessible through object-
oriented interfaces (C++, Java, Python, C), matrix-
oriented interfaces (MATLAB) and other modeling
languages (AMPL, GAMS)
31
Solver Comparison
CPLEX* x x x
GLPK x
Gurobi* x x x
IPOPT x
Mosek* x x x x
SDPT3/SeDuMi x x
https://www.ferc.gov/legal/staff-reports/2017/marginallosscalculations.pdf 33
Example 6_13 DC SCOPF Results:
Load Scalar at 1.20
• Now there is not an unenforceable constraint on the line
between 4-5 (for the line 2-5 contingency) because the
reactive losses are ignored
63 MW 63 MW 59 MW 59 MW 94 MW
A A
87 MW 150 MW 55 MW 176 MW 45 MW
slack AGC ON 0 Mvar
A A
58% 46% A
A 136 MW
MVA MVA
45% 14%
MVA
MVA AGC ON
55 MW
124 MW 28 MW
87 MW A
45 MW 62%
1.00 pu MVA
124 MW 1.00 pu
14.63 $/MWh 5 16.89 $/MWh
2
47 MW 184 MW 152.9 MW
0 Mvar AGC ON 0.0 Mvar
34
2000 Bus Texas Synthetic DC OPF
Example
• This system does a DC OPF solution, with the
ability to change the load in the areas
The quite
low LMPs
are actually
due to a
constraint
on a single
230/115 kV
transformer
35
Actual ERCOT LMPs on Nov 13,
2019 at 9:55 am
Source: www.ercot.com/content/cdr/contours/rtmLmp.html 36
June 1998 Heat Storm: Two
Constraints Caused a Price Spike
Price of
electricity
in Central
Illinois went
to $7500
per MWh!
39
Overall Goal
• Goal is to maximize the economic surplus (or total
welfare), which is the sum of the consumer surplus
and the producer surplus (i.e., their profit)
• Generation owners have to
decide their offer prices
• If their price is too high, they
are not selected to generate
• At the wholesale level, the
consumers often just see a
price, though there can be price
responsive load bids
Image Source: en.wikipedia.org/wiki/Economic_surplus#/media/File:Economic-surpluses.svg
40
Electricity Markets Today
• Starting in about 1995 electricity markets gradually
started to develop, both in the US and elsewhere
• In North America
more than 60% of the
load is supplied
via wholesale
electricity markets
• Markets differ but
they all have certain
common features
Image: www.isorto.org/about/default
41
Electricity Markets Common
Features
• Day ahead market – this is needed because time is
required to make decisions about committing
generators
– Generation owners submit offers for how much generation
they can supply and at what price; accepted offers are binding
• Real-time energy market – needed because day ahead
forecasts are never perfect, and unexpected events can
occur
• Co-optimization with other “ancillary services” such as
reserves
The source for much of this material “Analytic Research Foundations for the Next-Generation Electric
Grid” (Chapter 2), The National Academies Press, 2016 (free download available)
42
Electricity Markets Common
Features
• Pricing is done using locational marginal prices,
determined by an SCOPF
– Most markets include a marginal losses component
• LMP markets are designed to send transparent price
signal so people can make short and long-term decisions
– Generators are free to offer their electricity at whatever price
they desire; they do not have to reveal their “true” costs
– Most of the times markets work as planned, and prices are
competitive
– During times of shortages (scarcity) there are limits on LMPs;
ERCOT’s is $9000/MWh
– Markets are run by independent system operators (ISOs)
43
LMP Energy Markets
• In an LMP energy market the generation is paid the
LMP at the bus, and the loads pay the LMP at the bus
– This is done in both the day ahead market and in the real-
time market (which makes up the differences between actual
and the day ahead)
• The generator surplus (profit) is the difference
between the LMP and the actual cost of generation
• Generators that offer too high are not selected to run,
and hence make no profit
• A key decision for the generation owners is what
values to offer
44
Generator Offers
• Generator offers are given in piecewise linear curves;
that is, a fixed $/MWh for so much power for a time
period
• In the absence of constraints (congestion) the ISO
would just select the lowest offers to meet the
anticipated load
• Actual dispatch is determined using an SCOPF
45
General Guidelines
• Generators with high fixed costs and low operating
costs (e.g., wind, solar, nuclear) benefit from running
many hours
– Usually they should submit offers close to their marginal costs
– Wind (and some others) receive a production tax credit for
their first ten years of operation
• $23/MWh for systems starting construction before 1/1/2017
• $18.4/MWh for systems starting construction in 2017 (a 20%
reduction)
• In 2018 the reduction is 40% and 60% in 2019; after that it is zero
(unless, of course, changed by Congress)
• Generators with low fixed costs and high operating cost
can do fine operating fewer hours (at higher prices)
46
Auctions
• In its simplest form, an auction is a mechanism of
allocating scarce goods based upon competition
– a seller wishes to obtain as much money as possible, and a
buyer wants to pay as little as necessary.
• An auction is usually considered efficient if resources
accrue to those who value them most highly
• Auctions can be either one-sided with a single
monopolist seller/buyer or a double auction with
multiple parties in each category
– bid to buy, offer to sell
• Most people’s experience is with one-side auctions
with one seller and multiple buyers 47
Auctions, cont.
• Electricity markets can be one-sided, with the ISO
functioning as a monopolist buyer, while multiple
generating companies make offers to sell their
generation, or two-sided with load participation
• Auction provides mechanism for participants to reveal
their true costs while satisfying their desires to buy low
and/or sell high.
• Auctions differ on the price participants receive and the
information they see along the way
48
Types of Single-Sided Auctions
with Multiple Buyers, One Seller
• Simultaneous auctions
– English (ascending price to buy)
– Dutch (descending price to buy)
• Sealed-bid auctions (all participants submit offers
simultaneously)
– First price sealed bid (pay highest price if one,
discriminatory prices if multiple)
– Vickrey (uniform second price) (pay the second highest
price if one, all pay highest losing price if many); this
approach gives people incentive to bid their true value
49
Uniform Price Auctions: Multiple
Sellers, One Buyer
• Uniform price auctions are sealed offer auctions in
which sellers make simultaneous decisions (done
when submitting offers).
• Generators are paid the last accepted offer
• Provides incentive to offer at marginal cost since
higher values cause offers to be rejected
– reigning price should match marginal cost
• Price caps are needed to prevent prices from rising
up to infinity during shortages
• Some generators offering above their marginal
costs are needed to cover their fixed costs
50
What to Offer Example
• Below example shows 3 generator case, in which the
bus 2 generator can vary its offer to maximize profit
Gen 2 Cost = $12/MWh
Offer Multiplier: 1.00 20 MW 20 MW
Bus 1
Gen 2 Profit: 0.0 $/h
10.00 $/MWh
slack
0 MW
Gen 3 Offer = Cost = $20/MWh
Gen 3 Profit: 0.0 $/h
52
Market Power and Scarcity Rents
• A generator owner exercises market power when it is
unwilling to make energy available at a price that is
equal to that unit’s variable cost of production, even
thought there is currently unloaded generation capacity
(i.e., there is no scarcity).
• Scarcity rents occur when the level of electric demand
is such that there is little, if any, unused capacity
• Scarcity rents are used to recover fixed costs
53