Download as pdf or txt
Download as pdf or txt
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.

2
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 Fuel
Number Pg Pmax Pmin a_coeff b_coeff c_coeff Cost
1 110 500 150 2000 25 0.05 1
2 50 700 200 1250 15 0.04 1
3 50 750 220 1700 10 0.03 1

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


numgen =

Pload =

900

unit 1 Pmin = 150 dfdp = 40.00 Pmax = 500 dfdp = 75.00


unit 2 Pmin = 200 dfdp = 31.00 Pmax = 700 dfdp = 71.00
unit 3 Pmin = 220 dfdp = 23.20 Pmax = 750 dfdp = 55.00

Largest_dfdp =

75

Smallest_dfdp =

23.2000

Lambda = 49.10 P1 P2 P3 = 241.00 426.25 651.67 Total Gen = 1318.92


Lambda = 23.20 P1 P2 P3 = 150.00 200.00 220.00 Total Gen = 570.00
Lambda = 36.15 P1 P2 P3 = 150.00 264.37 435.83 Total Gen = 850.21
Lambda = 42.62 P1 P2 P3 = 176.25 345.31 543.75 Total Gen = 1065.31
Lambda = 39.39 P1 P2 P3 = 150.00 304.84 489.79 Total Gen = 944.64
Lambda = 37.77 P1 P2 P3 = 150.00 284.61 462.81 Total Gen = 897.42
Lambda = 38.58 P1 P2 P3 = 150.00 294.73 476.30 Total Gen = 921.03
Lambda = 38.17 P1 P2 P3 = 150.00 289.67 469.56 Total Gen = 909.23
Lambda = 37.97 P1 P2 P3 = 150.00 287.14 466.18 Total Gen = 903.32
Lambda = 37.87 P1 P2 P3 = 150.00 285.87 464.50 Total Gen = 900.37
Lambda = 37.82 P1 P2 P3 = 150.00 285.24 463.66 Total Gen = 898.90
Lambda = 37.84 P1 P2 P3 = 150.00 285.56 464.08 Total Gen = 899.64
Lambda = 37.86 P1 P2 P3 = 150.00 285.72 464.29 Total Gen = 900.00

Gencost =

1.0e+04 *

0.6875 0.8801 1.2810

Total_gen_cost =

2.8486e+04

3
And the following graphic appears on the screen:

Generator Incremental (Marginal) Cost Functions


100

90

80

70

60

50

40

30

20
Gen 1 solid line
10 Gen 2 dashed line
Gen 3 dotted line
0
0 200 400 600 800 1000
MW Generator Output

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 generator’s 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.

4
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 Pg Pmax Pmin a_coeff b_coeff c_coeff Fuel Cost artup Cost Ramp Upamp Downdown TimeMinup Time
1 100 800 100 5 4 0.001 1 0 15 15 1 1
2 100 800 100 5 6 0.002 1 0 15 15 1 1
3 80 400 80 20 8 0.0025 1 0 15 15 1 1
4 80 400 80 20 10 0.0025 1 0 15 15 1 1
5 60 300 60 30 10 0.002 1 0 15 15 1 1
6 60 300 60 30 12 0.002 1 0 15 15 1 1
7 50 200 50 40 14 0.0015 1 0 15 15 1 1
8 50 200 50 40 16 0.0015 1 0 15 15 1 1
9 25 100 25 55 15 0.0012 1 0 15 15 1 1
10 25 100 25 55 17 0.0012 1 0 15 15 1 1
11 25 100 25 55 17 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 168 Number of hours for unit commitment
maxpload 3000 Max peak load over the time period
alpha1 0.01 alpha adjust constant 1
alpha2 0.002 alpha adjust constant 2
MaxIter 30 Maximum iterstions
gap_error 0.01 Value of duality gap to converge
datadump 1 set this multiplier to 1 for data output or 0 for no output
plotload 1 set plotload to 1 for a plot of the loads for each hour
1.00E-
edc_tolerance 09 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.

Load
Hour Index
0 3.5
1 3.4
2 3.3
3 3.25
4 3.3
5 3.4
6 3.5
7 3.7
8 3.9
9 4.3
10 4.7
11 5.3
12 5.6
13 5.7
14 5.65
15 5.5
16 5.5
17 5.3
18 5.2
6
19 5.1
20 5
21 4.4
22 4.2
23 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
0 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

7
The solution for the first 24 hours, large genset loaddata appears like this:
The Unit commitment Schedule
Hour Load Total Gen Gen Gen Gen Gen Gen Gen Gen Gen Gen Gen Sum
MW Gen 1 2 3 4 5 6 7 8 9 10 11 Cost
1 1151 1151 800.0 351.3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6205
2 1118 1118 800.0 318.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5963
3 1086 1086 800.0 285.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5726
4 1069 1069 800.0 269.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5609
5 1086 1086 800.0 285.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5726
6 1118 1118 800.0 318.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5963
7 1151 1151 800.0 351.3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6205
8 1217 1217 800.0 417.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6701
9 1283 1283 800.0 482.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 7214
10 1414 1414 800.0 534.5 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 8304
11 1546 1546 800.0 636.7 109.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 9406
12 1743 1743 800.0 746.3 197.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 11136
13 1842 1842 800.0 800.0 242.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12033
14 1875 1875 800.0 800.0 275.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12339
15 1859 1859 800.0 800.0 258.6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12186
16 1809 1809 800.0 782.9 226.3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 11732
17 1854 1854 800.0 800.0 254.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12147
18 1831 1831 800.0 794.8 235.8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 11928
19 1839 1839 800.0 799.3 239.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12003
20 1845 1845 800.0 800.0 245.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12064
21 1850 1850 800.0 800.0 250.3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12109
22 1664 1664 800.0 702.5 162.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 10433
23 1623 1623 800.0 679.6 143.7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 10073
24 1461 1461 800.0 580.5 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 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.

8
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 1200 Pload week 1
Pload2 1500 Pload week 2
Pload3 800 Pload week 3
V1_initial_volume 70000 Initial volume in coal pile 1
V2_initial_volume 70000 Initial volume in coal pile 2
Total_Delivery1 40000 Total coal delivered week 1 (must be <= 40000.)
Total_Delivery2 40000 Total coal delivered week 2 (must be <= 40000.)
Total_Delivery3 40000 Total coal delivered week 3 (must be <= 40000.)

Any of these parameters may be changed by the student.

9
The data files to be used are:

1) Fuel_scheduling_example5C_fuelscheddata (this has the same data as the textbook example 5C)
2) Fuel_scheduling_example5C_set1_fuelscheddata
3) Fuel_scheduling_example5C_set2_fuelscheddata
4) 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 2 Number of hours per period
diagnostic_trace 0 set = 1 program will show all variables each step, = 0 no such output
tables_dump 0 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
Hour MW
1 600
2 1000
3 900
4 500
5 400
6 300

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) Set the volume step to 1000


2) Set the volume step to 500
3) Set the volume step to 200
4) 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 = 312.956 Total Qgen = 30.014


Total PLoad= 300.000 Total Qload= 45.000
Total MW Losses = 12.956

Bus Vmag angle Pgen Qgen Pload Qload To Bus Pline Qline
1 1.070 0.00 212.956 -10.759 0.000 0.000
2 62.181 -18.280
4 82.797 5.868
5 67.978 1.652
2 1.050 -7.18 50.000 21.757 0.000 0.000
1 -58.580 20.986
3 14.764 -5.995
4 28.859 8.661
5 21.944 0.849
6 43.013 -2.744
3 1.050 -9.16 50.000 19.016 0.000 0.000
2 -14.662 -0.110
5 12.434 2.879
6 52.228 16.246
4 1.027 -0.15 100.000 15.000
1 -79.774 1.823
2 -28.438 -9.977
5 8.212 -6.847
5 1.022 -0.18 100.000 15.000
1 -64.731 3.955
2 -21.499 -3.808
3 -12.231 -7.808
4 -8.071 -1.271
6 6.532 -6.068
6 1.025 -0.21 100.000 15.000
2 -41.839 0.720
3 -51.679 -15.651
5 -6.483 -0.068

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 1.0903 1.1137 1.1056 1.1322 1.1426
dPlossdP =
0 -0.0903 -0.1137 -0.1056 -0.1322 -0.1426
Penfac =
1.0000 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 0.5000
Ptarget =
312.9556
Lambda = 11.9450 P1 P2 P3 = 50.00 150.00 166.71 Total Gen = 366.71
Lambda = 10.0891 P1 P2 P3 = 50.00 37.50 45.00 Total Gen = 132.50
Lambda = 11.0171 P1 P2 P3 = 50.00 94.40 96.97 Total Gen = 241.37
Lambda = 11.4811 P1 P2 P3 = 50.00 122.85 131.84 Total Gen = 304.69
Lambda = 11.7131 P1 P2 P3 = 50.00 137.08 149.27 Total Gen = 336.35
Lambda = 11.5971 P1 P2 P3 = 50.00 129.97 140.55 Total Gen = 320.52
Lambda = 11.5391 P1 P2 P3 = 50.00 126.41 136.20 Total Gen = 312.61
Lambda = 11.5681 P1 P2 P3 = 50.00 128.19 138.37 Total Gen = 316.56
Lambda = 11.5536 P1 P2 P3 = 50.00 127.30 137.28 Total Gen = 314.59
Lambda = 11.5463 P1 P2 P3 = 50.00 126.86 136.74 Total Gen = 313.60
Lambda = 11.5427 P1 P2 P3 = 50.00 126.63 136.47 Total Gen = 313.10
Lambda = 11.5409 P1 P2 P3 = 50.00 126.52 136.33 Total Gen = 312.85
Lambda = 11.5418 P1 P2 P3 = 50.00 126.58 136.40 Total Gen = 312.98
Lambda = 11.5413 P1 P2 P3 = 50.00 126.55 136.37 Total Gen = 312.92
Lambda = 11.5415 P1 P2 P3 = 50.00 126.56 136.38 Total Gen = 312.95
Lambda = 11.5417 P1 P2 P3 = 50.00 126.56 136.38 Total Gen = 312.95
Total_gen_cost =
4.3153e+03

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 = 312.96 MW Total Qgen = 30.01 MVAR
Total PLoad = 300.00 MW Total Qload = 45.00 MVAR
Total PLosses = 12.96 MW Total QLosses = -14.99 MVAR

Bus Pmin Pgen Pmax Qmin Qgen Qmax Pload Qload Vmin Vbus Vbus Vmax
MW MW MW MVAR MVAR MVAR MW MVAR pu pu kV pu
1 50.0 213.0 450.0 -100.0 -10.8 150.0 0.0 0.0 0.95 1.07 UL 246.1 1.07
2 37.5 50.0 150.0 -100.0 21.8 150.0 0.0 0.0 0.95 1.05 241.5 1.07
3 45.0 50.0 180.0 -100.0 19.0 120.0 0.0 0.0 0.95 1.05 241.5 1.07
4 100.0 15.0 0.95 1.03 236.3 1.07
5 100.0 15.0 0.95 1.02 235.1 1.07
6 100.0 15.0 0.95 1.02 235.7 1.07

Bus Vmag angle Pgen Qgen Pload Qload To Bus Pline Qline Max
kV deg MW MVAR MW MW MW MVAR Flow MW
1 246.1 0.00 212.96 -10.76 0.00 0.00
2 62.18 -18.28 100
4 82.80 5.87 100
5 67.98 1.65 100
2 241.5 -7.18 50.00 21.76 0.00 0.00
1 -58.58 20.99 100
3 14.76 -5.99 60
4 28.86 8.66 60
5 21.94 0.85 60
6 43.01 -2.74 60
3 241.5 -9.16 50.00 19.02 0.00 0.00
2 -14.66 -0.11 60
5 12.43 2.88 60
6 52.23 16.25 60

. . .

Then the LODF matrix is printed:

LINE OUTAGE DISTRIBUTION FACTOR (LODF) MATRIX


Monitored Outage of one circuit
Line From - To

1 to 2 1 to 4 1 to 5 2 to 3 2 to 4 2 to 5 2 to 6 3 to 5 …

1 to 2 0.0000 0.6353 0.5427 -0.1127 -0.5031 -0.2103 -0.1221 -0.1369


1 to 4 0.5948 0.0000 0.4573 -0.0331 0.6121 -0.0618 -0.0359 -0.0403
1 to 5 0.4052 0.3647 0.0000 0.1458 -0.1090 0.2721 0.1580 0.1772
2 to 3 -0.1029 -0.0323 0.1783 0.0000 0.1242 0.2262 0.4662 -0.3995
2 to 4 -0.5884 0.7647 -0.1708 0.1591 0.0000 0.2969 0.1724 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 Percent Loading

5 1 2 -100.0 60.65 100.0 60.6


5 1 4 -100.0 76.66 100.0 76.7
5 1 5 -100.0 62.69 100.0 62.7
5 2 3 -60.0 13.68 60.0 22.8
5 2 4 -60.0 32.03 60.0 53.4
5 2 5 -60.0 22.26 60.0 37.1
5 2 6 -60.0 42.67 60.0 71.1
5 3 5 -60.0 12.54 60.0 20.9
5 3 6 -60.0 51.14 60.0 85.2
5 4 5 -60.0 8.69 60.0 14.5
5 5 6 -60.0 6.18 60.0 10.3

CONTINGENCY OVERLOAD contflow contlimit rating overload%


drop 1 to 2 mon 1 to 4 112.73 100.0 100.0 112.7
CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 1 to 4 mon 1 to 2 109.35 100.0 100.0 109.4
CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 1 to 4 mon 2 to 4 90.65 60.0 60.0 151.1
CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 1 to 5 mon 1 to 4 105.33 100.0 100.0 105.3
CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 2 to 6 mon 3 to 6 78.38 60.0 60.0 130.6
CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 3 to 6 mon 2 to 6 72.55 60.0 60.0 120.9

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


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

The AC powerflow runs an AC power flow (Newton’s 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 = 0

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 To Bus PI voltage %Violation PI flows %Violation
Contingency 1 from 1 to 2 7.048 0.000 11.769 20.742
Contingency 2 from 1 to 4 7.036 0.000 146.114 55.156
Contingency 3 from 1 to 5 7.030 0.000 13.229 19.688
Contingency 4 from 2 to 3 7.047 0.000 0.705 0.000
Contingency 5 from 2 to 4 7.034 0.000 2.437 1.067
Contingency 6 from 2 to 5 7.032 0.000 0.978 0.000
Contingency 7 from 2 to 6 7.031 0.000 33.905 33.599
Contingency 8 from 3 to 5 7.034 0.000 2.113 0.000
Contingency 9 from 3 to 6 7.101 0.000 17.616 26.919

16
Contingency 10 from 4 to 5 7.040 0.000 0.792 0.000
Contingency 11 from 5 to 6 7.043 0.000 1.375 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 = 1
Drop line 1 4 Overload on 2 4 Flow = 95.49 Limit = 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 limit= 60.0

LIST OF ACTIVE CONTINGENCY CONSTRAINTS


CONTINGENCY OVERLOAD contflow contlimit rating overload%
drop 1 to 4 overload on 2 to 4 90.0 90.0 60.0 100.0

Loads pay a total of : 7403.45


Generators receive a total of : 3848.29
Transmission congestion charges: 3555.16

TOTAL VARIABLE GENERATION COST = 4267.2

TOTAL GENERATION BID = 530.0


TOTAL GENERATION SUPPLIED = 300.0
TOTAL VARIABLE LOAD = 0.0
TOTAL FIXED LOAD = 300.0
TOTAL LOAD = 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 Bid Bcoeff Ccoeff Min Max Generator Generator


Number bus Constant Constant MW MW MW Incremental Cost Cost
1 1 11.67 0.00533 50.0 200.0 181.9 13.61 2512.42
2 2 10.33 0.00889 37.5 150.0 44.2 11.12 674.36
3 3 10.83 0.00741 45.0 180.0 73.8 11.93 1080.40

NO LOAD SHED

GENERATION and LOAD by Bus

Bus Generation Load Bus


Number at bus at bus Lambda
1 181.93 0.00 13.608
2 44.23 0.00 11.119
3 73.85 0.00 11.927
4 0.00 100.00 41.008
5 0.00 100.00 17.323
6 0.00 100.00 15.703

RESULTING TRANSMISSION LOADING:-

Path From To Low Flow High Percent Loading line Lambda

1 1 2 -100.0 53.8 100.0 53.8 -0.00


2 1 4 -100.0 71.4 100.0 71.4 -0.00
3 1 5 -100.0 56.7 100.0 56.7 -0.00
4 2 3 -60.0 5.2 60.0 8.7 -0.00
5 2 4 -60.0 35.4 60.0 58.9 0.00
6 2 5 -60.0 20.9 60.0 34.8 0.00
7 2 6 -60.0 36.5 60.0 60.9 -0.00
8 3 5 -60.0 19.1 60.0 31.8 0.00
9 3 6 -60.0 60.0 60.0 100.0 5.53
10 4 5 -60.0 6.8 60.0 11.4 -0.00
11 5 6 -60.0 3.5 60.0 5.8 -0.00

CONTINGENCY OUTAGES RESULTING IN FLOWS CLOSE TO LIMIT


contingency
CONTINGENCY contflow contlimit rating overload% lambda
drop 1 to 4 overload on 2 to 4 90.0 90.0 60.0 100.0 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 = 312.956 Total Qgen = 30.014


Total PLoad= 300.000 Total Qload= 45.000
Total MW Losses = 12.956 Total MVAR Losses = -14.986

Bus Pmin Pgen Pmax Qmin Qgen Qmax Pload Qload Vmin Vbus Vmax kv LambdaP LambdaQ
1 50.0 213.0 200.0 -100.0 -10.8 150.0 0.0 0.0 0.95 1.07UL 1.07 123.1 0.0000 0.0000
2 37.5 50.0 150.0 -100.0 21.8 150.0 0.0 0.0 0.95 1.05 1.07 120.8 0.0000 0.0000
3 45.0 50.0 180.0 -100.0 19.0 120.0 0.0 0.0 0.95 1.05 1.07 120.8 0.0000 0.0000
4 100.0 15.0 0.95 1.03 1.07 118.1 0.0000 0.0000
5 100.0 15.0 0.95 1.02 1.07 117.5 0.0000 0.0000
6 100.0 15.0 0.95 1.02 1.07 117.8 0.0000 0.0000

Bus Vmag angle Pgen Qgen Pload Qload To Bus Pline Qline
1 1.070 0.00 212.956 -10.759 0.000 0.000
2 62.181 -18.280
4 82.797 5.868
5 67.978 1.652
2 1.050 -7.18 50.000 21.757 0.000 0.000
1 -58.580 20.986
3 14.764 -5.995
4 28.859 8.661
5 21.944 0.849
6 43.013 -2.744
3 1.050 -9.16 50.000 19.016 0.000 0.000
2 -14.662 -0.110
5 12.434 2.879
6 52.228 16.246
4 1.027 -8.45 100.000 15.000
1 -79.774 1.823
2 -28.438 -9.977
5 8.212 -6.847
5 1.022 -10.53 100.000 15.000
1 -64.731 3.955
2 -21.499 -3.808
3 -12.231 -7.808
4 -8.071 -1.271
6 6.532 -6.068
6 1.025 -11.76 100.000 15.000
2 -41.839 0.720
3 -51.679 -15.651
5 -6.483 -0.068
limits_indicator
Bus Pgen Qgen Vgen
1 212.96 -10.76 1.0700 UL
2 50.00 21.76 1.0500
3 50.00 19.02 1.0500
Iteration: 1 Objective: 4478.8448 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 = 307.457 Total Qgen = 10.685
Total PLoad= 300.000 Total Qload= 45.000
Total MW Losses = 7.457 Total MVAR Losses = -34.315

Bus Pmin Pgen Pmax Qmin Qgen Qmax Pload Qload Vmin Vbus Vmax kv LambdaP LambdaQ
1 50.0 105.9 200.0 -100.0 -5.1 150.0 0.0 0.0 0.95 1.07UL 1.07 123.1 12.7983 -0.0000
2 37.5 129.3 150.0 -100.0 6.6 150.0 0.0 0.0 0.95 1.07UL 1.07 123.0 12.6311 0.0000
3 45.0 72.3 180.0 -100.0 9.2 120.0 0.0 0.0 0.95 1.07UL 1.07 122.5 11.9040 0.0162
4 100.0 15.0 0.95 1.04 1.07 119.4 13.9546 0.1263
5 100.0 15.0 0.95 1.04 1.07 119.1 13.5625 0.0595
6 100.0 15.0 0.95 1.04 1.07 119.8 14.3065 0.0088

Bus Vmag angle Pgen Qgen Pload Qload To Bus Pline Qline
1 1.070 0.00 105.906 -5.082 0.000 0.000
2 15.297 -9.624
4 48.673 4.619
5 41.937 -0.076
2 1.070 -1.90 129.288 6.603 0.000 0.000
1 -15.046 5.547
3 11.284 -3.432
4 60.000 4.506
5 29.987 1.098
6 43.063 -1.116
3 1.065 -3.32 72.262 9.163 0.000 0.000
2 -11.229 -3.128
5 23.497 -1.029
6 59.995 13.319
4 1.038 -4.85 100.000 15.000
1 -47.617 -4.842
2 -58.413 -3.556
5 6.031 -6.602
5 1.036 -6.38 100.000 15.000
1 -40.700 -1.939
2 -29.191 -3.147
3 -22.909 -3.215
4 -5.953 -1.844
6 -1.246 -4.856
6 1.042 -6.27 100.000 15.000
2 -41.927 -1.214
3 -59.323 -12.181
5 1.250 -1.605
limits_indicator
Bus Pgen Qgen Vgen
1 105.91 -5.08 1.0700 UL
2 129.29 6.60 1.0700 UL
3 72.26 9.16 1.0650 UL
Line Overloads Detected
From Bus To bus Pflow PflowMax Pflow Lambda
2 4 60.00 60 1.0397
3 6 59.99 60 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

4450

4400

4350

4300

4250
0 5 10 15
Iteration

0 Control Variable Error


10

-1
10

-2
10

-3
10

-4
10
0 2 4 6 8 10 12 14
Iteration

3 Objective Function Value Error


10

2
10

1
10

0
10

-1
10

-2
10
0 2 4 6 8 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 PowerFlowOutput.mat


program (binary file)

run_estimator

Display State
Network data
Powerflow
Spreadsheet files
Output
Estimator

run_scada

SCADA StateEstimatorData.mat Display


estimator
(binary file)
results

Display
Measurement
Measurement data Data
spreadsheet files

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 = 328.581 Total Qgen = 67.737


Total PLoad= 300.000 Total Qload= 45.000
Total MW Losses = 43.020

Bus Vmag angle Pgen Qgen Pload Qload To Bus Pline Qline
1 1.070 0.000 228.581 -32.176 0.000 0.000
2 123.575 -35.594
4 179.938 23.881
5 105.006 3.418
2 1.050 -14.455 50.000 75.714 0.000 0.000
1 -109.268 59.712
3 11.351 -5.420
4 93.093 17.198
5 15.599 5.296
6 39.225 -1.072

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
measurement’s 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 Base Case Value Measured Value
Name Status kV MW MVAR kV MW MVAR
Bus 1
MV1 1 246.1 246.1
MA1 1 0.0 0.0
MG1 1 228.6 -32.2 228.6 -32.2
M12 1 123.6 -35.6 123.6 -35.6
M14 1 179.9 23.9 179.9 23.9
M15 1 105.0 3.4 105.0 3.4

28
Bus 2
MV2 1 241.5 253.0
MA2 1 -14.5 -14.5
MG2 1 50.0 75.7 50.0 75.7
M21 1 -109.3 59.7 -109.3 59.7
M23 1 11.4 -5.4 11.4 -5.4
M24 1 93.1 17.2 93.1 17.2
M25 1 15.6 5.3 15.6 5.3
M26 1 39.2 -1.1 39.2 -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 Number Active Degrees of Bad Data Threshold Largest Bad
J Measurements Freedom Tj Normalized Measurement
Residual at
1 485939.820
2 1491.078
3 1288.259
4 1282.595
5 1278.994
6 1276.619
67 56 69.063
Bad Data Detected 35.737 MV2
1 613.153
2 2.029
66 55 67.940
Final State Estimator Result

Measurement Base Case Value Measured Value Estimated Value


Name Status kV MW MVAR kV MW MVAR kV MW MVAR
Bus 1
MV1 1 246.1 246.1 246.1
MA1 1 0.0 0.0 0.0
MG1 1 228.6 -32.2 228.6 -32.2 226.4 -32.0
M12 1 123.6 -35.6 123.6 -35.6 122.3 -35.5
M14 1 179.9 23.9 179.9 23.9 178.6 23.8
M15 1 105.0 3.4 105.0 3.4 104.1 3.4
Bus 2
MV2 0 241.5 253.0 241.6
MA2 1 -14.5 -14.5 -14.5
MG2 1 50.0 75.7 50.0 75.7 50.9 76.1
M21 1 -109.3 59.7 -109.3 59.7 -108.3 59.0
M23 1 11.4 -5.4 11.4 -5.4 11.2 -5.2
M24 1 93.1 17.2 93.1 17.2 93.1 17.6
M25 1 15.6 5.3 15.6 5.3 15.6 5.5
M26 1 39.2 -1.1 39.2 -1.1 39.2 -0.8

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 From To MW
Number bus bus
1 6 4 20.0
2 5 4 20.0

number_of_islands = 1

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 bid C bidmin bidmax bidbus
0 12 0 0 450 1
0 10 0 0 150 2
0 11 0 0 180 3
0 -200 0 0 40 4
0 -200 0 0 40 5
0 -200 0 0 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 load’s 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 contflow contlimit rating overload
drop 1 to 4 ckt= 2 mon 2 to 4 ckt= 5 66.0 66.0 60.0 100.0
drop 2 to 3 ckt= 4 mon 3 to 6 ckt= 9 66.0 66.0 60.0 100.0
drop 3 to 5 ckt= 8 mon 3 to 6 ckt= 9 65.1 66.0 60.0 98.6

TRANSACTIONS CHARGES :-

Transaction From To MW Transaction Charge


Number bus bus
1 6 4 20.0 $ 3706.16
2 5 4 20.0 $ 3248.50

Loads pay a total of : $ 11275.67


Transactions pay a total of : $ 6954.66
Generators receive a total of : $ 1615.62
Transmission congestion revenues: $ 16614.62

TOTAL VARIABLE GENERATION COST = $ 1615.62

TOTAL GENERATION BID = 780.0


TOTAL GENERATION SUPPLIED = 143.3
TOTAL LOAD BID = 150.0
TOTAL LOAD SUPPLIED = 143.3

bus bus bus bus Bus Net Flow


Number Lambda Generation Load Transactions MW
1 12.00 39.2 0.0 0.0 39.2
2 -5.12 0.0 0.0 0.0 0.0
3 11.00 104.1 0.0 0.0 104.1

32
4 200.00 0.0 43.3 -40.0 -83.3
5 37.57 0.0 50.0 20.0 -30.0
6 14.69 0.0 50.0 20.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 Bid BidB BidC Max MW Generator Generator


Number bus Constant Inc Cost MW Sold/Purchased Lambda Cost
1 1 12.00 0.0000 450.0 39.2 12.00 470.27
2 2 10.00 0.0000 150.0 0.0 0.00 0.00
3 3 11.00 0.0000 180.0 104.1 11.00 1145.34
4 4 -200.00 0.0000 50.0 43.3
5 5 -200.00 0.0000 50.0 50.0
6 6 -200.00 0.0000 50.0 50.0

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 = 6.7

RESULTING TRANSMISSION LOADING :-


From To ckt Low Flow High Percent Loading circuit Lambda
1 2 1 -100.0 6.2 100.0 6.2 0.00
1 4 2 -100.0 28.3 100.0 28.3 0.00
1 5 3 -100.0 4.7 100.0 4.7 0.00
2 3 4 -60.0 -28.0 60.0 46.7 -0.00
2 4 5 -60.0 44.3 60.0 73.9 0.00
2 5 6 -60.0 0.6 60.0 1.0 0.00
2 6 7 -60.0 -10.8 60.0 17.9 -0.00
3 5 8 -60.0 27.6 60.0 46.0 0.00
3 6 9 -60.0 48.5 60.0 80.8 0.00
4 5 10 -60.0 -10.6 60.0 17.7 -0.00
5 6 11 -60.0 -7.8 60.0 12.9 -0.00

RESULTING CONTINGENCY ANALYSIS


CONTINGENCY OVERLOAD contflow contlimit rating overload contingency
lambda
drop 1 to 4 ckt= 2 mon 2 to 4 ckt= 5 66.0 66.0 60.0 100.0 245.77
drop 2 to 3 ckt= 4 mon 3 to 6 ckt= 9 66.0 66.0 60.0 100.0 5.97
drop 3 to 5 ckt= 8 mon 3 to 6 ckt= 9 65.1 66.0 60.0 98.6 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 bid C bidmin bidmax bidbus


0 12 0 0 450 1
0 10 0 0 150 2
0 11 0 0 180 3
0 -300 0 0 50 4
0 -200 0 0 50 5
0 -200 0 0 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 bid C bidmin bidmax bidbus


0 12 0 0 450 1
0 10 0 0 150 2
0 11 0 0 180 3
0 -200 0 0 40 4
0 -200 0 0 40 5
0 -200 0 0 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 FTR’s 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, IOS’s 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 =

********************************************************
******************** 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 contflow contlimit rating overload
drop 1 to 4 ckt= 2 mon 2 to 4 ckt= 5 72.0 72.0 60.0 100.0
drop 3 to 5 ckt= 8 mon 3 to 6 ckt= 9 72.0 72.0 60.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 Summary
bus bus bus bus
Number Lambda Generation Load
1 -72.42 0.0 0.0
2 -74.22 31.5 0.0
3 -74.22 3.8 0.0
4 -54.22 0.0 35.3
5 -69.68 0.0 0.0
6 -71.35 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

Resulting FTR Summary


From To FTR FTR Bus Lambda FTR MW
Bus Bus Max Price Difference Cleared
3 4 100.0 20.00 20.00 3.8
2 4 100.0 20.00 20.00 31.5

Here the FTR’s 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 High Percent Loading circuit Lambda
1 2 1 -100.0 6.7 100.0 6.7 0.00
1 4 2 -100.0 30.9 100.0 30.9 0.00
1 5 3 -100.0 12.5 100.0 12.5 0.00
2 3 4 -60.0 -20.3 60.0 33.8 -0.00
2 4 5 -60.0 48.4 60.0 80.7 0.00
2 5 6 -60.0 8.1 60.0 13.4 0.00
2 6 7 -60.0 2.0 60.0 3.3 0.00
3 5 8 -60.0 28.8 60.0 48.0 0.00
3 6 9 -60.0 54.7 60.0 91.2 0.00
4 5 10 -60.0 -6.1 60.0 10.1 -0.00
5 6 11 -60.0 -6.7 60.0 11.2 -0.00

RESULTING CONTINGENCY ANALYSIS


CONTINGENCY OVERLOAD contflow contlimit rating overload contingency
lambda
drop 1 to 4 ckt= 2 mon 2 to 4 ckt= 5 72.0 72.0 60.0 100.0 23.85
drop 3 to 5 ckt= 8 mon 3 to 6 ckt= 9 72.0 72.0 60.0 100.0 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