UTILIZING MATPOWER IN OPTIMAL POWER FLOW Tarje Krstansen Department of Electrcal Power Engneerng Norwegan Unversty of Scence and Technology Trondhem, Norway Tarje.Krstansen@elkraft.ntnu.no Abstract Ths paper shows how MATPOWER, a MATLAB Power System Smulaton Package can be used for optmal power flow (OPF) smulatons. MATPOWER s a package of MATLAB fles for solvng power flow and optmal power flow problems. It s a smulaton tool for researchers and educators whch s easy to use and modfy. An OPF smulaton gves the actve/reactve power generated and purchased at each bus and the nodal prces. The nodal prces are of specal nterest because they reflect the margnal generaton and load at each bus (node). These prces are also called locatonal prces and are found to be the optmal prces, maxmzng socal welfare and takng transmsson constrants nto account. They can provde the rght ncentves to market players and to socety. When transmsson congeston s present ths creates market neffcency, snce cheap dstant generaton may be replaced wth more expensve local generaton. We are especally nterested n OPF as utlzed by a centralzed dspatcher, and we also descrbe the features relevant for the Norwegan and Nordc markets. We optmze three cases and analyze the economc consequences of dfferent network topologes and transmsson congeston. Keywords: MATPOWER, optmal power flow, nodal prces, power system economcs 1 INTRODUCTION Deregulaton has requred a stronger focus on the economcal aspects of the Nordc power market and a need for economc analyss of power transmsson servces. The optmal prces n a transmsson network are the nodal prces resultng from an optmal power flow (OPF) performed by a centralzed dspatcher (e.g. an ndependent system operator - ISO). The OPF model s mplemented n parts of the Unted States (e.g. PJM), and n Australa and New Zealand. In the Nordc regon area (zonal) prcng s used. Ths s a smplfcaton and aggregaton of nodal prcng. The Nordc power system does not nclude a central schedulng/dspatchng entty, only a central power exchange (Nord Pool). Generators and loads schedule by self-dspatch. There s one power exchange and 5 transmsson system operators (TSOs) n the Nordc regon. When congeston s predcted n Norway, two or more spot areas are defned. Ths procedure s called market splttng. In these cases the players must specfy ther bds n the dfferent spot prce areas. Clearng at Nord Pool determnes that the prces n the dfferent areas are such that the power flows do not exceed the specfed constrants. A surplus area wll then receve a lower prce than a defct area. The dfference between the respectve Area Prces and the System Prce s called the Congeston Fee. 1 Statnett (the Norwegan system operator) defnes the fxed prce 2 areas n Norway accordng to ts nformaton on the lkely pattern of flows on the system for a certan perod of tme. Congeston nsde the prce areas s managed by use of counter trade. 3 We emphasze OPF n the context of nodal prcng and descrbe how t can be used for area prcng. Ths paper shows that even a smple system can gve nterestng results, when an economc analyss s conducted on the system. 2 OPTIMAL POWER FLOW AND NODAL PRICES OPF s a technque that has been used n the electrcty ndustry for several decades. The objectve n OPF s to mnmze generator operatng costs. 2.1 Formulaton of OPF The objectve functon s the total cost of real and/or actve generaton. The costs may be defned as polynomals or as pecewse-lnear functons of generator output. The problem can be formulated schematcally as: Mn (costs of actve and reactve generaton) subject to actve power balance equatons reactve power balance equatons apparent power flow lmt of lne, from and to sde bus voltage lmts actve and reactve power generaton lmts 1 Statnett uses the term Capacty Fee (Norwegan: kapastetsavgft). 2 The number of prce areas n Norway can be two or three. 3 Counter trade s real tme congeston management by ncreased producton (upward regulaton) wthn the constraned area and decreased producton (downward regulaton) n the surplus area.
To guarantee that the OPF can be solved, one of the zones s assgned a zero phase angle by settng ts phase angle upper and lower lmts to zero (the swng bus). The post-contngency nterface flow lmts are ncluded n the OPF. If all n-1 contngences were consdered, there would be a constrant for each lne contngency for each nterface. Ths would make the problem sze too large for effcent computaton. To lmt the number of constrants, the OPF s solved wthout contngency constrants, a contngency analyss s performed, and then the OPF s resolved wth new constrants added only for those contngency outages that result n overloads, and only for the nterfaces that are overloaded. Generator cost functons are represented as quadratc functons: C 2 ( P ) a + b P + c P G = (1) G where P G s the produced power and a, b and c are constants. The quadratc cost functons make ths OPF formulaton a problem that can be solved wth a quadratc programmng (QP) algorthm. The QP algorthm used can accept upper and lower bound lmts on each varable. The DC OPF power flow model assumes that only the angles of the complex bus voltages vary, and that the varaton s small. Voltage magntudes are assumed to be constant. Transmsson lnes are assumed to have no resstance, and therefore no losses. Ths s a reasonable frst approxmaton for the real power system, whch can be consdered only slghtly non-lnear n normal steady state operaton. In MATPOWER, a DC power flow s modeled by settng the resstance to zero for the transmsson lnes. An alternatng current (AC) power flow s modeled by usng values for both resstance and reactance. In electrcty markets the loads are usually relatvely nelastc, meanng that they do not change as much as the prce changes. When ths s the case, the OPF objectve s to mnmze total generaton cost subject to all relevant constrants. In MATPOWER t s possble to specfy the nelastc power demand at a bus. The current verson of MATPOWER cannot take elastc demand nto account, but n prncple ths should be possble to do n the future. To model ths, the coeffcents n the cost functon should be negatve, because the load pays for the energy. A typcal elastc demand s decreasng wth ncreasng prce (e.g. p = a b PG s a typcal demand functon, p s prce). There should also be an addtonal constrant keepng the power factor 4 constant. In ths paper a full AC OPF s used. For a detaled mathematcal formulaton of the OPF the reader s referred to [1] and [4]. 4 The cosne of the phase angle between the voltage and current. G 2.2 The Interpretaton of the Lagrange Multplers Any optmzaton problem wll have a Lagrange multpler λ assocated wth each equalty constrant n the problem. The Lagrange multpler s the margnal value of the respectve constrants; the nstantaneous prce of the next small ncrement of load. If no nterfaces that are congested, then the zone prce for all zones wll be equal n the DC case (no losses) and almost equal n the AC case. The small dfference s due to the effects of transmsson losses. In the decongested case an ncrease n a zone load may be met by an ncrease n output by a generator n that zone, or by an ncrease n generaton n another zone or zones. The generators wth the lowest cost and whch are not at ther maxmum output are dspatched frst. When congeston occurs, zone prces across the system are dfferent. Then the hgher cost generators wthn the same zone have to run, because a contngency or transmsson lne makes the lowest cost generators n others zones unable to supply load. 2.3 OPF Used n a Deregulated Power System Generators send a cost functon and loads send a bd functon to the ISO. The ISO has a complete transmsson system model and can then do an OPF calculaton. The zone prces determned by the OPF are used n the followng way: Generators are pad the zone prce for energy Loads must pay the zone prce for energy If there s no congeston and the ISO has run a DC OPF, there s one zone prce throughout the whole system. Both generators and loads pay the same prce for ther energy. When there s congeston, zone prces dffer, and each generator and load pays ts zone s prce for energy. If there are no losses n the transmsson system then some nterestng relatons can be shown to be true: all zones λ P = λ P (3) L all zones where λ s the prce n zone. Ths mples that the ISO has to pay all the money t collects from the loads to the generators. However, when there s congeston: all zones G λ P λ P (4) L all zones In fact, there wll always be a surplus. The money pad by the loads s greater than the money pad to the generators: G
all zones λ P > λ P (5) L all zones The OPF performs the functon of controllng the transmsson flows and thereby system securty. Congeston wll gve rse to dfferent zone (nodal) prces and the ISO collects a surplus. In the AC case there wll be some small modfcatons of the above results (e.g. the left and rght terms n (3) wll be almost equal). 3 THE THREE TEST CASES We use an eleven-zone power system from [4] to llustrate the aspects of nodal prcng and congeston, shown n Fgure 1. Each zone conssts of a sngle bus. The zones are connected by nterfaces. Each nterface conssts of multple dentcal transmsson lnes. Indvdual lnes can be out of servce, one at a tme, and ths event s called a contngency. When a contngency occurs, the power flow ncreases n the remanng lnes n the nterface and on lnes n other nterfaces. Flow lmts mmedately after a contngency are usually hgher than n normal operaton. Operators are expected to be able to reduce flows to normal lmts before lne damages occur. To reflect ths common practce, postcontngency nterface lmts are 10% hgher than normal nterface flow lmts. 3000 4 2000 5 2000 2000 3000 6 7 2000 1 2 3 250 REGION B 11 1600 1000 1000 2000 3.1 Base Case Table 1 shows the generaton and load cost data (.e. the b and c constants). Note that the value of the a constant does not affect the optmal soluton whch s a well-known fact from optmzaton theory. It s set to G 1600 8 1000 9 10 1500 1200 500 Fgure 3.1 Eleven zone model REGION A 400 500 REGION D REGION C Fgure 1: An eleven-zone model. zero n the calculatons used n ths paper. The loads are 1000 for all zones except zone 11 whch has a load of 1500. The wllngness-to-pay (the negatve b constant) s 200 Euro/h for all zones. The data for transmsson lnes can be found n the appendx. In the base case the transmsson system s as shown n Fgure 1. Contngences are checked but no contngences are bndng at the optmal soluton reached by the OPF. Tables 2 and 3 show the base case OPF generaton and load results, the zone lambdas and total export or mport. Bus 11 has two generators, and n MATPOWER ths s modeled by an ntroducton of a dummy bus for the most expensve generator. The transmsson lne connectng t to bus 11 has almost zero mpedance. Table 1: Generaton and load cost data. Bd b Constant c Constant Max 1 1 10.00 0.0040 1000.0 2 2 15.00 0.0060 800.0 3 3 50.00 0.0080 1500.0 4 4 12.00 0.0050 2500.0 5 5 15.50 0.0060 1500.0 6 6 15.50 0.0070 1500.0 7 7 21.50 0.0080 1500.0 8 8 16.00 0.0060 1500.0 9 9 14.00 0.0050 1500.0 10 10 13.00 0.0040 1500.0 11 11 16.00 0.0060 700.0 12 11 31.00 0.0090 2000.0 13 1-200.00 0.0000 1000.0 14 2-200.00 0.0000 1000.0 15 3-200.00 0.0000 1000.0 16 4-200.00 0.0000 1000.0 17 5-200.00 0.0000 1000.0 18 6-200.00 0.0000 1000.0 19 7-200.00 0.0000 1000.0 20 8-200.00 0.0000 1000.0 21 9-200.00 0.0000 1000.0 22 10-200.00 0.0000 1000.0 23 11-200.00 0.0000 1500.0 All load s beng suppled and all the generators are supplyng some power wth the excepton of the generator n zone 3 and the second generator n zone 11 whch are so expensve they are not used. Note that any generator not at ts mnmum or maxmum wll have the same ncremental cost n a DC OPF (almost the same ncremental cost n the AC OPF). In the base case all zones have almost the same zone prce (λ). Note that zone 11 s mportng 800 of power, ts frst generator s at ts maxmum output of 700 and ts second generator s not producng. In the decongested case, the transmsson system can wthstand any frst contngency outage of a sngle lne n any nterface and stll not be overloaded. generaton s slghtly hgher than total consumpton, due to grd losses. The dfference between total generaton and load equals total grd losses.
Table 2: Base case generaton OPF results. Bd Bd Max Sold or Purchased Generator Incremental Cost 1 1 1000.0 1000.0 18.0 2 2 800.0 800.0 24.6 3 3 0 0 50.0 4 4 2500.0 1865.8 30.7 5 5 1500.0 1265.3 30.7 6 6 1500.0 1093.3 30.8 7 7 1500.0 581.6 30.8 8 8 1500.0 1210.5 30.5 9 9 1500.0 1500.0 29.0 10 10 1500.0 1500.0 25.0 11 11 700.0 700.0 24.4 12 11 2000.0 0.0 31.0 Table 4: Congested case export/mport. Varable Generaton Varable Load Lambda Export or Import 1 1000.0 1000.0 29.55 0.0 2 800.0 1000.0 29.49-200.0 3 0.0 1000.0 29.65-1000.0 4 1738.3 1000.0 29.84 738.3 5 1159.6 1000.0 29.95 159.6 6 996.6 1000.0 29.35-3.4 7 500.0 1000.0 29.30-500.0 8 1092.3 1000.0 29.75 92.3 9 1500.0 1000.0 29.85 500.0 10 1500.0 1000.0 29.95 500.0 11 1226.6 1500.0 40.49-273.4 s 11513.4 11500.0 Table 3: Base case load, zone lambdas and export/mport. Varable Generaton Varable Load Lambda Export or Import 1 1000.0 1000.0 30.87 0.0 2 800.0 1000.0 30.77-200.0 3 0 1000.0 31.05-1000.0 4 1865.8 1000.0 30.66 865.8 5 1265.3 1000.0 30.68 265.3 6 1093.3 1000.0 30.81 93.3 7 581.6 1000.0 30.81-418.4 8 1210.5 1000.0 30.53 210.5 9 1500.0 1000.0 30.38 500.0 10 1500.0 1000.0 30.43 500.0 11 700.0 1500.0 31.00-800.0 11516.4 11500.0 3.2 Congested Case In ths case we create congeston by changng the transmsson system topology. All lnes n the nterfaces between zones 6 and 11 and zones 7 and 11 have been completely outaged. Table 4 shows the resultng congested system export/mport data. The actve or bndng constrant s a contngency of one lne n the zone 10 to zone 11 nterface whch brngs the remanng lne n that nterface to ts postcontngency flow lmt. Ths transmsson lmt s found by the calculaton, 500 250 + 250 * 10 % = 275 (data for the lne from 10 to 11 s found n the appendx). The congeston results n an mport reducton nto zone 11 from 800 n the base case to 273.4. Therefore generaton n zone 11 must ncrease from 700 to 1226.6 to supply zone 11 load, and ths must all come from the very hgh prced second generator n zone 11. The reducton of 526.6 n generaton exported from the remanng zones results n ther zone lambdas droppng slghtly to 29 EURO/h whle zone 11 experences an ncrease to 40.49 EURO/h due to the expensve second generator. 3.3 Congeston n a Networked System When congeston occurs on the radal nterface n the prevous case, there are two dfferent zone prces at each sde of the nterface. Congeston n an nterface that s part of a networked (meshed or looped) system wll gve unque zone prces at every bus. Congeston on any nterface n a networked system affects zone prces n the entre networked system. Ths effect s llustrated by restorng the nterface from zone 7 to zone 11 to servce. Only the nterface from zone 6 to zone 11 s out of servce. Table 5 shows the AC OPF results. Table 5: Congeston n a networked system. Varable Generaton Varable Load Lambda Export or Import 1 1000.0 1000.0 30.35 0.0 2 800.0 1000.0 30.96-200.0 3 0.0 1000.0 29.40-1000.0 4 1923.5 1000.0 31.24 923.5 5 1312.7 1000.0 31.25 312.7 6 1139.7 1000.0 31.46 139.7 7 642.3 1000.0 31.78-357.7 8 966.7 1000.0 27.60-33.3 9 1343.1 1000.0 27.43 343.1 10 1500.0 1000.0 26.21 500.0 11 888.7 1500.0 34.40-611.3 s 11516.6 11500.0 Because of the ncreased nterface capacty to zone 11, more power s mported and the more expensve generator n zone 11 now operates at 188.7. Ths s a reducton of 337.9 from the prevous case and lowers the zone 11 prce. The nterface from zone 10 to zone 11 s stll the bndng constrant, but ths nterface s now part of a networked system wth unque zone prces. Every tme the load or generaton changes n a zone t affects the flow on the congested nterface, even when the changed load or generaton s n a zone far from that nterface. Hgher zone prces appear where decreases n generaton or ncreases n load ncrease the flow on the congested nterface. Lower zone prces appear where n-
creases n load or decreases n generaton decrease the flow on the congested nterface. 4 ECONOMICS AND TRANSMISSION CONGESTION In economcs the deal s a perfectly compettve envronment, where goods wanted by consumers are produced at the least possble cost. In electrcty markets ths would mply that consumers could buy power at the same prce wthout respect to locaton. The degree of effcency s measured by the socal welfare, whch should be maxmzed. The socal welfare s the sum of the producer and consumer surplus, or alternatvely the sum of the generator costs and the consumer benefts. The compettve benchmark s margnal cost prcng, resultng n maxmum socal welfare. In a compettve market more goods are produced at a lower prce than n any other form of market. However, a congested transmsson system prohbts customers from buyng power from lower cost generators. Ths mples that transmsson congeston ntroduces neffcency n electrcty markets. To study what the topology of a congested network nvolves, we analyzed our three test cases wth respect to the socal welfare and the ncome to the ISO. The results are shown n Table 6. Table 6: Economc analyss of the networks (CC = congested case and CNS = congeston n a network system). Network Export/ Import () Income to the ISO Base Case -2418.4/2434.9 504 CC -1990.2/1976.8 1911 CNS -2202.3/2219.0 3374 Network Generator Base Case Consumer Socal Welfare 110559 1946510 2057069 CC 110149 1942585 2052734 CNS 102224 1950720 2052943 The base case gves the hghest socal welfare, followed by the CNS case. As expected socal welfare decreases as the number of lne outages ncreases. When the lnes 6-7 and 7-11 are out of servce (case CC) there s less export/mport, and some of the hgh cost generators have to be scheduled, whch ncreases the cost. For the CNS case the most expensve generator at bus 11 s runnng and there s more export/mport than n the CC case. The ncome to the ISO s hghest for the CNS case, whch has dfferent prces at every bus and s lowest n the decongested case. The ncome to the generators (producer surplus) s hghest n the base case, closely followed by the CC case. The consumer surplus s hghest n the CNS, followed by the base case. We also see that there s a 16.35 net export n the base case, due to grd losses. Another nterestng aspect s how large the capacty of the congested nterface should be before the prce would be equal at both sdes (.e. to decongest the nterface). For the congested case we found that the nterface between 10 and 11 had to be 760 for the prces to be equal. Ths s an ncrease of 485 n capacty or 176 per cent. For the meshed network the nterface had to be 485, whch s an ncrease of 210 or 76 per cent. In the congested case the prce dfferental s 11.65 Euro/h between buses 10 and 11. To make nvestments n transmsson lnes proftable for producers at bus 10 ther benefts from the lne must outwegh nvestment costs. Benefts must be greater than 11.65 Euro/h durng the lfetme for the project n the CC case. The greatest prce dfference over an nterface appeared between buses 10 and 11, wth bus 11 as the hgher prce bus. The producers at bus 11 experenced hgher profts and consumers receved lower surplus durng congeston. We calculated the producer and consumer surplus n Table 7. The potental for creaton of transmsson congeston and thereby explotaton of market power s therefore consderable at bus 11. Table 7: Economc consequences for the players n the market at bus 11 for the three cases. Network Producer Consumer Base 7560 253500 Case CC 16695 239265 CNS 10261 248400 To model market splttng 5 we could compare the power flows from the unconstraned soluton (.e. the base case) wth the nterface lmts defnng the prce areas, takng nto account contngences and securty lmts. When the unconstraned transfer exceeds the transmsson lmts, each prce area becomes a separate market wth the constrant that the power flow from one area to another does not volate the nterface lmt. In the case of two areas the power balance constrant for area A (the surplus area) states that the generaton n area A s equal to load n area A plus maxmum transfer from area A to area B (the constraned area). Smlarly the area B constrant states that generaton n area B s equal to load n area B mnus the maxmum transfer from area A to area B. New transmsson capacty constrants expressng the maxmum transfers are then replacng the unconstraned transmsson lmts. In practce prce areas are defned pragmatcally, based on operatonal and engneerng experence. Analytcal 5 Strctly speakng the relatonshp between the nodal prces and area prces n Norway s; nodal prce = Area prce * factor, where the factor s the margnal losses n the grd.
determnaton of prce area dvsons n a meshed network s stll an unresolved ssue [5]. The Norwegan transmsson provder (.e. Statnett) can also use the OPF to analyze the mpacts from new transmsson lnes or outages. 5 CONCLUSIONS Ths paper demonstrates how MATPOWER calculates the nodal prces as a result of an optmzaton of the mnmum costs of actve and reactve generaton, takng nto account the relevant constrants. We studed three cases: one base case, one congested case and one congested case n a meshed network. We found that when we had a congested case wth two nterfaces out of servce t gave rse to a sgnfcantly hgher prce n one of the nodes. When one nterface was out of servce and the network was meshed t gave rse to dfferent nodal prces at every node. Some of the prces were hgher or some were lower than n the decongested case. We calculated the socal welfare, producer and consumer surplus and ncome to the ISO for the dfferent networks. Congeston n a network decreased socal welfare and created neffcency. We also found how much we had to ncrease the capacty n the lnes to decongest an nterface. Bus 11 was found to be a market where market power could be exploted because the generators receved hgher profts under congeston. Fnally we explaned how Nord Pool and Statnett could use OPF to analyze prce areas and transmsson congeston, ncludng aspects of securty and relablty. APPENDIX Table 8: Example transmsson system data. From To No. of Crcuts Crcut Reactance R, per unt Crcut Reactance X, per unt Capacty n 1 2 4 0.5 0.8 2000.0 1 3 4 1.0 1.2 1600.0 2 3 2 2.0 3.2 250.0 2 4 3 0.3 0.4 3000.0 2 5 2 0.5 0.8 1000.0 3 8 4 1.0 1.6 1000.0 3 9 2 1.5 2.0 400.0 4 5 2 0.3 0.4 2000.0 4 6 4 1.0 0.8 2000.0 4 7 3 0.3 0.4 3000.0 5 7 3 0.5 0.8 2000.0 6 7 2 0.75 0.8 2000.0 8 10 4 1.0 1.2 1600.0 8 9 3 1.0 1.2 1000.0 9 10 2 1.0 1.6 500.0 6 11 3 0.75 0.8 1500.0 7 11 3 1.0 1.2 1200.0 10 11 2 1.0 1.6 500.0 REFERENCES [1] R. D. Zmmerman and D. Gan, MATPOWER A MATLAB Power System Smulaton Package, User s Manual, School of Electrcal Engneerng, Cornell Unversty, 1997, avalable: http://www.pserc.cornell.edu/matpower/manual.pdf [2] F. C. Sweppe, M. C. Caramans, R. D. Tabors and R. E. Bohn, Spot Prcng of Elelectrcty, Boston/Dordrecht/London: Kluwer Academc Publshers, 1988. [3] W. W. Hogan, Contract Networks for Electrc Power Transmsson, Journal of Regulatory Economcs, 4:211-242, 1992. [4] R. D. Chrste, B. Wollenberg and I. Wangensteen, Transmsson Management n the Deregulated Envronment, IEEE Proceedngs, February 2000. [5] M. Bjørndal and K. Jørnsten, Zonal Prcng n a Deregulated Electrcty Market, The Energy Journal, Vol. 22, No. 1, 2001.