You are on page 1of 38

Power Generation Operation and Control

Laboratory User Manual

Department of Electrical and Computer


Engineering

University of Minnesota

July31, 2014

Textbook: Power Generation Operation and Control, Allen J. Wood, Bruce F.


Wollenberg, Gerald B. Shebl, 3rd Edition, John-Wiley and Sons, 2014
Program Files: The program files mentioned in this lab manual are all in Matlab
and available on the web site.
1

Table of Contents
Contents
Lab 1.

Economic Dispatch .................................................................................................................................. 3

Lab 2.

Unit Commitment..................................................................................................................................... 5

Lab 3.

Fuel Scheduling ........................................................................................................................................ 9

Lab 4.

Hydro Scheduling................................................................................................................................... 11

Lab 5.

Power Flow and Incremental Losses ...................................................................................................... 13

Lab 6.

Power System Security........................................................................................................................... 15

Lab 7.

DC powerflow Optimal Power Flow ..................................................................................................... 18

Lab 8.

AC powerflow OPF................................................................................................................................ 21

Lab 9.

State Estimation...................................................................................................................................... 26

Lab 10.

Simulation of a Market Auction with the DC power flow OPF ......................................................... 31

Lab 11.

Calculation of Financial Transmission Rights.................................................................................... 36

Note: If you are using an earlier version of Microsoft Excel you may have to convert the Lab xlsx files to xls
to work on them. You can do this and store them as xls as the Matlab programs are set up to read either forma
of spreadsheet file.

Lab 1.

Economic Dispatch

This lab takes the student through a number of exercises in economic dispatch.
Objectives:
1) To show the result of changes in the generator cost function data
2) To show the different methods of performing the economic dispatch
To run this Lab the student goes to the Lab 1 directory and enters: edc_lab_prob1
The first example uses three generators (see file edc_lab1_gendata.xlsx ) with data as follows:
Gen
Number
1
2
3

Pg
110
50
50

Pmax
500
700
750

Pmin
150
200
220

a_coeff
2000
1250
1700

b_coeff
25
15
10

c_coeff
0.05
0.04
0.03

Fuel
Cost
1
1
1

If we dispatch these generators to a total load of 900 MW we get the following:


numgen =
3
Pload =
900
unit
unit
unit

1
2
3

Pmin =
Pmin =
Pmin =

150
200
220

dfdp =
dfdp =
dfdp =

40.00
31.00
23.20

Pmax =
Pmax =
Pmax =

500
700
750

dfdp =
dfdp =
dfdp =

75.00
71.00
55.00

Largest_dfdp =
75
Smallest_dfdp =
23.2000
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda
Lambda

=
=
=
=
=
=
=
=
=
=
=
=
=

49.10
23.20
36.15
42.62
39.39
37.77
38.58
38.17
37.97
37.87
37.82
37.84
37.86

P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1

P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2

P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3

=
=
=
=
=
=
=
=
=
=
=
=
=

241.00
150.00
150.00
176.25
150.00
150.00
150.00
150.00
150.00
150.00
150.00
150.00
150.00

426.25
200.00
264.37
345.31
304.84
284.61
294.73
289.67
287.14
285.87
285.24
285.56
285.72

651.67
220.00
435.83
543.75
489.79
462.81
476.30
469.56
466.18
464.50
463.66
464.08
464.29

Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total

Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen

=
=
=
=
=
=
=
=
=
=
=
=
=

1318.92
570.00
850.21
1065.31
944.64
897.42
921.03
909.23
903.32
900.37
898.90
899.64
900.00

Gencost =
1.0e+04 *
0.6875

0.8801

1.2810

Total_gen_cost =
2.8486e+04

And the following graphic appears on the screen:

Generator Incremental (Marginal) Cost Functions


100
90
80

Lambda ($/MWh)

70
60
50
40
30
20
Gen 1 solid line
Gen 2 dashed line
Gen 3 dotted line

10
0

200

400
600
MW Generator Output

800

1000

In the figure above, the solid black horizontal line is the Lambda that the ED algorithm converges to. Where it
intersects each generator incremental cost curve is the value for that generators output. Thus Gen 1 is at its low
limit of 150 MW, Gen 2 is at 285.72 MW and Gen 3 is at 464.29 MW
All changes to the cases to run the further tests given below are done by changing the numbers on the
spreadsheet. Note that the spreadsheet has two worksheets: Parameters and GenData. When you make a change
you must SAVE the spreadsheet and then just rerun the Matlab program edc_lab_prob1.m and when it runs you
will be asked to select the Excel file in a small window that pops up. Just double click on the file and the
program reads the spreadsheet and executes.
Perform the following exercises on the edc program:
1) Set the Pload parameter in the Parameters worksheet to 900 (a load of 900 MW) and save and rerun
edc_lab_prob1.m explain the results
2) Set the Pload parameter in the Parameters worksheet to 1800 (a load of 1800 MW) and save and rerun
edc_lab_prob1.m explain the results
3) Leave the Pload parameter at 1800 on the Paramters worksheet. On the GenData worksheet change the
fuelcost for generator 2 from 1 to 0.8 and save and rerun. Compare the results to those in part 2 and
explain.
4) Leaving the changes to Pload and fuelcost as in the above two steps, change the c_coeff value for
generator 3 from 0.03 to 0.045. Compare the results to part 3 above and explain.

Lab 2.

Unit Commitment

You are going to run a full one week unit commitment program with 11 generating units. There are two types of
Excel spreadsheet files that you use to build the data for the unit commitment program.
To run this Lab the student goes to the Lab 5 directory and enters: unit_commitment
The first Excel Spreadsheet file is the Generator data file that has the following parameters for each generator:
Generator number
Initial generator MW
Max Capacity Limit
Min Capacity Limit
Start Up Cost
Ramp UP Limit
in % of unit capacity per hour
Ramp DOWN Limit in % of unit capacity per hour
Minimum down time in hours
"A" coefficient
"B" coefficient
"C coefficient
Fuel Cost
Start up cost
Ramp up rate as percent
Ramp down as percent
Min Down Time in hours
Min up time in hours
Where the cost function for each generator i = A(i) + B(i)*P(i) + C(i)*P(i)^2
For example for the data with 15 % ramp limits: (file: UCdata_LargeUnits15percentRampLim_gendata.xlsx)
Gen Number
1
2
3
4
5
6
7
8
9
10
11

Pg
100
100
80
80
60
60
50
50
25
25
25

Pmax
800
800
400
400
300
300
200
200
100
100
100

Pmin
100
100
80
80
60
60
50
50
25
25
25

a_coeff
5
5
20
20
30
30
40
40
55
55
55

b_coeff
4
6
8
10
10
12
14
16
15
17
17

c_coeff Fuel Cost


Startup Cost Ramp Up
Ramp Down
Mindown TimeMinup Time
0.001
1
0
15
15
1
1
0.002
1
0
15
15
1
1
0.0025
1
0
15
15
1
1
0.0025
1
0
15
15
1
1
0.002
1
0
15
15
1
1
0.002
1
0
15
15
1
1
0.0015
1
0
15
15
1
1
0.0015
1
0
15
15
1
1
0.0012
1
0
15
15
1
1
0.0012
1
0
15
15
1
1
0.0012
1
0
15
15
1
1

Other data sets are provided as follows:


UCdata_LargeUnits10percentRampLim_gendata.xlsx with 15 % ramp limits and some units with
min up down time set to large numbers
UCdata_LargeUnits25percentRampLim_gendata.xlsx
UCdata_LargeUnits50percentRampLim_gendata.xlsx
UCdata_LargeUnitsNoRampLim_gendata.xlsx (ramp limits are set to 100%)
5

UCdata_LargeUnits15percentRampLimMindowntime_gendata.xlsx this is a special case with


some minimum up and down times.
UCdata_SmallUnits50percentRampLim_gendata.xlsx Total capacity 2900MW (set with 50% ramp
limits and smaller gen units)
UCdata_SmallUnitsNoRampLim_gendata.xlsx Total capacity 2900MW
The next Excel Spreadsheet file is the load data file:
The load data file has parameters to run the unit commitment as follows:
numhours
maxpload
alpha1
alpha2
MaxIter
gap_error
datadump
plotload
edc_tolerance

168
3000
0.01
0.002
30
0.01
1
1
1.00E09

Number of hours for unit commitment


Max peak load over the time period
alpha adjust constant 1
alpha adjust constant 2
Maximum iterstions
Value of duality gap to converge
set this multiplier to 1 for data output or 0 for no output
set plotload to 1 for a plot of the loads for each hour
EDC convergence tolerance

The student will be asked to change the maxpload which is the maximum peak load for the week.
The other tables allow the program to build a simulated week of load data having 168 hours. There are two
tables used to do this:
The 24 Hour Indices are a set of indices of load during the 24 hour day. All days have the same shape only the
peak load during the day is different and the shape is stretched out to accommodate the peak.

Hour
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Load
Index
3.5
3.4
3.3
3.25
3.3
3.4
3.5
3.7
3.9
4.3
4.7
5.3
5.6
5.7
5.65
5.5
5.5
5.3
5.2

19
20
21
22
23

5.1
5
4.4
4.2
3.7

The second type of data is the day multiplier which give the relative peak load during the days of the week:
DayMult
Day
1
Sunday
1.2
Monday
1.35
Tuesday
1.35 Wednesday
1.4
Thursday
1.6
Friday
1.05
Saturday
1.05

Note that the final entry in column 1 should be repeated to give 8 entries.
The resulting load for the 168 hour week for a 3000 MW peak looks like this:

3000
2800
2600
2400
2200
2000
1800
1600
1400
1200
1000

20

40

60

80

100

120

140

160

180

There are three load files:


Largegen_set_loaddata.xlsx
Smallgen_set_loaddata.xlsx
Largegen_set_fastrise_loaddata.xlsx

The solution for the first 24 hours, large genset loaddata appears like this:
The Unit commitment
Hour Load Total
MW
Gen
1 1151
1151
2 1118
1118
3 1086
1086
4 1069
1069
5 1086
1086
6 1118
1118
7 1151
1151
8 1217
1217
9 1283
1283
10 1414
1414
11 1546
1546
12 1743
1743
13 1842
1842
14 1875
1875
15 1859
1859
16 1809
1809
17 1854
1854
18 1831
1831
19 1839
1839
20 1845
1845
21 1850
1850
22 1664
1664
23 1623
1623
24 1461
1461

Schedule
Gen
Gen
1
2
800.0 351.3
800.0 318.4
800.0 285.5
800.0 269.1
800.0 285.5
800.0 318.4
800.0 351.3
800.0 417.1
800.0 482.9
800.0 534.5
800.0 636.7
800.0 746.3
800.0 800.0
800.0 800.0
800.0 800.0
800.0 782.9
800.0 800.0
800.0 794.8
800.0 799.3
800.0 800.0
800.0 800.0
800.0 702.5
800.0 679.6
800.0 580.5

Gen
3
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
80.0
109.4
197.1
242.1
275.0
258.6
226.3
254.4
235.8
239.5
245.4
250.3
162.0
143.7
80.0

Gen
4
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
5
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
6
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
7
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
8
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
10
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Gen
11
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0

Sum
Cost
6205
5963
5726
5609
5726
5963
6205
6701
7214
8304
9406
11136
12033
12339
12186
11732
12147
11928
12003
12064
12109
10433
10073
8683

The first column is the hour number, the second is the load, and the other comumns are the generator MW
output for each unit (0.0 being a unit that is off)

Exercises:
Perform the following exercises on the unit commitment:
1) Run the program with maxpload set to 3000 MW with the following generator sets, use the
Largegen_set_loaddata.xlsx load file for all:
a. NoRampLim
b. 50percentRampLim
c. 25percentRampLim
d. 15percentRampLim
Explain the results noting that as the generators are restricted to lower ramp limits it contributes
to difficulty in following fast changing load.
e. Run with the 15 percent ramp limits and the minup.mindown time limits case.
2) Change the peak load to 2000 MW and rerun the above sets. Explain results.
3) Run with the smallgen load set file and the two smallgen generator sets.
4) Run with the Largegen_set_fastrise_loaddata.xlsx and the same set of ramp limits (cases a, b,c,d
and e) of 1 above.

Lab 3.

Fuel Scheduling

You are going to run experiments and explain results for the coal delivery example in the textbook example 5C.
In this example a train is scheduled to leave a coal mine each week and deliver coal to two power plants as
shown in the figure below:

To run this Lab the student goes to the Lab 3 directory and enters: Fuel_scheduling_with_LP_ex5C
The parameters for the problem are found in the text. The lab comes with four sets of data with parameter data
as shown here:
Pload1
Pload2
Pload3
V1_initial_volume
V2_initial_volume
Total_Delivery1
Total_Delivery2
Total_Delivery3

1200
1500
800
70000
70000
40000
40000
40000

Pload week 1
Pload week 2
Pload week 3
Initial volume in coal pile 1
Initial volume in coal pile 2
Total coal delivered week 1 (must be <= 40000.)
Total coal delivered week 2 (must be <= 40000.)
Total coal delivered week 3 (must be <= 40000.)

Any of these parameters may be changed by the student.

The data files to be used are:


1)
2)
3)
4)

Fuel_scheduling_example5C_fuelscheddata (this has the same data as the textbook example 5C)
Fuel_scheduling_example5C_set1_fuelscheddata
Fuel_scheduling_example5C_set2_fuelscheddata
Fuel_scheduling_example5C_set3_fuelscheddata

The first set of data is the same as the textbook example 5C, run it and check that it matches the textbook.

Exercises:
The three other data sets have variations in load, initial volume of coal piles, and coal delivered. Run each of
them and explain the results.

10

Lab 4.

Hydro Scheduling

The hydro scheduling lab is an extension of problem 5.11 in the text third edition.
The student can run three different cases and can make adjustments to parameters for each. The input to the
program comes in spreadsheet files such as:
1) HydroSched_data_hydrodata.xlsx
2) HydroSched_dataset2_hydrodata.xlsx
3) HydroSched_dataset3_hydrodata.xlsx
To run this Lab the student goes to the Lab 4 directory and enters: Hydro_sched_dynamic_prog
There are two worksheets in these files:
Parameters:
inflow

1000

Water inflow into reservoir in AF/hour

Volume_step

2000

Volume step in AF (must be one of these values 2000, 1000, 500, 200, 100, 50)

initial_volume

6000

Volume of water in reservoir at the start (all volume values must be between 18000 and 6000)

end_volume

6000

Volume of water in reservoir at the end (all volume values must be between 18000 and 6000)

nperiodhours

Number of hours per period

diagnostic_trace

set = 1 program will show all variables each step, = 0 no such output

tables_dump

set = 1 program will show all tables, = 0 no such output

Number of hours per period can be 1, 2, 4, 6,


If student wants to get the inside picture of how the DP works turn on the diagnostic or tables dump.
Hourly Load
Load
MW
600
1000
900
500
400
300

Hour
1
2
3
4
5
6

The student can simulate a hydro plan operating for 24 hours with six equal time periods of 4 hours each. Or 12
periods of 2 hours each, or 24 periods of one hour each. The sample file shave 6 period data and 12 period data.

Exercises:
Run the first data set HydroSched_data_hydrodata.xlsx then make the following changes:
1)
2)
3)
4)

Set the volume step to 1000


Set the volume step to 500
Set the volume step to 200
Set the volume step to 100
Note any differences in the results and explain them.
11

Run set 2 data file HydroSched_dataset2_hydrodata.xlsx


1) Change the inflow from 1000 to 2000 and change the end volume to 18000 AF
Note the schedule produced and explain. The student should go back to the text and note that the DP
can have a very detailed hudro plant model and in the case of problem 5.11 there is a variable head
feature (see also ch 1 for variable head). Can you explain what it is doing?

12

Lab 5.

Power Flow and Incremental Losses

In this lab students will be running the Newton power flow and then calculating the incremental losses using the
method given section 6.22 of the text (3rd Edition). Once the penalty factors are calculated, the program applies
the penalty factors to the economic dispatch program which calculates new values for each generator Pgen. The
program then applies the resulting Pgen values back into the power flow and recalculates the penalty factors,
and reruns the edc, etc.
To run this Lab the student goes to the Lab 5 directory and enters: runedcbeta
There are two types of files read by the program:
1. 6Buscase_networkdata.xlsx containing all power flow network data
2. 6Buscase_gendata.xlsx
- containing the generator data (identical to generator data for Lab1)
Later we will include an alternate generator data file.
When the program starts the student has to double click first on the network data file, and then when it comes
up the generator data file. The program starts with a base or preliminary power and the output looks like this:
Case ID: 6Buscase_networkdata.xlsx
Case ID: 6Buscase_gendata.xlsx
Iter
MAXDP MAXDPbus
MAXDQ MAXDQbus
1
0.825895
6
0.649412
4
2
0.049751
2
0.080792
5
3
0.000373
2
0.000575
5
Power Flow with Total Pgen =
Total PLoad=
Total MW Losses =
Bus Vmag
1 1.070

1.050

1.050

1.027

1.022

1.025

angle
0.00

-7.18

-9.16

-0.15

-0.18

-0.21

Pgen
212.956

50.000

50.000

312.956
300.000
12.956
Qgen
-10.759

21.757

19.016

Total Qgen =
Total Qload=

Pload
0.000

0.000

0.000

100.000

100.000

100.000

Qload
0.000

30.014
45.000

To Bus

Pline

Qline

2
4
5

62.181
82.797
67.978

-18.280
5.868
1.652

1
3
4
5
6

-58.580
14.764
28.859
21.944
43.013

20.986
-5.995
8.661
0.849
-2.744

2
5
6

-14.662
12.434
52.228

-0.110
2.879
16.246

1
2
5

-79.774
-28.438
8.212

1.823
-9.977
-6.847

1
2
3
4
6

-64.731
-21.499
-12.231
-8.071
6.532

3.955
-3.808
-7.808
-1.271
-6.068

2
3
5

-41.839
-51.679
-6.483

0.720
-15.651
-0.068

0.000

0.000

15.000

15.000

15.000

This is the same format as introduced in the text for power flow output.

13

Next the program calculates the beta factors, the incremental losses and penalty factors:
beta =
1.0000
dPlossdP =
0
Penfac =
1.0000

1.0903

1.1137

1.1056

1.1322

1.1426

-0.0903

-0.1137

-0.1056

-0.1322

-0.1426

0.9172

0.8979

0.9045

0.8833

0.8752

Next the economic dispatch program applies the penalty factors and calculates the ecomonic values of Pgen
using Lambda search:
basePgen =
2.1296
0.5000
Ptarget =
312.9556
Lambda =
11.9450
Lambda =
10.0891
Lambda =
11.0171
Lambda =
11.4811
Lambda =
11.7131
Lambda =
11.5971
Lambda =
11.5391
Lambda =
11.5681
Lambda =
11.5536
Lambda =
11.5463
Lambda =
11.5427
Lambda =
11.5409
Lambda =
11.5418
Lambda =
11.5413
Lambda =
11.5415
Lambda =
11.5417
Total_gen_cost =
4.3153e+03

0.5000
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1
P1

P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2
P2

P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3
P3

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00
50.00

150.00
37.50
94.40
122.85
137.08
129.97
126.41
128.19
127.30
126.86
126.63
126.52
126.58
126.55
126.56
126.56

166.71
45.00
96.97
131.84
149.27
140.55
136.20
138.37
137.28
136.74
136.47
136.33
136.40
136.37
136.38
136.38

Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total
Total

Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen
Gen

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

366.71
132.50
241.37
304.69
336.35
320.52
312.61
316.56
314.59
313.60
313.10
312.85
312.98
312.92
312.95
312.95

The student can then observe that a new power flow is calculated, then a new beta calculation and a new edc,
etc. for five iterations.
A variation of the use of penalty factors is to make the generator cost functions all equal, then then the
minimum cost dispatch simply minimizes the total Pgen for the three generators. In so doing, the system losses
are minimized. There is a separate generator data file for this called 6Buscase_minLoss_gendata.xlsx
Exercises:
1. Run the base network data with the generator data (not min losses) and note the results.
a. Change the fuel cost for generator 3 to 1.2 and compare the results for the economic dispatch and
for the power flow (for example, what happened to losses with a fuel cost change, explain).
b. Reset the fuel costs to all be 1.0. Now go to the network data and set go to the Parameters page
and set the parameter casemult to 1.5 and save the spreadsheet. The casemult parameter is
multiplied times all load and generation values, so setting it to 1.5 raises the load and generation
by a factor of 1.5 everywhere in the powerflow. Now rerun the program. Note the increase in
load, are the generation units still the same dispatch? Are any generators at their limit?

14

Lab 6.

Power System Security

There are two programs that students can use and there are four powr flow cases you can use for this lab. The
programs are:
DC powerflow contingency analysis (to run enter: run_DCpowerflow_cont_anal in Lab 6 directory)
AC powerflow contingency analysis (to run enter: run_ACpowerflow_cont_anal in Lab 6 directory)

The DC powerflow contingency analysis runs an AC power flow to set a base line for all calculations, and then
runs a DC power flow and calculates contingency outages with LODF factors.
The DC power flow program starts with an AC powr flow to set the base:
Total Pgen
Total PLoad
Total PLosses
Bus

Pmin
MW
50.0
37.5
45.0

1
2
3
4
5
6
Bus
1

Vmag
kV
246.1

241.5

241.5

=
=
=

Pgen
MW
213.0
50.0
50.0

312.96
300.00
12.96
Pmax
MW
450.0
150.0
180.0

angle
deg
0.00

MW
MW
MW
Qmin
MVAR
-100.0
-100.0
-100.0

Pgen
MW
212.96

-7.18

Total Qgen
Total Qload
Total QLosses

Qgen
MVAR
-10.76

50.00

-9.16

Qgen
MVAR
-10.8
21.8
19.0

50.00

21.76

19.02

=
=
=

Qmax
MVAR
150.0
150.0
120.0

Pload
MW
0.00

0.00

0.00

30.01
45.00
-14.99
Pload
MW
0.0
0.0
0.0
100.0
100.0
100.0

Qload
MW
0.00

MVAR
MVAR
MVAR

Qload
MVAR
0.0
0.0
0.0
15.0
15.0
15.0

To Bus

Vmin
pu
0.95
0.95
0.95
0.95
0.95
0.95

Vbus
pu
1.07 UL
1.05
1.05
1.03
1.02
1.02

Vbus
kV
246.1
241.5
241.5
236.3
235.1
235.7

Pline
MW

Qline
MVAR

2
4
5

62.18
82.80
67.98

-18.28
5.87
1.65

100
100
100

1
3
4
5
6

-58.58
14.76
28.86
21.94
43.01

20.99
-5.99
8.66
0.85
-2.74

100
60
60
60
60

2
5
6

-14.66
12.43
52.23

-0.11
2.88
16.25

60
60
60

Vmax
pu
1.07
1.07
1.07
1.07
1.07
1.07

Max
Flow MW

0.00

0.00

. . .
Then the LODF matrix is printed:
LINE OUTAGE DISTRIBUTION FACTOR (LODF) MATRIX
Monitored
Outage of one circuit
Line
From - To
1 to
1
1
1
2
2

to
to
to
to
to

2
4
5
3
4

0.0000
0.5948
0.4052
-0.1029
-0.5884

1 to

0.6353
0.0000
0.3647
-0.0323
0.7647

1 to

0.5427
0.4573
0.0000
0.1783
-0.1708

2 to

-0.1127
-0.0331
0.1458
0.0000
0.1591

2 to

-0.5031
0.6121
-0.1090
0.1242
0.0000

2 to

-0.2103
-0.0618
0.2721
0.2262
0.2969

2 to

-0.1221
-0.0359
0.1580
0.4662
0.1724

3 to

-0.1369
-0.0403
0.1772
-0.3995
0.1933

(Note the last three columns and the last six rows are truncated here to fit it all on this page)
Finally the DC power flow is run and then a contingency analysis with the LODF factors:
15

BASE TRANSMISSION LOADING DC POWERFLOW


Path

From

To

Low

Flow

High

5
5
5
5
5
5
5
5
5
5
5

1
1
1
2
2
2
2
3
3
4
5

2
4
5
3
4
5
6
5
6
5
6

-100.0
-100.0
-100.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0

60.65
76.66
62.69
13.68
32.03
22.26
42.67
12.54
51.14
8.69
6.18

100.0
100.0
100.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0

CONTINGENCY
drop
1 to
CONTINGENCY
drop
1 to
CONTINGENCY
drop
1 to
CONTINGENCY
drop
1 to
CONTINGENCY
drop
2 to
CONTINGENCY
drop
3 to

OVERLOAD
2 mon
OVERLOAD
4 mon
OVERLOAD
4 mon
OVERLOAD
5 mon
OVERLOAD
6 mon
OVERLOAD
6 mon

to

to

to

to

to

to

contflow
112.73
contflow
109.35
contflow
90.65
contflow
105.33
contflow
78.38
contflow
72.55

Percent Loading

contlimit
100.0
contlimit
100.0
contlimit
60.0
contlimit
100.0
contlimit
60.0
contlimit
60.0

60.6
76.7
62.7
22.8
53.4
37.1
71.1
20.9
85.2
14.5
10.3
rating
100.0
rating
100.0
rating
60.0
rating
100.0
rating
60.0
rating
60.0

overload%
112.7
overload%
109.4
overload%
151.1
overload%
105.3
overload%
130.6
overload%
120.9

************* OVERLOADS DETECTED ***************


************************************************

The AC powerflow runs an AC power flow (Newtons method) in each single line outage and calculates the PI
for voltage and flows and collects the results in a table at the end. This program produces a great deal of output.
If the student wants to save all the output it is best to use the Matlab diary feature by first setting up a diary file,
then running the program, and then closing the diary, such as:
diary (AC contingency analysis results.txt)
run_ACpowerflow_cont_anal
diary off
The diary file AC contingency analysis results.txt will now contain all the output for each contingency case.
Each contingency analysis is done with the full AC power flow. At the end of the power flow you will see a line
like this:
PI_flow = 11.769 PI_volt = 7.048

Worst flow violation = 20.742 Worst volt violation = 0.000

Worst_bus =

This is a summary of the case giving the PI for both flows and voltage as explained in the text. The actual wors
flow and voltage limit violation is also given, if the worst bus is given as 0 then there was no voltage violation.
Finally these summary for all cases is given in a table at the end:
CONTINGENCY RESULTS
Contingency
No
From Bus
Contingency
1
from
1
to
Contingency
2
from
1
to
Contingency
3
from
1
to
Contingency
4
from
2
to
Contingency
5
from
2
to
Contingency
6
from
2
to
Contingency
7
from
2
to
Contingency
8
from
3
to
Contingency
9
from
3
to

To Bus
2
4
5
3
4
5
6
5
6

PI voltage
7.048
7.036
7.030
7.047
7.034
7.032
7.031
7.034
7.101

%Violation
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000

PI flows
11.769
146.114
13.229
0.705
2.437
0.978
33.905
2.113
17.616

%Violation
20.742
55.156
19.688
0.000
1.067
0.000
33.599
0.000
26.919

16

Contingency
Contingency

10
11

from
from

4
5

to
to

5
6

7.040
7.043

0.000
0.000

0.792
1.375

0.000
0.000

The student can see that the second contingency outage results in some serious line overloads and that none of
the contingencies results in serious voltage problems.
There are four cases that can be tried with these two programs:
6bus case (taken from textbook)
IEEE14bus case
IEEE118bus case
IEEE RTS Test case (developed as the Reliability Test System by IEEE PES committees)
The student can use any of them in the lab but note that the 118 and the RTS test case are going to produce large
amounts of output for the AC contingency analysis.
Note: The contingency analysis programs do not read separate generator data files. The power flow data files
have sufficient generator data to execute the contingency analysis.
Exercises:
1) Pick a power flow case, say the 6 bus case. Run the DC powerflow contingency
analysis. Note the flows produced by the DC power flow and compare to the AC power
flow. Are there any differences if so explain as best you can.
2) Now run the AC powerflow contingency analysis on the same case. Do the results
differ from the DC power flow results using the LODF factors? Are there voltages out
of limit on any contingencies.

17

Lab 7.

DC powerflow Optimal Power Flow

This is an OPF based on the linear (or DC) power flow. Some of its features are:
User can adjust the total load of the system using parameter casemult
User can choose to have the OPF solve with line flow limits (flow limit constraints). These can be
turned on or off using the parameter Line_flow_limits
User can solve with contingency analysis using LODF factors and have active contingency overloads
incorporated into the OPF (contingency constraints). These can be turned on or off using the parameter
Contingency_Limits
User can have the contingency analysis based on a limit that is higher than the normal line flow limit by
using the climadj parameter.
To run this Lab the student goes to the Lab 7 directory and enters: runDCOPF_QP
The program then presents a list of case files that can be used. Lab 7 is set up to run any of the supplied network
analysis cases:
6bus case (taken from textbook)
IEEE14bus case
IEEE118bus case
IEEE RTS Test case (developed as the Reliability Test System by IEEE PES committees)
When the student double clicks on one of the cases the program begins by displaying its internal steps:
Case ID: 6BusCase_networkdata.xlsx
Optimization terminated.
exitflag=
1 QP solution successful
CONTINGENCY ANALYSIS
Add new active contingency constraint, number of active limits =
Drop line
1 4 Overload on
2 4 Flow =
95.49 Limit =

1
90.00

Optimization terminated.
exitflag=
1 QP solution successful
CONTINGENCY ANALYSIS
No new contingencies added to active set

As shown above, it first performs an optimization of the system and then it does a contingency analysis. In the
case above with the 6bus system, one contingency, dropping line 1 to 4 produces an overload on line 2 to 4. It
then runs another optimization with the contingency constraint added and then checks for more contingencies.
In the case shown there are no new contingency constraints added. The output then displays the following:

18

LIST OF BINDING line LIMITS


flow limit from
3 to
6

flow=

60.0

LIST OF ACTIVE CONTINGENCY CONSTRAINTS


CONTINGENCY OVERLOAD
drop
1 to
4 overload on
2 to
Loads pay a total of :
Generators receive a total of :
Transmission congestion charges:

limit=

contflow
90.0

60.0
contlimit
90.0

rating overload%
60.0
100.0

7403.45
3848.29
3555.16

TOTAL VARIABLE GENERATION COST =

4267.2

TOTAL GENERATION BID


TOTAL GENERATION SUPPLIED
TOTAL VARIABLE LOAD
TOTAL FIXED LOAD
TOTAL LOAD

530.0
300.0
0.0
300.0
300.0

=
=
=
=
=

Here the program lists all line flow constraints and contingency constraints that are active and then some data
for the OPF solution.
Last of all the program displays the generation dispatch, the generation and load at each bus with its Lambda
(Locational Marginal Price), the flows with the constrained flow Lambda, and the contingency flows with its
contingency constraint Lambda.
GENERATION AND LOAD RESULTS
Bid
Number
1
2
3

Bid
bus
1
2
3

Bcoeff
Constant
11.67
10.33
10.83

Ccoeff
Constant
0.00533
0.00889
0.00741

Min
MW
50.0
37.5
45.0

Max
MW
200.0
150.0
180.0

Generator
Incremental Cost
13.61
11.12
11.93

MW
181.9
44.2
73.8

Generator
Cost
2512.42
674.36
1080.40

NO LOAD SHED
GENERATION and LOAD by Bus
Bus
Number
1
2
3
4
5
6

Generation
at bus
181.93
44.23
73.85
0.00
0.00
0.00

Load
at bus
0.00
0.00
0.00
100.00
100.00
100.00

Bus
Lambda
13.608
11.119
11.927
41.008
17.323
15.703

RESULTING TRANSMISSION LOADING:Path

From

1
2
3
4
5
6
7
8
9
10
11

1
1
1
2
2
2
2
3
3
4
5

To

Low
2
4
5
3
4
5
6
5
6
5
6

Flow

-100.0
-100.0
-100.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0
-60.0

High

53.8
71.4
56.7
5.2
35.4
20.9
36.5
19.1
60.0
6.8
3.5

Percent Loading

100.0
100.0
100.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0

53.8
71.4
56.7
8.7
58.9
34.8
60.9
31.8
100.0
11.4
5.8

line Lambda
-0.00
-0.00
-0.00
-0.00
0.00
0.00
-0.00
0.00
5.53
-0.00
-0.00

CONTINGENCY OUTAGES RESULTING IN FLOWS CLOSE TO LIMIT


CONTINGENCY
drop
1 to

4 overload on

to

contflow
90.0

contlimit
90.0

rating
60.0

overload%
100.0

contingency
lambda
35.82

Exercises see next page.


19

Exercises:
1) First the student should run one of the cases. If you select the large 118 bus system you may need to use
the diary function to capture all output. Run this first test with Contingency_Limits = 0 so no
contingency analysis is performed.
2) Next run with Contingency_Limits = 1, to see how it adds contingency overload constraints. If there
is no solution (see error messages when the optimization is executed) then try setting climadj to a
higher value to force it to bring the solution within larger limits. Making climadj larger always makes
the solution easier to reach.
3) Next Adjust the casemult parameter up or down to see the effect on how many contingencies are
captured.
4) Optional: Set the printfactorsflag = 1 and rerun to see the AFACT, PTDF, and LODF matrices.

20

Lab 8.

AC powerflow OPF

To run this Lab the student goes to the Lab 8 directory and enters: runAC_LPOPF_QP
The AC Optimal Power Flow uses the iterative LP method of solution. The steps in this solution are:
1) Solve a base case power flow
2) Linearize the objective function around the solution
3) Linearize the constraints around the solution
4) Set variable limits (window size)
5) Solve the LP (all LP variables are deltas)
6) If significant change in any variable go back to step 1, else done.
The figure below gives an idea of how this works:

The 6 bus system with line flow limits solution of an AC OPF first solves an AC power flow based on the initial
conditions:

21

Case ID: 6BusCase_networkdata.xlsx


Constraint Setup
Bus
Pgen
Qgen
Vgen
RUN BASE POWER FLOW ON INPUT DATA
Iter
MAXDP MAXDPbus
MAXDQ MAXDQbus NumVARlim NumVlim
1
0.825895
6
0.649412
4
0
1
2
0.049751
2
0.080792
5
0
1
3
0.000373
2
0.000575
5
0
1
POWER FLOW RESULTS
Power Flow with Total Pgen =
Total PLoad=
Total MW Losses =

312.956
300.000
12.956

Bus
1
2
3
4
5
6

Qmax
150.0
150.0
120.0

Pmin
50.0
37.5
45.0

Pgen
213.0
50.0
50.0

Bus Vmag
1 1.070

1.050

1.050

1.027

1.022

1.025

Pmax
200.0
150.0
180.0

angle
0.00

-7.18

-9.16

Qmin
-100.0
-100.0
-100.0

Qgen
-10.8
21.8
19.0

Pgen
212.956

50.000

50.000

Qgen
-10.759

21.757

19.016

-8.45

-10.53

-11.76

limits_indicator
Bus
Pgen
Qgen
1
212.96
-10.76
2
50.00
21.76
3
50.00
19.02
Iteration: 1 Objective: 4478.8448

Total Qgen =
Total Qload=
Total MVAR Losses =

Pload
0.0
0.0
0.0
100.0
100.0
100.0

Qload
0.0
0.0
0.0
15.0
15.0
15.0

Pload
0.000

Qload
0.000

0.000

100.000

100.000

Vbus
1.07UL
1.05
1.05
1.03
1.02
1.02

Vmax
1.07
1.07
1.07
1.07
1.07
1.07

To Bus

kv
123.1
120.8
120.8
118.1
117.5
117.8

LambdaP
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000

Pline

Qline

2
4
5

62.181
82.797
67.978

-18.280
5.868
1.652

1
3
4
5
6

-58.580
14.764
28.859
21.944
43.013

20.986
-5.995
8.661
0.849
-2.744

2
5
6

-14.662
12.434
52.228

-0.110
2.879
16.246

1
2
5

-79.774
-28.438
8.212

1.823
-9.977
-6.847

1
2
3
4
6

-64.731
-21.499
-12.231
-8.071
6.532

3.955
-3.808
-7.808
-1.271
-6.068

2
3
5

-41.839
-51.679
-6.483

0.720
-15.651
-0.068

LambdaQ
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000

0.000

0.000

100.000

Vmin
0.95
0.95
0.95
0.95
0.95
0.95

30.014
45.000
-14.986

0.000

15.000

15.000

15.000

Vgen
1.0700 UL
1.0500
1.0500
delta: 0.100000

sigma:

0.000000

Note that only bus one is at its high voltage limit, note that no flows are at limit and the cost is 4478. The results
at the end of the optimization are seen on the next page:

22

Power Flow with Total Pgen =


Total PLoad=
Total MW Losses =
Bus
1
2
3
4
5
6

Pmin
50.0
37.5
45.0

Pgen
105.9
129.3
72.3

Bus Vmag
1 1.070

1.070

1.065

1.038

1.036

1.042

Pmax
200.0
150.0
180.0

angle
0.00

-1.90

-3.32

Qmin
-100.0
-100.0
-100.0

307.457
300.000
7.457

Qgen
-5.1
6.6
9.2

Pgen
105.906

129.288

72.262

-4.85

-6.38

-6.27

limits_indicator
Bus
Pgen
Qgen
1
105.91
-5.08
2
129.29
6.60
3
72.26
9.16
Line Overloads Detected
From Bus
To bus
Pflow
2
4
60.00
3
6
59.99

Qmax
150.0
150.0
120.0

Qgen
-5.082

6.603

9.163

Total Qgen =
Total Qload=
Total MVAR Losses =

Pload
0.0
0.0
0.0
100.0
100.0
100.0

Qload
0.0
0.0
0.0
15.0
15.0
15.0

Pload
0.000

0.000

0.000

100.000

100.000

100.000

Vmin
0.95
0.95
0.95
0.95
0.95
0.95

Qload
0.000

Vbus
1.07UL
1.07UL
1.07UL
1.04
1.04
1.04

To Bus

10.685
45.000
-34.315
Vmax
1.07
1.07
1.07
1.07
1.07
1.07

kv
123.1
123.0
122.5
119.4
119.1
119.8

LambdaP
12.7983
12.6311
11.9040
13.9546
13.5625
14.3065

Pline

Qline

2
4
5

15.297
48.673
41.937

-9.624
4.619
-0.076

1
3
4
5
6

-15.046
11.284
60.000
29.987
43.063

5.547
-3.432
4.506
1.098
-1.116

2
5
6

-11.229
23.497
59.995

-3.128
-1.029
13.319

1
2
5

-47.617
-58.413
6.031

-4.842
-3.556
-6.602

1
2
3
4
6

-40.700
-29.191
-22.909
-5.953
-1.246

-1.939
-3.147
-3.215
-1.844
-4.856

2
3
5

-41.927
-59.323
1.250

-1.214
-12.181
-1.605

LambdaQ
-0.0000
0.0000
0.0162
0.1263
0.0595
0.0088

0.000

0.000

15.000

15.000

15.000

Vgen
1.0700 UL
1.0700 UL
1.0650 UL
PflowMax
60
60

Pflow Lambda
1.0397
2.7828

Now all three grnerator buses are at their high voltage limit, the flows on lines 2 to 4 and 3 to 6 are also being
driven to their high limit, and the cost has been reduced to 4254.
Three graphs are printed at the end of the solution to show how the objective was reduced. These are on the next
page:

23

Objective Function Value


4500

Objective Function Value

4450

4400

4350

4300

4250

10

15

Iteration

10

Control Variable Error

10

10

10

10

Control Variable Error

-1

-2

-3

-4

10

12

14

Iteration

Objective Function Value Error

10

10

10

10

10

10

Objective Function Value Error

-1

-2

10

12

14

Iteration

Th top plot shows the objective function as the solution progresses through the 14 iterations, the second plot
shows the control variables changes as the solution converges, the final plot simply shows the changes in the
objective function. Student exercises are on the next page:
24

Exercises:
Students can pick the 6bus, 14 bus or the 118 bus (use the diary ftn to capture the output).
1) Run the base solution using in the spreadsheet provided.
2) Run the same case and increase total load by setting the casemult parameter to 1.05 to increase the
load by 5%. Does your case converge? Are more limits being hit?
3) Run the 6Buscase_minLoss_gendata case which has the three generators with identical cost
functions so that the minimization reduces losses. Now go back to Lab 5 where we did the same thing
but with the optimization using only the standard EDC with calculated penalty factors. Are the losses
lower with the full AC OPF?

25

Lab 9.

State Estimation

The state estimator requires students to use three separate programs:


1) Power flow program sets up the base case. The entire solution is saved into a binary file:
PowerFlowOutput.mat
2) SCADA program reads a measurement description file and then extracts the measured values from
the power flow solution generated in step 1 above. The entire measurement set is saved in a binary
file: StateEstimatorData.mat
3) The State estimator reads the two binary files saved in steps 1 and 2 above and carries out the state
estimate calculation.
Note: all three steps in succession can be run by entering run_all which runs the powerflow, followed by
SCADA, followed by the State estimator. The figure below shows all the programs and data paths.

run_powerflow

Power flow
program

PowerFlowOutput.mat
(binary file)

run_estimator

Network data
Spreadsheet files

Display
Powerflow
Output

State
Estimator

run_scada

SCADA

Measurement data
spreadsheet files

StateEstimatorData.mat
(binary file)

Display
estimator
results

Display
Measurement
Data

26

Power Flow Program


This step can be run separately by entering run_powerflow or it will be called if the user has started the
run_all command. The power flow allows the user to select the power flow case from among the stored
spreadsheet data files. When the data is read the program prints the power flow results and saves the
PowerFlowOutput.mat binary file and exits.
Typical power flow output appears like this:
Case ID: 6BusCase_networkdata.xls
Iter
MAXDP MAXDPbus
MAXDQ MAXDQbus
1
0.825895
6
0.618486
6
2
0.097117
2
0.142304
5
3
0.001265
2
0.002313
5
Power Flow with Total Pgen =
Total PLoad=
Total MW Losses =
Bus Vmag
1 1.070

1.050

328.581
300.000
43.020

angle
Pgen
Qgen
0.000 228.581 -32.176

-14.455

50.000

75.714

Total Qgen =
Total Qload=

Pload
0.000

0.000

Qload
0.000

67.737
45.000

To Bus

Pline

Qline

2
4
5

123.575
179.938
105.006

-35.594
23.881
3.418

1
3
4
5
6

-109.268
11.351
93.093
15.599
39.225

59.712
-5.420
17.198
5.296
-1.072

0.000

SCADA
This program is run by entering run_scada or it will be called if the user has started the run_all command.
The SCADA program mimics what a SCADA (Supervisor Control and data Acquisition) system does, in this
case it allows the user to select a measurement set from among the measurement data spreadsheets stored in the
Lab 9 directory and then reads the PowerFlowOutput.mat binary file so it can extract the actual measured
values for each measurement and store them in a new data set. The user can select some options from a menu as
given below:

Option 1 allows the user to add random noise which is normally distributed, zero mean, variance matching the
measurements variance specification. This simulates the type of data received by real state estimator which is
generally corrupted by noise sue to measurement errors and variations in the measured quantities.
Option 2 allows the user to edit the measured data, again there is a menu:
27

Options 1,2, and 3 require the user to enter a bus number and then a new measurement value. Option 4 requires
the user to enter a from bus and a to bus followed by a new measurement value. Options 3 and 4 allow the user
to enter a new P and anew Q value for the measurement.
Example of editing a voltage measurement. Note that the user here is given a per unit voltage and enters a new
per unit value. The final printout of measurements shows the kV values.
Case ID: 6bus_Vand_noAmeas_measurementdata.xls
which volt measurement would you like to edit?
volt meas number
Vmeasbus
Vmeasvalue
1
1
1.070
2
2
1.050
3
3
1.050
4
4
0.991
5
5
1.014
6
6
1.023
volt measurement number:2
Volt bus:
2
Please input a new value to the voltage measurement data for the bus you have selected
Vmeasnew: 1.1
Now the new voltage data become:
volt meas number
Vmeasbus
Vmeasvalue
1
1
1.070
2
2
1.100
3
3
1.050
4
4
0.991
5
5
1.014
6
6
1.023

At this point the program returns to the main menu and you can edit another measurement if you like.
When all measurement data editing is done, the user clicks on option 5 and the SCADA program goes back to
the initial Scada menu where the user can add noise, edit or store the data and exit. If the user elects option 3 to
store and exit the program prints out all the measurements on the screen and stores the
StateEstimatorData.mat binary file. The printout looks like this:
Measurement
Name Status
MV1
MA1
MG1
M12
M14
M15

1
1
1
1
1
1

Base Case Value


kV
MW
MVAR
Bus
1
246.1
0.0
228.6 -32.2
123.6 -35.6
179.9
23.9
105.0
3.4

Measured Value
kV
MW
MVAR
246.1
0.0
228.6
123.6
179.9
105.0

-32.2
-35.6
23.9
3.4

28

MV2
MA2
MG2
M21
M23
M24
M25
M26

1
1
1
1
1
1
1
1

Bus
2
241.5
-14.5
50.0
-109.3
11.4
93.1
15.6
39.2

253.0
-14.5
75.7
59.7
-5.4
17.2
5.3
-1.1

50.0
-109.3
11.4
93.1
15.6
39.2

75.7
59.7
-5.4
17.2
5.3
-1.1

Etc.

State Estimator
The state estimator allows the user to make one selection at the start:

The user can elect to detect and identify dad data, or this can be ignored completely. Since we changed the bus
2 voltage we will run the Detect bad data option and show what the estimator does:
Estimator iteration summary
Iteration
Residual
J
1
2
3
4
5
6

Number Active
Measurements

Degrees of
Freedom

Bad Data Threshold


Tj

Largest
Normalized
Residual

Bad
Measurement
at

485939.820
1491.078
1288.259
1282.595
1278.994
1276.619
67

56

69.063

Bad Data Detected


1
613.153
2
2.029

35.737
66

55

MV2

67.940

Final State Estimator Result


Measurement
Name Status
MV1
MA1
MG1
M12
M14
M15

1
1
1
1
1
1

MV2
MA2
MG2
M21
M23
M24
M25
M26

0
1
1
1
1
1
1
1

Base Case Value


kV
MW
MVAR
Bus
1
246.1
0.0
228.6 -32.2
123.6 -35.6
179.9
23.9
105.0
3.4
Bus
2
241.5
-14.5
50.0
75.7
-109.3
59.7
11.4
-5.4
93.1
17.2
15.6
5.3
39.2
-1.1

Measured Value
kV
MW
MVAR
246.1
0.0
228.6
123.6
179.9
105.0

Estimated Value
MW
MVAR

246.1
0.0
-32.2
-35.6
23.9
3.4

253.0
-14.5
50.0
-109.3
11.4
93.1
15.6
39.2

kV

226.4
122.3
178.6
104.1

-32.0
-35.5
23.8
3.4

50.9
-108.3
11.2
93.1
15.6
39.2

76.1
59.0
-5.2
17.6
5.5
-0.8

241.6
-14.5
75.7
59.7
-5.4
17.2
5.3
-1.1

The first part of the estimator output shows the value of the residual as the estimator converges. The threshold
Tj here is 69.063 and the estimator is showing a J of 1276.619 so there is most likely bad data. The estimator
29

identifies this as MV2 (Voltage Measurement on bus 2) and removes it from the measurement set. Then reruns
the estimator and the J is now 2.029, well below the new value of Tj=67.94 so it accepts this solution. Note that
the voltage magnitude measurement value displayed for bus 2 of 253.0 kV is much different from the base
value od 241.5kV. This is because we changed it from 1.05 to 1.1 per unit volt in the SCADA editor.

Exercises:
The network data set give you is:
6BusCase_networkdata.xls
The measurement data sets available are:
6bus_bus1onlypseudos_measurementdata.xls
6bus_buses1and2only_measurementdata.xls
6bus_Vand_noAmeas_measurementdata.xls

1) Run the basic estimator and use the 6BusCase_networkdata.xls file and the
6bus_Vand_noAmeas_measurementdata.xls file and do not add noise or edit any
measurements. Run the estimator with or without detection of bad data.
2) Run the same data files as above, but this time, edit the injection measurement at bus 6 so that P and Q
are set to +100 and +15 (instead of -100 and -15). Run the estimator with bad data detection. Did it find
the bad data at bus 6? Did it eliminate the bad data and what values did it then estimate.
3) Run the estimator and use the 6BusCase_networkdata.xls file and the
6bus_buses1and2only_measurementdata.xls files. Note here that there are no measurements
beyond those at buses 1 and 2, yet the estimator does a reasonable job of estimating the remainder of the
network.
4) Run the estimator with the 6BusCase_networkdata.xls file and the
6bus_bus1onlypseudos_measurementdata.xls files. Here the injections measurements at buses
2,3,and 6 are set to be pseudo measurements (i.e. measurements with large variance) note how the
solution differs from that found in the first three exercises.
5) Run the basic estimator and use the 6BusCase_networkdata.xls file and the
6bus_Vand_noAmeas_measurementdata.xls file and add noise at the SCADA step. Note the
differences in solution.

30

Lab 10.

Simulation of a Market Auction with the DC power flow OPF

This lab allows students to experiment with a market simulation on either the textbook 6 bus case or the IEEE
118 bus case. Students are encouraged to experiment with different bidding and transactions by changing the
spreadsheet files for these data inputs.
The idea here is to simulate both generators bidding into a spot market as well as loads bidding in with a
negative cost indicating that the load will actually be reduced if the network conditions cannot be satisfied.
The program uses Linear Programming to solve the OPF and it models the networks with the DC power flow.
Contingency analysis is carried out using LODF factors and contingency constraints are added to the LP when
there are overloads.
The transactions spreadsheet allows students to experiment with a variety of fixed transactions representing
bilateral contract sales that are in place on the network and must be accommodated with the spot market.
To run this Lab the student goes to the Lab 10 directory and enters: runMARKET
The program then asks the student to select from the input case files:

We will demonstrate the program running the 6 bus case, but the student exercises will ask you to use the 118
bus case so that more complexity can be investigated.
When the program starts it asks for the three types of data to be selected:
Case ID: 6Buscase_networkdata.xlsx
Case ID: 6buscase_biddingdata.xlsx
Case ID: 6buscase_transactionsdata.xlsx
BASE CASE TRANSACTIONS :Transaction
Number
1
2

From
bus
6
5

number_of_islands =

To
bus
4
4

MW
20.0
20.0

Note that the transactions entered are displayed at the start. The network data is the same basic information as
used previously in power flow, security analysis, and OPF labs. The bidding data in the biddingdata spreadsheet
looks like this:
bid A

bid B
0
0
0
0
0
0

12
10
11
-200
-200
-200

bid C

bidmin
0
0
0
0
0
0

0
0
0
0
0
0

bidmax bidbus
450
1
150
2
180
3
40
4
40
5
40
6

31

The bidding data gives a linear cost number for each generator and each load (load costs are entered as
negative). Then the generator or loads min and max P and finally the bus where the generator or load is
located.
The next piece of data is read is the transactions table. Transactions are fixed MW point to point transactions.
The spreadsheet looks like this:
frombus tobus
MW
6
4
20
5
4
20

Here two transactions of 20 MW are scheduled, one from 6 to 4 and one from 5 to 4.
Next the program starts by performing a spot market calculation minimizing the cost of generation bids minus
the cost of load shedding (see textbook chapter 11). Then it runs a contingency analysis and reruns the LP over
and over until all contingency constraints are satisfied:
********************************************************
**************SPOT MARKET SIMULATION ********************
********************************************************
OPFcalc
LP EXECUTION WITH
0 CONTINGENCY CONSTRAINTS
Optimization terminated.
add contingency constraint
2
5
0.76
66.00
LP EXECUTION WITH
1 CONTINGENCY CONSTRAINTS
Optimization terminated.
add contingency constraint
4
9
-0.62
66.00
add contingency constraint
8
9
0.60
66.00
add contingency constraint
9
4
-0.53
66.00
LP EXECUTION WITH
4 CONTINGENCY CONSTRAINTS
Optimization terminated.

Finally the solution summary is output:


NO BINDING CIRCUIT LIMITS FOUND
LIST OF BINDING CONTINGENCY LIMITS
CONTINGENCY OVERLOAD
drop
1 to
4 ckt=
2 mon
2
drop
2 to
3 ckt=
4 mon
3
drop
3 to
5 ckt=
8 mon
3

to
to
to

4
6
6

ckt=
ckt=
ckt=

5
9
9

contflow
66.0
66.0
65.1

contlimit
66.0
66.0
66.0

rating
60.0
60.0
60.0

overload
100.0
100.0
98.6

TRANSACTIONS CHARGES :Transaction


Number
1
2

From
bus
6
5

To
bus
4
4

MW

Transaction Charge

20.0
20.0

$
$

Loads pay a total of :


Transactions pay a total of :
Generators receive a total of :
Transmission congestion revenues:

$
$
$
$

11275.67
6954.66
1615.62
16614.62

TOTAL VARIABLE GENERATION COST =

1615.62

TOTAL GENERATION BID


TOTAL GENERATION SUPPLIED
TOTAL LOAD BID
TOTAL LOAD SUPPLIED
bus
Number
1
2
3

bus
Lambda
12.00
-5.12
11.00

=
=
=
=

3706.16
3248.50

780.0
143.3
150.0
143.3
bus
Generation
39.2
0.0
104.1

bus
Load
0.0
0.0
0.0

Transactions
0.0
0.0
0.0

Bus Net Flow


MW
39.2
0.0
104.1

32

4
5
6

200.00
37.57
14.69

0.0
0.0
0.0

43.3
50.0
50.0

-40.0
20.0
20.0

-83.3
-30.0
-30.0

Several points must be made here:


1) The contingency limits are set to 10% above the normal limits by setting climadj to 1.1 on the
parameters page of the network data file.
2) Four contingency constraints were in the LP but only three of them are sufficiently close to limit to
print out. Two of them are held at the limit and one is at 98.6% of the limit.
3) The program calculates the charge to transactions as the difference in bus lambda at the ends of the
transaction times the MW of the transaction.
4) The bus lambda at bus 2 is negative and it has shut down that generator entirely.
5) Bus 4 lambda is at 200 and its load has been shed.
6) Note that the parameter casemult does not have any effect here because the loads are variable and
are set in the bidding input.
The final output is:
GENERATION AND LOAD BIDDING RESULTS
Bid
Number
1
2
3
4
5
6

Bid
bus
1
2
3
4
5
6

BidB
Constant
12.00
10.00
11.00
-200.00
-200.00
-200.00

BidC
Inc Cost
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000

Max
MW
450.0
150.0
180.0
50.0
50.0
50.0

MW
Sold/Purchased
39.2
0.0
104.1
43.3
50.0
50.0

Generator
Lambda
12.00
0.00
11.00

Generator
Cost
470.27
0.00
1145.34

bus
Load Not Supplied
Number
MW
1
0.00
2
0.00
3
0.00
4
6.69
5
0.00
6
0.00
TOTAL LOAD NOT SUPPLIED

RESULTING TRANSMISSION LOADING :From


To
ckt
Low
1
2
1
-100.0
1
4
2
-100.0
1
5
3
-100.0
2
3
4
-60.0
2
4
5
-60.0
2
5
6
-60.0
2
6
7
-60.0
3
5
8
-60.0
3
6
9
-60.0
4
5
10
-60.0
5
6
11
-60.0
RESULTING CONTINGENCY ANALYSIS
CONTINGENCY OVERLOAD
lambda
drop
1 to
4 ckt=
2 mon
drop
2 to
3 ckt=
4 mon
drop
3 to
5 ckt=
8 mon

6.7

Flow
6.2
28.3
4.7
-28.0
44.3
0.6
-10.8
27.6
48.5
-10.6
-7.8

High
100.0
100.0
100.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0

Percent Loading
6.2
28.3
4.7
46.7
73.9
1.0
17.9
46.0
80.8
17.7
12.9

contflow
2
3
3

to
to
to

4
6
6

ckt=
ckt=
ckt=

5
9
9

66.0
66.0
65.1

circuit Lambda
0.00
0.00
0.00
-0.00
0.00
0.00
-0.00
0.00
0.00
-0.00
-0.00

contlimit
66.0
66.0
66.0

rating

overload

contingency

60.0
60.0
60.0

100.0
100.0
98.6

245.77
5.97
0.00

33

The first table shows the generator and load bidding information and the results of the market calculations. The
nest table is a list of load that was shed, followed by the DC power flows calculated at the market solution and
the list of contingency constraints that are binding at the solution.
Note: This program can reach a point where it cannot solve. There are two cases where this can happen. The
first is when the Linear Program routine finds that the contingency limits have forced it into an infeasible
solution. In this case you will get this message:
***************************************************
CASE TERMINATED
LP CANNOT BE SOLVED
PROGRAM WILL NOW PAUSE AND YOU SHOULD HIT CTRL+C
***************************************************

When this happens you need to press the Ctrl key and the C key together (control C is a standard way to force
programs to exit. The other case where the program needs to abort occurs when too many contingency
constraints are forced. This can easily happen if the transactions input is set to a large MW transaction amount
for one or more transactions which will cause a large number of contingency overloads. The program arbitrarily
sets the limit at 100 contingency overloads and then quits and you will see this: (next page)
***************************************************
CASE TERMINATED
TOO MANY CONTINGENCIES
PROGRAM WILL NOW PAUSE AND YOU SHOULD HIT CTRL+C
***************************************************

Again, you should hit the Ctrl and C keys together to abort. (Be sure to hit the Ctrl and C right away, Maplab is
waiting for some input due to the pause and will not let you do anything until it get something.)

Exercises:
1) Students should load the transactions file for the 6 bus case into the Excel spreadsheet program and
adjust the transactions amount to be both zeros. What effect does this have? Now try setting them at 30
MW and rerun the OPF. What is the effect now. How high can you make the transaction MW before the
market cannot accommodate the transactions.
2) Bus 4 is not receiving the load it is bidding, if it raises its willingness to pay price from 200 to a higher
value it should get the full load. Try raising the willingness to pay price from 200 to a higher value and
see how high that must be to have bus 4 receive its full load MW. (note always enter this as a negative
value, for example if you wish to make it $300/MWh willingness to pay then enter -300 for bus 4 bid as
as shown below):
bid A

bid B
0
0
0
0
0
0

12
10
11
-300
-200
-200

bid C

bidmin
0
0
0
0
0
0

0
0
0
0
0
0

bidmax bidbus
450
1
150
2
180
3
50
4
50
5
50
6

34

3) How much load can this market supply, assuming all load buses are bidding the same MW amount at
$200/MWh. For example, if they all bid 40 MW then you set up the bidding table as:
bid A

bid B
0
0
0
0
0
0

12
10
11
-200
-200
-200

bid C

bidmin
0
0
0
0
0
0

0
0
0
0
0
0

bidmax bidbus
450
1
150
2
180
3
40
4
40
5
40
6

Try running with the bidding spreadsheet set as above. Are all loads satisfied? How high a load (again,
loads equal on each load bus) until load is shed?
4) Try running the 118 bus case. The transactions are set up so that the market calculation works out a
solution with two of the eight contingency constraints found are near limit. How much more can the
transactions be raised until the case cannot solve?

35

Lab 11.

Calculation of Financial Transmission Rights

The calculation of Financial Transmission Rights (FTRs) is designed to show how much various transaction
paths can carry while meeting other obligations of the transmission system. Participants who want to use the
transmission system need to have a means for guaranteeing that their transactions from a specified source point
to a specified delivery point can be made. If the transaction is not allowed, then the FTR acts as an insurance
policy that pays the participant. To obtain an FTR, the participant bids into an auction for a desired MW
transaction amount from a source to a delivery point. Thus the participants needing to purchase FTRs are
competing with each other and may raise their offer accordingly. An excellent introduction to this topic is the
paper by Ma, Sun, and Ott1
To run this Lab the student goes to the Lab 11 directory and enters: runFTR
The first date read is the network data which is the same as in the power flow, security analysis, and OPF
programs.
Next the program reads in the FTR bids and the NITS data.
The transmission operator, IOSs in the United States, has an obligation to provide transmission service to what
are termed Network Integrated Transmission Service (NITS) defined as follows:
Network Integration Transmission Service allows a Transmission Customer to integrate, plan, economic
dispatch and regulate its Network Resources to serve its Network Load in a manner comparable to that
in which the Transmission Provider utilizes its Transmission System to serve its Native Load customers.
Network Integration transmission Service also may be used by the Transmission Customer to deliver
non-firm energy purchases to its Network Load without additional charge.2
The NITS service is be simulated by placing a set of fixed transactions on the network to simulate the source
and delivery of such entities as electric companies who own the transmission and need to supply their loads. For
our 6bus system the NITS transactions simulate supply of 50 MW loads at buses 4, 5, and 6:
FromBus ToBus
MaxMW
1
4
50
3
5
50
3
6
50

These are entered into the 6buscase_FTRdata.xlsx spreadsheet file in the NITS worksheet.
Next, the FTR calculation takes into account all the FTR bids as a MW amount from a source to a delivery
point. Each bid also has an offer price. For the 6bus system the FTR bids are:
FromBus ToBus
MaxMW PriceBid
3
4
100
20.00
2
4
100
20.00

These are entered into the 6buscase_FTRdata.xlsx spreadsheet file in the FTRbids worksheet.
1

Implementation of the PJM Financial Transmission Rights Auction Market System, Xingwang Ma, David I. Sun, and Andy Ott,
available in IEEE Explore, Transactions on Power Systems
2
The Power Marketing Association Electricity Glossary, http://www.powermarketers.com/gloss-b.html

36

The program performs an island check to remove any lines from the contingency analysis that will split the
system if taken out.
Then it performs an LP with the FTR bids as the only variables, the results are then put into a security analysis
using the LODF factors as with the MARKET simulation.
Case ID: 6Buscase_networkdata.xlsx
Case ID: 6buscase_FTRdata.xlsx
number_of_islands =
1
********************************************************
******************** FTR AUCTION ***********************
********************************************************
LP EXECUTION WITH
0 CONTINGENCY CONSTRAINTS
Optimization terminated.
add contingency constraint
2
5
0.76
72.00
add contingency constraint
4
9
-0.62
72.00
add contingency constraint
8
9
0.60
72.00
LP EXECUTION WITH
3 CONTINGENCY CONSTRAINTS
Optimization terminated.
NO BINDING CIRCUIT LIMITS FOUND
LIST OF BINDING CONTINGENCY LIMITS
CONTINGENCY OVERLOAD
drop
1 to
4 ckt=
2 mon
2
drop
3 to
5 ckt=
8 mon
3

to
to

4
6

ckt=
ckt=

5
9

contflow
72.0
72.0

contlimit
72.0
72.0

rating
60.0
60.0

overload
100.0
100.0

Here are the results. Note that two transaction bids shown above do not result in 100 MW transaction rights for
the bidders:
bus
Number
1
2
3
4
5
6

Bus Summary
bus
bus
Lambda
Generation
-72.42
0.0
-74.22
31.5
-74.22
3.8
-54.22
0.0
-69.68
0.0
-71.35
0.0

bus
Load
0.0
0.0
0.0
35.3
0.0
0.0

Network Integrated Transmission Service Summary


From
To
NITS
Bus
Bus
MW
1
4
50.0
3
5
50.0
3
6
50.0

From
Bus
3
2

Resulting FTR Summary


To
FTR
FTR
Bus
Max
Price
4
100.0
20.00
4
100.0
20.00

Bus Lambda
Difference
20.00
20.00

FTR MW
Cleared
3.8
31.5

Here the FTRs allowed are a 3.8 MW transaction from bus 3 to 4 and a 31.5 MW transaction allowed from 2 to
4.

37

Finally, the FTR program displays the DC power flow results and the binding contingencies:
RESULTING TRANSMISSION LOADING :From
To
ckt
Low
Flow
1
2
1
-100.0
6.7
1
4
2
-100.0
30.9
1
5
3
-100.0
12.5
2
3
4
-60.0
-20.3
2
4
5
-60.0
48.4
2
5
6
-60.0
8.1
2
6
7
-60.0
2.0
3
5
8
-60.0
28.8
3
6
9
-60.0
54.7
4
5
10
-60.0
-6.1
5
6
11
-60.0
-6.7
RESULTING CONTINGENCY ANALYSIS
CONTINGENCY OVERLOAD
lambda
drop
1 to
4 ckt=
2 mon
drop
3 to
5 ckt=
8 mon

High
100.0
100.0
100.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0
60.0

Percent Loading
6.7
30.9
12.5
33.8
80.7
13.4
3.3
48.0
91.2
10.1
11.2

contflow
2
3

to
to

4
6

ckt=
ckt=

5
9

circuit Lambda
0.00
0.00
0.00
-0.00
0.00
0.00
0.00
0.00
0.00
-0.00
-0.00

contlimit

72.0
72.0

72.0
72.0

rating

overload

contingency

60.0
60.0

100.0
100.0

23.85
3.75

If the student now goes back to the MARKET simulation, Lab 10, and changes the transactions to reflect the
FTR results:
frombus tobus
MW
3
4
3.8
2
4
31.5

The MARKET program will allow these transactions without any load reductions.

Exercises:
1) The student should run the FTR program with the basic 6 bus data shown in the lab write up above.
Then go back to the Lab 10 directory, change the 6buscase_transactionsdata.xlsx file to equal the
transactions shown above (3 to 4 for 3.8 MW and 2 to 4 for 31.5 MW).
2) Rerun the FTR program as many times as necessary with the offer amount for the 3 to 4 transaction
changed to a higher value until the FTR program allows more than 3.8 MW. What effect does this have
on the other transaction bid?
3) Run the FTR program with the 118 bus system. Note that the FTR bids are for transactions that cross the
system from one end to the other ( bus 112 to bus 1 for 100 MW) and for another that goes from bottom
to top (bus 27 to bus 2 for 100 MW). Which transaction was completely fulfilled and which was cut?
4) In exercise 3 one transaction FTR was cut, try rerunning the FTR program on the 118 bus case with
changes to the FTRbids worksheet that show a higher price for the transaction that was cut until it makes
a difference. What happened?
5) Run the 5busPJM case and compare results to the paper by Ma, Sun and Ott given in the footnote shown
previously.

38

You might also like