ee 553 lpopf j. mccalley 1. lpopf the linear program optimal power flow (lpopf) is functionally...
TRANSCRIPT
LPOPFThe linear program optimal power flow (LPOPF) is functionally equivalent to the SCED, except whereas LPOPF implements normal line flow constraints, SCED implements security constraints as well. In addition, LPOPF uses DC power flow equations whereas SCED uses generation shift factors.
The simultaneous-co-optimized SCED does one more thing, it also implements the ancillary services (reserves) market.
The below papers are posted to the website and provide a full description of the SC-SCUC and the SC-SCED.
2
Ref: Xingwang Ma, Haili Song, Mingguo Hong, Jie Wan, Yonghong Chen, Eugene Zak, “The Security-constrained Commitment and Dispatch For Midwest ISO Day-ahead Co-optimized Energy and Ancillary Service Market,” Proc. of the 2009 IEEE PES General Meeting.
Ref: Xingwang Ma, Yonghong Chen, Jie Wan, “Midwest ISO Co-optimization Based Real-time Dispatch and Pricing of Energy and Ancillary Services,” Proc. of the 2009 IEEE PES General Meeting.
Linearized cost rate curvesIn our simplest version, we assume that only generators supply offers and all load is “must serve.”
We assume we have linearized cost-rate (generation offer) curvesinto some number of price-quantity offers.
The below illustrates this linearization to either three offers or one.
3
Pi,min
Pi3 Pi2 Pi1
Ci $/hr
Pi (MW)
si1
si2
si3
si
Three offers: (si1,Pi1), (si2, Pi2), (si3, Pi3)
One offer: (si,Pi),)
LPOPF
4
busesgeneratorkgkk Ps
_
min
Subject to:
'BP
)( ADPB
max,max, BBB PPP
busesgenkPP gkgk _,0 max, where:
NkPPP dkgkk ,...1, Alternatively, you can use the “reduced” DC power flow equations together with the above power balance constraint, which, for the example on the next slide, is
Pg1+Pg2+Pg3=2.1787(In the “reduced” DC power flow, θ1=0 and so first col and first row are eliminated).
We do not want to eliminate the first equation from the DC power flow equations because we want to obtain the multiplier for it. So we will not delete a column and row in DC power flow equations. If you do, you are relieving the need to satisfy power balance:
P1+P2+P3+P4=0You can see that the above is imposed by the “full” DC power flow equations by summing the rows.
4
3
2
1
4
3
2
1
2010010
10301010
0102010
10101030
P
P
P
P
Introduction to dual variables
5
This says that the λi = ΔF*/Δbi only for incrementally small Δbi.
In fact, we will see that we need to be more restrictive than that. .
ii b
F
*
Consider the following optimization problem:Min F(x)Subject to gi(x)≤bi , i=1,…,m
We solve it by applying KKT conditions to the Lagrangian: L(x,λ)=F(x)-Σλi(gi(x)-bi)
The λi, i=1,…,m, called the Lagrange multipliers, or the dual variables, are defined by:
Example
6
y13 =-j10 y14 =-j10
y34 =-j10
y23 =-j10
y12 =-j10
Pg1
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2
Pg4
1111 )( gg PsPK 20050 1 gP
,
2222 )( gg PsPK 1505.37 2 gP
4444 )( gg PsPK 18045 4 gP
s1=13.07 $/MWhrs2=12.11 $/MWhrs4=12.54 $/MWhr
s1=1307 $/puMWhrs2=1211 $/puMWhrs4=1254 $/puMWhr
421 125412111307 ggg PPPZ
Objective function:
Example
7
,
111 dg PPP
DC power flow equality constraints:
0' BP
4
3
2
1
4
3
2
1
2010010
10301010
0102010
10101030
P
P
P
P
From last time:
222 dg PPP 333 dg PPP 444 dg PPP
where
But Pg3, Pd1, Pd2, Pd3, Pd4 are fixed at 0,0,1, 1.1787, 0, so the above become:
4314
4321
3212
43211
201010
103010101787.1
1020101
10101030
g
g
g
P
P
P
0201010
1787.110301010
1102010
010101030
4314
4321
3212
43211
g
g
g
P
P
P
Putting the equations into CPLEX constraint form (variables on left, constant on RHS):
We need to write equations so that RHS values, if they are or were to be non-zero, are or would be positive, in order to get positive dual variables.
Example
8
, Line flow equality constraints:
From last time:
0)( ADPB
These are not constraints on our problem. They just compute for us the line flows which we then constrain with inequalities. We could also do each of these as one equation, using a single inequality constraint.
100000
010000
001000
000100
000010
D
0101
1100
0110
001-1
1-001
A
31
43
32
21
41
4
3
2
1
4
3
2
1
4
3
2
1
1010
1010
1010
1010
1010
010010
101000
010100
001010
100010
0101
1100
011
100000
010000
001000
000100
000010
)(
0
001-1
1-001
AD
0
0
0
0
0
1010
1010
1010
1010
1010
0)(
31
43
32
21
41
5
4
3
2
1
4
3
2
1
b
b
b
b
b
b
P
P
P
P
P
ADP
01010
01010
01010
01010
01010
315
434
323
212
411
b
b
b
b
b
P
P
P
P
P
Note we need “full” node-arc incidence matrix because we have full DC power flow equations.
Example
9
,
0)( ADPB
01010
01010
01010
01010
01010
315
434
323
212
411
b
b
b
b
b
P
P
P
P
P
minimize:
0' BP
421 125412111307 ggg PPPZ
max,max, BBB PPP
busesgeneratorkPP gkgk _,0 max,
…and the inequality constraints
0201010
1787.110301010
1102010
010101030
4314
4321
3212
43211
g
g
g
P
P
P
Example
10
,
I will solve this example in CPLEX, but in the corresponding “Word” notes (which are posted on the website), it is solved in Matlab.
You may use any solver you like to perform the homework. However, it is useful to learn how to use CPLEX because so many market vendors use it.
CPLEX Codeminimize 1307 pg1 + 1211 pg2 + 1254 pg4subject to theta1=0 -pb1 + 10 theta1 - 10 theta4 = 0 -pb2 + 10 theta1 - 10 theta2 = 0 -pb3 + 10 theta2 - 10 theta3 = 0 -pb4 - 10 theta3 + 10 theta4 = 0 -pb5 + 10 theta1 - 10 theta3 = 0 pg1 - 30 theta1 + 10 theta2 + 10 theta3 + 10 theta4 = 0 pg2 + 10 theta1 - 20 theta2 + 10 theta3 = 1 10 theta1 + 10 theta2 - 30 theta3 + 10 theta4 = 1.1787 pg4 + 10 theta1 + 10 theta3 - 20 theta4 = 0 -pg1 <= -0.5 pg1 <= 2 -pg2 <= -0.375 pg2 <= 1.5 -pg4<= -0.45 pg4 <= 1.8 -pb1 <= 500 pb1 <= 500 -pb2 <= 500 pb2 <= 500 -pb3 <= 500 pb3 <= 500 -pb4 <= 500 pb4 <= 500 -pb5 <= 500 pb5 <= 500Bounds -500 <= pb1 <= 500 -500 <= pb2 <= 500 -500 <= pb3 <= 500 -500 <= pb4 <= 500 -500 <= pb5 <= 500 -3.14159 <= theta1 <= 3.14159 -3.14159 <= theta2 <= 3.14159 -3.14159 <= theta3 <= 3.14159 -3.14159 <= theta4 <= 3.14159end
Objective
Line flows
DC power flow equations
Generation offer constraints
Line flow constraints
CPLEX only provides dual variables for equalities and inequalities that appear in the constraint list and not the “bounds” list, i.e., it does not provide dual variables for inequalities in the “bounds” list. If the exact same constraints are imposed both places, CPLEX will not provide a dual variable.
If you do not explicitly define a bound on a variable, then CPLEX applies bounds of 0 to ∞, and so if you want negativity for a variable, you must impose that here.
I can arbitrarily set one angle to whatever I like (within bounds), since it is the angle differences that are important.
11
Solution
display solution variables –Variable Name Solution Valuepg1 0.500000pg2 1.228700pg4 0.450000pb1 -0.015163theta4 0.001516pb2 0.095487theta2 -0.009549pb3 0.324188theta3 -0.041968pb4 0.434838pb5 0.419675All other variables in the range 1-12 are 0.
Z*=$2705.7557
PB5=0.4197 PB1 = -0.0152
PB4 = 0.4348
PB3 =0.3242
PB2=0.0955
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.2287pu
Pg4=0.45pu
There are 11 variables listed as non-0. So which variable is 0? Why?
12
SolutionEquality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 -96.0000 Pg1 0.0000
PB2 0.0000 Pg2 0 Pg2 0.0000PB3 0.0000 Pg4 -43.0000 Pg4 0.0000
PB4 0.0000 PB1 0 PB1 0.0000PB5 0.0000 PB2 0 PB2 0.0000P1 1211.0 PB3 0 PB3 0.0000P2 1211.0 PB4 0 PB4 0.0000P3 1211.0 PB5 0 PB5 0.0000P4 1211.0
($/per unit-hr)display solution dual -Constraint Name Dual Pricec7 1211.000000c8 1211.000000c9 1211.000000c10 1211.000000c11 -96.000000c15 -43.000000All other dual prices in the range 1-26 are 0.
The dual variables tell us how much the objective changes when the right-hand-side of the corresponding constraint increases by a unit (subject to qualifications on next slide). Since we are in “per unit”, and a “per-unit” is 100 MW, dividing the dual variables by 100 gives the corresponding $/MW change in the objective function. So dual variables for•c7-c10 are$12.11/MWhr Increasing load by 1 MW at either of buses 1,2,3, or 4 increases objective by $12.11. This is set by the bus 2 generator, as it will respond to any load change.•c11 is -$0.96/MWhr This constraint is –pg1<=-0.5. Increasing RHS from -0.5 to -0.49, equivalent to decreasing lower bound on pg1 from 50 to 49 MW, reduces objective by $0.96 .•c15 is -$0.43/MWhr This constraint is –pg4 <= -0.45. Increasing RHS from -0.45 to -0.44, equivalent to decreasing lower bound on pg4 from 45 to 44 MW, reduces objective by $0.43.
13
Qualification to dual variable definitionFrom last slide:“The dual variables tell us how much the objective changes when the right-hand-side of the corresponding constraint increases by a unit (subject to qualifications…).”
ii b
F
* This says that the λi = ΔF*/Δbi only for incrementally small Δbi.
In fact, it is more restrictive than that. In an LP, λi = ΔF*/Δbi holds only for Δbi such that within bi+ Δbi (inclusive), no change in the active constraint set occurs.
For example, •if constraint i is active (inactive) at bi, and it becomes inactive (active) within bi+ Δbi, then λi = ΔF*/Δbi will not hold within bi+ Δbi.
•if constraint k is active (inactive) at bi, and it becomes inactive (active) within bi+ Δbi, then λi = ΔF*/Δbi will not hold within bi+ Δbi.
Note: Be careful in HW#5, problem 7, parts 7-c (v) and 7-c (vi).
14
Case 1minimize 1307 pg1 + 1211 pg2 + 1254 pg4subject to theta1=0 -pb1 + 10 theta1 - 10 theta4 = 0 -pb2 + 10 theta1 - 10 theta2 = 0 -pb3 + 10 theta2 - 10 theta3 = 0 -pb4 - 10 theta3 + 10 theta4 = 0 -pb5 + 10 theta1 - 10 theta3 = 0 pg1 - 30 theta1 + 10 theta2 + 10 theta3 + 10 theta4 = 0 pg2 + 10 theta1 - 20 theta2 + 10 theta3 = 1.01 10 theta1 + 10 theta2 - 30 theta3 + 10 theta4 = 1.1787 pg4 + 10 theta1 + 10 theta3 - 20 theta4 = 0 -pg1 <= -0.5 pg1 <= 2 -pg2 <= -0.375 pg2 <= 1.5 -pg4<= -0.45 pg4 <= 1.8 -pb1 <= 500 pb1 <= 500 -pb2 <= 500 pb2 <= 500 -pb3 <= 500 pb3 <= 500 -pb4 <= 500 pb4 <= 500 -pb5 <= 500 pb5 <= 500Bounds -500 <= pb1 <= 500 -500 <= pb2 <= 500 -500 <= pb3 <= 500 -500 <= pb4 <= 500 -500 <= pb5 <= 500 -3.14159 <= theta1 <= 3.14159 -3.14159 <= theta2 <= 3.14159 -3.14159 <= theta3 <= 3.14159 -3.14159 <= theta4 <= 3.14159end
Change Pd2 from 1 to 1.01 (a 1 MW increase) and resolve.
Solution provides:Z*=$2717.8657
Previous solution was:Z*=$2705.7557
2717.8657-2705.7557---------------- 12.11
15
Case 2aTake a look at solution to original case:
PB5=0.4197 PB1 = -0.0152
PB4 = 0.4348
PB3 =0.3242
PB2=0.0955
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.2287pu
Pg4=0.45pu
Let’s constrain Pb3 to 0.3. This means that upper and lower bounds of Pb3 should be changed from (-500,500) to (-0.3,0.3).
We will, however, only do this in the “constraint” section.Having it in the “constraint” section will ensure when it binds, we will get a dual variable.But we will keep the (-500,500) in the “bounds” section in order to prevent CPLEX from imposing non-negativity.
So the new CPLEX code is as follows:16
Case 2aminimize 1307 pg1 + 1211 pg2 + 1254 pg4subject to theta1=0 -pb1 + 10 theta1 - 10 theta4 = 0 -pb2 + 10 theta1 - 10 theta2 = 0 -pb3 + 10 theta2 - 10 theta3 = 0 -pb4 - 10 theta3 + 10 theta4 = 0 -pb5 + 10 theta1 - 10 theta3 = 0 pg1 - 30 theta1 + 10 theta2 + 10 theta3 + 10 theta4 = 0 pg2 + 10 theta1 - 20 theta2 + 10 theta3 = 1.0 10 theta1 + 10 theta2 - 30 theta3 + 10 theta4 = 1.1787 pg4 + 10 theta1 + 10 theta3 - 20 theta4 = 0 -pg1 <= -0.5 pg1 <= 2 -pg2 <= -0.375 pg2 <= 1.5 -pg4<= -0.45 pg4 <= 1.8 -pb1 <= 500 pb1 <= 500 -pb2 <= 500 pb2 <= 500 -pb3 <= 0.3 pb3 <= 0.3 -pb4 <= 500 pb4 <= 500 -pb5 <= 500 pb5 <= 500Bounds -500 <= pb1 <= 500 -500 <= pb2 <= 500 -500 <= pb3 <= 500 -500 <= pb4 <= 500 -500 <= pb5 <= 500 -3.14159 <= theta1 <= 3.14159 -3.14159 <= theta2 <= 3.14159 -3.14159 <= theta3 <= 3.14159 -3.14159 <= theta4 <= 3.14159end
Solution provides:Z*=$2707.8358
Previous solution was:Z*=$2705.7557
Change Pb3 constraint from (-500,500) to (-0.3, 0.3) and resolve.
17
Case 2adisplay solution variables –Variable Name Solution Valuepg1 0.500000pg2 1.180325pg4 0.498375pb1 -0.039350theta4 0.003935pb2 0.119675theta2 -0.011968pb3 0.300000theta3 -0.041968pb4 0.459025pb5 0.419675All other variables in the range 1-12 are 0.
Z*=$2707.8358
In comparing the two solutions, we observe •flow on branch 3 is constrained to 0.3•flows all over the network have changed.•gen levels at buses 2 and 4 have changed.Activation of a transmission constraint has changed the dispatch. This will affect the energy prices!
PB5=0.4197 PB1 = -0.0152
PB4 = 0.4348
PB3 =0.3242
PB2=0.0955
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.2287pu
Pg4=0.45pu
Old solution
PB5=0.4197 PB1 = -0.0393
PB4 = 0.4590
PB3 =0.3 PB2=0.1197
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.1803pu
Pg4=0.4984pu
New solution
18
Case 2a($/per unit-hr)display solution dual -Constraint Name Dual Pricec4 -86.000000c7 1243.250000c8 1211.000000c9 1264.750000c10 1254.000000c11 -63.750000c22 -86.000000All other dual prices in the range 1-26 are 0.
Generation limits: We still see a non-0 dual variable (DV) on Pg1 lower limit, but the DV on the Pg4 lower limit has become 0, reflecting that Pg4 had to increase and come off of its lower limit to compensate for the decrease in Pg2 necessary to redispatch around the PB3 constraint.Branch limits: The DV on the PB3 upper bound is -86, and after dividing by 100 to change from per-unit to MW, it is -0.86 $/MW-hr, reflecting the increase in objective function that can be obtained from increasing the PB3 branch limit by 1 MW (from 0.30 per-unit to 0.31 per-unit).Recall the original case had PB3 flow at 0.324188. If we increase the PB3 branch limit in Case 2a to 0.324188, then we should see the objective increase by (.324188-.3)*-86=-2.0802. Our Case 2a objective is $2707.8358; objective of original problem is $2705.7557, reduced by $2.0801.
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 -63.750 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 0.0000PB3 -86.000 Pg4 0.0000 Pg4 0.0000PB4 0.0000 PB1 0.0000 PB1 0.0000PB5 0.0000 PB2 0.0000 PB2 0.0000P1 1243.25 PB3 0.0000 PB3 -86.000P2 1211.00 PB4 0.0000 PB4 0.0000P3 1264.75 PB5 0.0000 PB5 0.0000P4 1254.00 θ1 0.0000 θ1 0.0000
θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
19
Case 2a($/per unit-hr)display solution dual -Constraint Name Dual Pricec4 -86.000000c7 1243.250000c8 1211.000000c9 1264.750000c10 1254.000000c11 -63.750000c22 -86.000000All other dual prices in the range 1-26 are 0.
Nodal prices: The DVs on the equality constraints corresponding to the 4 nodes are the nodal prices. Without transmission constraints, these prices were all the same, at 12.11 $/MW-hr, a price set entirely by the generator at bus 2 since it was the bus 2 generator that responded to any load change. But now they are all different, with only bus 2 price at 12.11 $/MW-hr. This difference reflects that, because of the transmission constraint, a load increase at one bus will incur a different cost than a load increase at another bus.
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 -63.750 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 0.0000PB3 -86.000 Pg4 0.0000 Pg4 0.0000PB4 0.0000 PB1 0.0000 PB1 0.0000PB5 0.0000 PB2 0.0000 PB2 0.0000P1 1243.25 PB3 0.0000 PB3 -86.000P2 1211.00 PB4 0.0000 PB4 0.0000P3 1264.75 PB5 0.0000 PB5 0.0000P4 1254.00 θ1 0.0000 θ1 0.0000
θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
20
Case 2bLet’s increase the load at the highest price bus, bus #3, from 1.1787 to 1.1887 per unit, an increase of 1 MW. Resulting dispatch/flows are below, together with the Case 2a dispatch/flows.
PB5=0.4222 PB1 = -0.0443
PB4 = 0.4665
PB3 =0.3 PB2=0.1222
Pg1=0.5pu
Pd3=1.1887pu
Pd2=1pu
1 2
3 4
Pg2=1.1778pu
Pg4=0.5109pu
Case 2b flows/dispatch(PB3 constrained, Pd2=1.1887)
PB5=0.4197 PB1 = -0.0393
PB4 = 0.4590
PB3 =0.3 PB2=0.1197
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.1803pu
Pg4=0.4984pu
Case 2a flows/dispatch(PB3 constrained, Pd2=1.1787)
To supply an additional MW at bus 3, the generation levels of 2 different units had to be modified. Specifically, Pg2 was decreased from 1.1803 to 1.1778, a decrease of 0.0025 pu (0.25 MW). Pg4 was increased from 0.4984 pu to 0.5109 pu, an increase of 0.0125 pu (1.25 MW). Thus, Pg4 was increased enough to supply the increased load at bus 3 and the decreased gen at bus 2.
Question: Why did we not just increase Unit 2 or increase Unit 4 by 1 MW?
21
Case 2b
PB5=0.4222 PB1 = -0.0443
PB4 = 0.4665
PB3 =0.3 PB2=0.1222
Pg1=0.5pu
Pd3=1.1887pu
Pd2=1pu
1 2
3 4
Pg2=1.1778pu
Pg4=0.5109pu
Case 2b flows/dispatch(PB3 constrained, Pd2=1.1887)
PB5=0.4197 PB1 = -0.0393
PB4 = 0.4590
PB3 =0.3 PB2=0.1197
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.1803pu
Pg4=0.4984pu
Case 2a flows/dispatch(PB3 constrained, Pd2=1.1787)
In fact, it is not possible to supply additional load at bus 3 with only a single unit increase. We will always have to compensate for the load AND redispatch to compensate for the additional flow on the branch 3. As a result, the nodal price at bus 3 is a function of the generation costs at those buses that are used in the particular redispatch that achieves the minimum cost.
Answer: Because the resulting flow on branch 3 would exceed its capacity!!!
22
We can show this by writing the Lagrangian (with terms corresponding to the four equality constraints and the one inequality constraint), and applying firsts order conditions. On the injection equations, partials with respect to Pgi will be 0 except for injections that require Pgi to move in order to satisfy the line flow constraint (I should do this).
Demand biddingEconomists will tell you that a market is efficient if traders extract the maximum total net surplus (yellow area in below curve).
23
So we want to solve this problem:
GenBusesj
jkLoadBusesk
kkPP
PCPvjk
)()( max,
where vk and Ck represent the bids and offers of the load serving entities (LSEs) and generation owners, respectively.
Subject to constraints…..
Equivalently, we may use the following objective function in above problem:
LoadBusesk
kkGenBusesj
jkPP
PvPC jk
)()(min,
Demand biddingLinearizing both objective functions terms results in the following problem:
24
subject to
busesloadk
dkdkbusesgeneratork
gkgk PsPs__
min
'BP
)( ADPB
max,max, BBB PPP
busesgenkPP gkgk _,0 max,
busesloadkPP dkdk _,0 max,
NkPPP dkgkk ,...1,
Example with demand bidding
25
y13 =-j10 y14 =-j10
y34 =-j10
y23 =-j10
y12 =-j10
Pg1
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2
Pg4
1111 )( gg PsPK 250. 1 gP
,
2222 )( gg PsPK 50.1375. 2 gP
4444 )( gg PsPK 8.145. 4 gP
s1=13.07 $/MWhrs2=12.11 $/MWhrs4=12.54 $/MWhr
s1=1307 $/puMWhrs2=1211 $/puMWhrs4=1254 $/puMWhr
32
421
12001300
125412111307
dd
ggg
PP
PPPZ
Objective function:
2222 )( ddd PsPv
3333 )( ddd PsPv 1.00<Pd2<2.002.00<Pd3<3.00
sd2=13.00 $/MWhrsd3=12.00 $/MWhr
sd2=1300 $/puMWhrsd3=1200 $/puMWhr
26
,
111 dg PPP
DC power flow equality constraints:
0' BP
4
3
2
1
4
3
2
1
2010010
10301010
0102010
10101030
P
P
P
P
From last time:
222 dg PPP 333 dg PPP 444 dg PPP
where
Here Pg3, Pd1, Pd4 are fixed at 0,0,0, so the above become:
4314
43213
32122
43211
201010
10301010
102010
10101030
g
d
dg
g
P
P
PP
P
0201010
010301010
0102010
010101030
4314
43213
32122
43211
g
d
dg
g
P
P
PP
P
Putting the equations into CPLEX constraint form (variables on left, constant on RHS):
Example with demand bidding
Example with demand bidding
27
, Line flow equality constraints:
From last time:
0)( ADPB
This is exactly the same as in the previous examples.
100000
010000
001000
000100
000010
D
0101
1100
0110
001-1
1-001
A
31
43
32
21
41
4
3
2
1
4
3
2
1
4
3
2
1
1010
1010
1010
1010
1010
010010
101000
010100
001010
100010
0101
1100
011
100000
010000
001000
000100
000010
)(
0
001-1
1-001
AD
0
0
0
0
0
1010
1010
1010
1010
1010
0)(
31
43
32
21
41
5
4
3
2
1
4
3
2
1
b
b
b
b
b
b
P
P
P
P
P
ADP
01010
01010
01010
01010
01010
315
434
323
212
411
b
b
b
b
b
P
P
P
P
P
Note we need “full” node-arc incidence matrix because we have full DC power flow equations.
Example with demand bidding
28
,
0)( ADPB
01010
01010
01010
01010
01010
315
434
323
212
411
b
b
b
b
b
P
P
P
P
P
minimize:
0' BP
max,max, BBB PPP busesgenkPP gkgk _,0 max,
…and the inequality constraints
32421 12001300125412111307 ddggg PPPPPZ
0201010
010301010
0102010
010101030
4314
43213
32122
43211
g
d
dg
g
P
P
PP
P
busesloadkPP dkdk _,0 max,
CPLEX Codeminimize 1307 pg1 + 1211 pg2 + 1254 pg4 - 1300 pd2 - 1200 pd3subject to theta1=0 -pb1 + 10 theta1 - 10 theta4 = 0 -pb2 + 10 theta1 - 10 theta2 = 0 -pb3 + 10 theta2 - 10 theta3 = 0 -pb4 - 10 theta3 + 10 theta4 = 0 -pb5 + 10 theta1 - 10 theta3 = 0 pg1 - 30 theta1 + 10 theta2 + 10 theta3 + 10 theta4 = 0 pg2 -pd2 + 10 theta1 - 20 theta2 + 10 theta3 = 0 -pd3 + 10 theta1 + 10 theta2 - 30 theta3 + 10 theta4 = 0 pg4 + 10 theta1 + 10 theta3 - 20 theta4 = 0 -pg1 <= -0.5 pg1 <= 2 -pg2 <= -0.375 pg2 <= 1.5 -pg4<= -0.45 pg4 <= 1.8 -pd2 <= -1 pd2 <= 2 -pd3 <= -2 pd3 <= 3 -pb1 <= 500 pb1 <= 500 -pb2 <= 500 pb2 <= 500 -pb3 <= 500 pb3 <= 500 -pb4 <= 500 pb4 <= 500 -pb5 <= 500 pb5 <= 500Bounds -500 <= pb1 <= 500 -500 <= pb2 <= 500 -500 <= pb3 <= 500 -500 <= pb4 <= 500 -500 <= pb5 <= 500 -3.14159 <= theta1 <= 3.14159 -3.14159 <= theta2 <= 3.14159 -3.14159 <= theta3 <= 3.14159 -3.14159 <= theta4 <= 3.14159end
Objective
Line flows
DC power flow equations
Generation offer constraints
Line flow constraints
CPLEX only provides dual variables for equalities and inequalities that appear in the constraint list and not the “bounds” list, i.e., it does not provide dual variables for inequalities in the “bounds” list. If the exact same constraints are imposed both places, CPLEX will not provide a dual variable.
If you do not explicitly define a bound on a variable, then CPLEX applies bounds of 0 to ∞, and so if you want negativity for a variable, you must impose that here.
I can arbitrarily set one angle to whatever I like (within bounds), since it is the angle differences that are important.
29
Load bid constraints
SolutionThis is negative of the social surplus .
So the social surplus (Total Utility of Load less Total Cost of Supply) is $12.80. Not too much!
This is because the consumers are valuing the energy at just a little above cost.
If we change the utility function coefficients to 1500 and 1400, from 1300 and 1200, respectively, social surplus changes to $904/hr.
If we change utility function coefficients to 1000 and 900, respectively, social surplus would be -$924/hr, indicating cost of supply is more than utility of consumption, and the only reason any power is being consumed is the lower bound constraints we have placed on generation and demand.
Z*=-$12.80
30
Solution
display solution variables –Variable Name Solution Valuepg1 0.500000pg2 1.500000pg4 1.800000pd2 1.800000pd3 2.000000pb1 -0.587500theta4 0.058750pb2 0.462500theta2 -0.046250pb3 0.162500theta3 -0.062500pb4 1.212500pb5 0.625000All other variables in the range 1-14 are 0.
Z*=-$12.80
PB5=0.625 PB1 = -0.5875
PB4 = 1.2125
PB3 =0.1625
PB2=0.4625
Pg1=0.5pu
Pd3=2.0pu
Pd2=1.8pu
1 2
3 4
Pg2=1.5pu
Pg4=1.8pu
31
Solution ($/per unit-hr)display solution dual -Constraint Name Dual Pricec7 1300.000000c8 1300.000000c9 1300.000000c10 1300.000000c11 -7.000000c14 -89.000000c16 -46.000000c19 -100.000000All other dual prices in therange 1-30 are 0.
• c7-c10 are$13.00/MWhr Increasing load by 1 MW at any bus 1,2,3, or 4 increases objective by $13.00. This is set by the bus 2 load, Pd2, as it will respond to any MW change.
• There is only one unconstrained decision variable, Pd2, and it is the variable that is setting the nodal price ($13.00/MWhr). We say that Pd2 is a “regulating” or “marginal” unit.
32
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 -0.0000 Pg1 -7.0000 Pg1 0.0000PB2 -0.0000 Pg2 0.0000 Pg2 -89.00PB3 0.0000 Pg4 0.0000 Pg4 -46.00PB4 0.0000 Pd2 0.0000 Pd2 0.0000PB5 -0.0000 Pd3 -100.00 Pd2 0.0000P1 1300.0 PB1 0.0000 PB1 0.0000P2 1300.0 PB2 0.0000 PB2 0.0000P3 1300.0 PB3 0.0000 PB3 0.0000P4 1300.0 PB4 0.0000 PB4 0.0000
PB5 0.0000 PB5 0.0000 θ1 0.0000 θ1 0.0000 θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
Solution
Think of algorithm like this:
1. Initialize: Set gen and load at lower limits. At least one variable must come off its lower bound to provide power balance.
Sum of load lower bounds is 3; Sum of gen lower bounds is 1.325, one or more of the gens must come off their lower bounds by 1.675 pu in order to provide a feasible solution. This gen will be the one with the least offer. •Pg2 is least expensive and it comes off its lower bound first but can only supply up to 1.125 pu additional generation. We need 1.675 pu.•So Pg2 gets pushed to its limit.•Pg4 as next least-offer gen then comes off its lower limit of .45 and provides an additional amount equal to 1.675-1.125=.55, so that Pg4 is now generating at .45+.55=1.•At this point, the total generation is .375+1.125+.45+.55+.5=3; solution is feasible.
33
1.00<Pd2<2.002.00<Pd3<3.00
sg2=1211 $/pu-hr sd2=1300 $/pu-hrsg4=1254 $/pu-hr sd3=1200 $/pu-hrsg1=1307 $/pu-hr
8.145. 4 gP
50.1375. 2 gP
250. 1 gP
Pg2 Pg4 Pg1
So Pg4=1 and has 0.8 left at 12.54, Pd2=1, with 1.0 left at 13.00. Because 13.00>12.54, there is still surplus to be obtained!
Solution
34
2. Maximally increase surplus: Then it takes 1 MW (.01 pu) of supply and 1 MW (.01 pu) of demand from the gen/load pair not at upper bounds which provides the most positive surplus per MW. This will be the gen with the least cost and the load with the greatest utility, as long as surplus is positive. Repeat this until you hit limit (then switch) or surplus goes negative (then stop).• G4 goes to 1.8 and D2 goes to 1.8.• Now G4 is at limit and so we switch to G1 at 13.07, while D2 is at 13.00.• If we take a MW from this pair, the surplus will decrease!• STOP!
1.00<Pd2<2.002.00<Pd3<3.00
sg2=1211 $/pu-hr sd2=1300 $/pu-hrsg4=1254 $/pu-hr sd3=1200 $/pu-hrsg1=1307 $/pu-hr
8.145. 4 gP
50.1375. 2 gP
250. 1 gP
Demand bidding with constrained
transmissionPrevious solution, unconstrained transmission had Pb3=0.1625, so we constrain Pb3 to 0.16.
minimize 1307 pg1 + 1211 pg2 + 1254 pg4 - 1300 pd2 - 1200 pd3subject to theta1=0 -pb1 + 10 theta1 - 10 theta4 = 0 -pb2 + 10 theta1 - 10 theta2 = 0 -pb3 + 10 theta2 - 10 theta3 = 0 -pb4 - 10 theta3 + 10 theta4 = 0 -pb5 + 10 theta1 - 10 theta3 = 0 pg1 - 30 theta1 + 10 theta2 + 10 theta3 + 10 theta4 = 0 pg2 -pd2 + 10 theta1 - 20 theta2 + 10 theta3 = 0 -pd3 + 10 theta1 + 10 theta2 - 30 theta3 + 10 theta4 = 0 pg4 + 10 theta1 + 10 theta3 - 20 theta4 = 0 -pg1 <= -0.5 pg1 <= 2 -pg2 <= -0.375 pg2 <= 1.5 -pg4<= -0.45 pg4 <= 1.8 -pd2 <= -1 pd2 <= 2 -pd3 <= -2 pd3 <= 3 -pb1 <= 500 pb1 <= 500 -pb2 <= 500 pb2 <= 500 -pb3 <= 0.16 pb3 <= 0.16 -pb4 <= 500 pb4 <= 500 -pb5 <= 500 pb5 <= 500Bounds -500 <= pb1 <= 500 -500 <= pb2 <= 500 -500 <= pb3 <= 500 -500 <= pb4 <= 500 -500 <= pb5 <= 500 -3.14159 <= theta1 <= 3.14159 -3.14159 <= theta2 <= 3.14159 -3.14159 <= theta3 <= 3.14159 -3.14159 <= theta4 <= 3.14159end
Solution
display solution variables -Variable Name Solution Valuepg1 0.506667pg2 1.500000pg4 1.800000pd2 1.806667pd3 2.000000pb1 -0.586667theta4 0.058667pb2 0.466667theta2 -0.046667pb3 0.160000theta3 -0.062667pb4 1.213333pb5 0.626667All other variables in the range 1-14 are 0.
Z*=-$12.7533
36
PB5=0.6267 PB1 = -0.5867
PB4 = 1.2133
PB3 =0.16 PB2=0.4667
Pg1=0.5067pu
Pd3=2.0pu
Pd2=1.8067pu
1 2
3 4
Pg2=1.5pu
Pg4=1.8pu
Solution ($/per unit-hr)display solution dual -Constraint Name Dual Pricec1 -0.000000c4 -18.666667c7 1307.000000c8 1300.000000c9 1311.666667c10 1309.333333c14 -89.000000c16 -55.333333c19 -111.666667c26 -18.666667All other dual prices in the range 1-30 are 0.
37
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 -0.0000 Pg1 0.0000 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 -89.0000PB3 -18.6667 Pg4 0.0000 Pg4 -55.3333PB4 0.0000 Pd2 0.0000 Pd2 0.0000PB5 0.0000 Pd3 - 111.667 Pd3 0.0000P1 1307.0 PB1 0.0000 PB1 0.0000P2 1300.0 PB2 0.0000 PB2 0.0000P3 1311.667 PB3 0.0000 PB3 -18.6667P4 1309.333 PB4 0.0000 PB4 0.0000
PB5 0.0000 PB5 0.0000 θ1 0.0000 θ1 0.0000 θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
Demand bidding w/ constrained transmission
38
PB5=0.6250 PB1 = -0.5875
PB4 = 1.2125
PB3 =0.1625
PB2=0.4625
Pg1=0.5pu
Pd3=2.0pu
Pd2=1.8pu
1 2
3 4
Pg2=1.5pu
Pg4=1.8pu
Previous solution, unconstrained transmission, so we constrain Pb3 to 0.16.
PB5=0.6250 PB1 = -0.5867
PB4 = 1.2133
PB3 =0.16 PB2=0.4667
Pg1=0.5067pu
Pd3=2.0pu
Pd2=1.8067pu
1 2
3 4
Pg2=1.5pu
Pg4=1.8pu
New solution, with constrained transmission.
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 -0.0000 Pg1 0.0000 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 -89.0000PB3 0.0187 Pg4 0.0000 Pg4 -55.3333PB4 0.0000 Pd2 0.0000 Pd2 0.0000PB5 0.0000 Pd3 111.6667 Pd3 0.0000P1 1307.0 PB1 0.0000 PB1 0.0000P2 1300.0 PB2 0.0000 PB2 0.0000P3 1311.7 PB3 0.0000 PB3 -18.6667P4 1309.3 PB4 0.0000 PB4 0.0000
PB5 0.0000 PB5 0.0000 θ1 0.0000 θ1 0.0000 θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
Observe! There are two regulating buses this time.
RULE: For n binding constraints, there are at least n+1 marginal (regulating) buses.
The LMP at a marginal bus is always equal to its offer or bid.
sg2=1211 $/pu-hr sd2=1300 $/pu-hrsg4=1254 $/pu-hr sd3=1200 $/pu-hrsg1=1307 $/pu-hr
Settlement without congestion (fixed demand)
39
Original solution, ∞ transmission
Objective function: Z*=2705.8 $/hr.
PB5=0.4197 PB1 = -0.0152
PB4 = 0.4348
PB3 =0.3242
PB2=0.0955
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.2287pu
Pg4=0.45pu
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 96.0000 Pg1 0.0000
PB2 0.0000 Pg2 0 Pg2 0.0000PB3 0.0000 Pg4 43.0000 Pg4 0.0000
PB4 0.0000 PB1 0 PB1 0.0000PB5 0.0000 PB2 0 PB2 0.0000P1 1211.0 PB3 0 PB3 0.0000P2 1211.0 PB4 0 PB4 0.0000P3 1211.0 PB5 0 PB5 0.0000P4 1211.0 θ1 0 θ1 0.0000
θ2 0 θ2 0.0000 θ3 0 θ3 0.0000 θ4 0 θ4 0.0000
Amount paid to generators: hrMWhrMWLMPPPayment gg /$50.605/$11.1250111
hrMWhrMWLMPPPayment gg /$96.1487/$11.1287.122222 hrMWhrMWLMPPPayment gg /$95.544/$11.1245444
Total payments to gens: 605.50+1487.96+544.95=2638.41$/hr.
Amount paid by loads: hrMWhrMWLMPPPayment dd /$00.1211/$11.12100222
hrMWhrMWLMPPPayment dd /$41.1427/$11.1287.117233
Total payments by loads: 1211.00+1427.41=2638.41$/hr,
Market settles with total payment to gens equaling total payment to loads.
Question: Why does total payments to gens (or total payments by loads) not equal Z*=2705.8$/hr?
Settlement without congestion (fixed demand)Question: Why does total payments to gens (or total payments by loads) not equal Z*=2705.8$/hr?
Answer: We optimize on the offers. We settle at LMPs.
To illustrate, let’s see what happens if we settle at offers
Offers:sg2=1211 $/pu-hrsg4=1254 $/pu-hrsg1=1307 $/pu-hr
hrMWhrMWsPPayment gg /$50.653/$07.1350111
hrMWhrMWsPPayment gg /$96.1487/$11.1287.122222 hrMWhrMWsPPayment gg /$30.564/$54.1245444
Total payments to gens will be 653.50+1487.96+564.30=2705.76$/hr,
So why do we settle at the LMPs rather than the offers? According to paper referenced at the right:
J. Yan, G. Stern, P. Luh, and F. Zhao, “Payment versus bid cost,” IEEE Power and Energy Magazine, March/April 2008.
“The primary reason for this conclusion is that under the pay-as-bid settlement scheme, market participants would bid substantially higher than their marginal costs (since there is no incentive for participants to bid their operating cost) to try to increase their revenue and, thus, offset and very likely exceed the expected consumer payment reduction. As a result, currently all ISOs in the United States adopt the pay-at-MCP principle.”
• A pay-as-bid settlement scheme incentivizes participants to bid high since the bid is what they will be paid if their bid is accepted. The disincentive to bidding high is that their bid might not be accepted.
• A pay-at LMP settlement scheme provides no incentive to bid high. The disincentive to bid high because their bid might not be accepted remains.
Settlement with congestion (fixed demand)
41
Amount paid to generators:
Total payments to gens: 621.60+1429.34+624.99=2675.93$/hr.
Amount paid by loads: Total payments by loads: 1211.00+1490.70=2701.70$/hr,
Amount paid by loads exceeds that paid to the gens by $25.77. Why is this?
PB5=0.4197 PB1 = -0.0393
PB4 = 0.4590
PB3 =0.3 PB2=0.1197
Pg1=0.5pu
Pd3=1.1787pu
Pd2=1pu
1 2
3 4
Pg2=1.1803pu
Pg4=0.4984pu
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 -63.750 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 0.0000PB3 -86.000 Pg4 0.0000 Pg4 0.0000PB4 0.0000 PB1 0.0000 PB1 0.0000PB5 0.0000 PB2 0.0000 PB2 0.0000P1 1243.25 PB3 0.0000 PB3 -86.000P2 1211.00 PB4 0.0000 PB4 0.0000P3 1264.75 PB5 0.0000 PB5 0.0000P4 1254.00 θ1 0.0000 θ1 0.0000
θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000hrMWhrMWLMPPPayment gg /$60.621/$432.1250111
hrMWhrMWLMPPPayment gg /$34.1429/$11.1203.118222 hrMWhrMWLMPPPayment gg /$99.624/$54.1284.49444
hrMWhrMWLMPPPayment dd /$00.1211/$11.12100222 hrMWhrMWLMPPPayment dd /$70.1490/$647.1287.117233
Z*=$2707.8358
Settlement with congestion (fixed demand)
42
Why does amount paid by loads exceed that paid to the gens by $25.77?Consider under the condition of no losses, the power balance equation:
n
jdj
n
jgj PP
11
Now what if there is no congestion and prices at all buses are the same at LMP, i.e., LMP j=LMP for all buses j=1,…,n. In this case:
n
jdj
n
jgj PLMPPLMP
11
n
jdjj
n
jgjj PLMPPLMP
11
And we have just proved that for the case without congestion, when all LMPs are the same,the amount paid by loads equals the amount paid to the generators.
But when all LMPs are not the same (when we have congestion), the above proof does not hold. In this case, we can show that (see notes):
genk
gkkloadk
dkj
M
jbjj PLMPPLMPPCC **
1
The load pays into the market an amount exceeding the amount generators are paid by the congestion charges. These charges may be computed as the sum of products of line constraint dual variables and the RHS of the constraint. Let’s check that in the example we just did.
Settlement with congestion (fixed demand)
43
8.25016.*861
M
jbjj PCC
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 0.0000 Pg1 -63.750 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 0.0000PB3 -86.000 Pg4 0.0000 Pg4 0.0000PB4 0.0000 PB1 0.0000 PB1 0.0000PB5 0.0000 PB2 0.0000 PB2 0.0000P1 1243.25 PB3 0.0000 PB3 -86.000P2 1211.00 PB4 0.0000 PB4 0.0000P3 1264.75 PB5 0.0000 PB5 0.0000P4 1254.00 θ1 0.0000 θ1 0.0000
θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
Recall that the amount paid by loads exceeds that paid to the gens by $25.77.
Settlement with congestion (w/demand bidding)
44
Equality constraints Lower bounds Upper boundsEquation Value Variable value variable value
PB1 -0.0000 Pg1 0.0000 Pg1 0.0000PB2 0.0000 Pg2 0.0000 Pg2 -89.0000PB3 0.0187 Pg4 0.0000 Pg4 -55.3333PB4 0.0000 Pd2 0.0000 Pd2 0.0000PB5 0.0000 Pd3 111.6667 Pd3 0.0000P1 1307.0 PB1 0.0000 PB1 0.0000P2 1300.0 PB2 0.0000 PB2 0.0000P3 1311.7 PB3 0.0000 PB3 -18.6667P4 1309.3 PB4 0.0000 PB4 0.0000
PB5 0.0000 PB5 0.0000 θ1 0.0000 θ1 0.0000 θ2 0.0000 θ2 0.0000 θ3 0.0000 θ3 0.0000 θ4 0.0000 θ4 0.0000
Amount paid to generators:
Total payments to gens: 662.21+1950.00+2356.74=4968.95$/hr.
Amount paid by loads: Total payments by loads: 2348.67+2623.40=4972.07$/hr,
Amount paid by loads exceeds that paid to the gens by $3.12.
hrMWhrMWLMPPPayment gg /$21.662/$07.1367.50111 hrMWhrMWLMPPPayment gg /$00.1950/$00.13150222
hrMWhrMWLMPPPayment gg /$74.2356/$09.13180444
hrMWhrMWLMPPPayment dd /$67.2348/$00.13667.180222 hrMWhrMWLMPPPayment dd /$40.2623/$12.13200233
pg1 0.506667pg2 1.500000pg4 1.800000pd2 1.806667pd3 2.000000pb1 -0.586667theta4 0.058667pb2 0.466667theta2 -0.046667pb3 0.160000theta3 -0.062667pb4 1.213333pb5 0.626667
Use dual variable from line flow constraint:18.6667*.16=2.99
Summary
45
1. Congestion causes LMPs to vary from one bus to another.2. “Marginal” or “regulating” buses are not at either limits.3. There will always be at least n+1 regulating buses, where n is number of congested lines.4. We optimize on the offers and bids but we settle at the LMPs.5. If there is no congestion, the payments by the loads will equal the payments to the
generators.6. If there is congestion, the payments by the loads will exceed the payments to the
generators by the congestion charges. 7. The congestion charges equal the sum over all congested lines of the product of each
line’s dual variable and its line flow limit.