Home
matpower - Power Systems Engineering Research Center
Contents
1. Who can use it e MATPOWER is free Anyone may use it e We make no warranties express or implied Specifically we make no guarantees regarding the correctness MATPOWER s code or its fitness for any particular purpose e Any publications derived from the use of MATPOWER must cite MATPOWER http www pserc cornell edu matpower e Anyone may modify MATPOWER for their own use as long as the original copyright notices remain in place e MATPOWER may not be redistributed without written permission e Modified versions of MATPOWER or works derived from MATPOWER may not be distributed without written permission 2 Getting Started 2 1 System Requirements To use MATPOWER you will need MATLAB version 5 or later e MATLAB Optimization Toolbox required only for some OPF algorithms Both are available from The MathWorks see http www mathworks com MATPOWER 2 0 and earlier required only version 4 of Matlab MATPOWER User s Manual Version 3 0 0 2 2 Installation Step 1 Go to the MATPOWER home page http www pserc cornell edu matpower and follow the download instructions Step 2 Unzip the downloaded file Step 3 Place the files in a location in your MATLAB path 2 3 Running a Power Flow To run a simple Newton power flow on the 9 bus system specified in the file case9 m with the default algorithm options at the MATLAB prompt type gt gt runpf case9 2 4 Running an Optimal Power Flo
2. dcpf m implements DC power flow solver fdpf m implements fast decouple power flow solver gausspf m implements Gauss Seidel power flow solver newtonpf m implements Newton power flow solver pfsoln m updates data matrices with PF solution 26 MATPOWER User s Manual Version 3 0 0 Optimal Power Flow OPF common files shared by multiple OPF solvers opf_form m returns code for formulation given OPF algorithm code opf_slvr m returns code for solver given OPF algorithm code opf m top level OPF solver routine poly2pwl m creates piecewise linear approximation to polynomial cost function pqcost m splits gencost into real and reactive power costs totcost m computes total cost for given dispatch files used only by DC OPF dcopf m implements DC optimal power flow files used only for traditional OPF formulation constr and LP based fg_names m returns names of function and gradient evaluators for given algorithm fun_ccv m computes objective function and constraints for CCV formulation fun_std m computes objective function and constraints for standard formulation grad_ccv m computes gradients of obj fen amp constraints for CCV formulation grad_std m computes gradients of obj fen amp constraints for standard formulation opfsoln m updates data matrices with OPF solution files used only by constr based OPF copf m implements constr based OPF solver files used only by LP based OPF lpopf m implements LP based OPF solver LPconstr
3. 1 OUT_LINE LIM OUT PG LIM OUT_QG LIM OUT_RAW other options 51 SPARSE OP 0 1 1 1 1 0 i 0 don t print 1 print binding constraints only 2 print all constraints same options for OUT_LINE LIM OUT_PG LIM OUT_QG LIM 1 print system summary 0 or 1 print area summaries 0 or 1 print bus detail 0 or 1 print branch detail 0 or 1 print generator detail 0 or 1 Gs ss es es e e e y es OUT_BUS also includes gen info control constraint info output control output control output control output control output print raw data interface code 1 individual flags control what constraint info prints 0 no constraint info overrides individual flags 1 binding constraint info overrides individual flags 2 all constraint info overrides individual flags of voltage limit info of line limit info of gen P limit info of gen Q limit info for Perl database 0 or 1 pass sparse matrices to QP and LP solvers if possible 0 or 1 23 MATPOWER User s Manual MINOPF 61 62 63 64 65 66 67 68 69 70 options MNS FEASTOL 0 1E 3 primal feasibility tolerance set to value of OPF_VIOLATION by default MNS_ROWTOL O 1E 3 row tolerance set to value of OPF_VIOLATION by default MNS_XTOL 0 1E 3 x tolerance set to value of CONSTR_TOL X by default MNS _MAJDAMP 0 0 5 major damping parameter MNS MINDAMP 0 2 0 minor damping
4. Aly su general linear constraints X nin S X S X nax voltage and generation variable limits where 0 V X F Q is the vector of standard optimization variables for the OPF and y z are other variables to be explained later The ability to include the general linear constraints and the extra linear cost vector c allow easy modeling for the CCV formulation of piecewise linear costs and constant power factor dispatchable or price sensitive loads Furthermore because the user is given the ability to specify all or part of A and u it is possible to pose additional constraints such as restriction of angle differences or linearly interrelated injections making MATPOWER even more useful as a research tool The general formulation also allows generator costs of mixed type polynomial and piecewise linear in the same problem Note In Optimi zation Toolbox versions 3 0 and earlier mincon seems to be providing inaccurate shadow prices on the constraints This did not happen with constr and it may be a bug in these versions of the Optimiza tion Toolbox Problem Data Transformation and General Linear Restrictions To add general linear constraints of ones own it is necessary to understand the standard transformations performed on the input data bus gen branch areas and gencost tables before the problem is solved in order to know where the optimization variables end up in the x vector All of these transformations are reversed after solvin
5. above And sometimes the user may also want to include additional linear costs on some or all of the variables but in most cases fmincopf or mopf hide these steps from the user and create certain costs and restrictions automatically This creates a conflict between ease of use and generality of the software In this section we explain the behavior adopted by fmincopf and mopf when the following factors interact a existence of y variables because of piecewise linear costs b user provided linear restrictions b1 on whatever the existing variables x y are b2 with A having more columns than there are elements in x y thus creating extra variables z and an overall optimization vector x y z If the user does not provide any additional linear restrictions via the A u parameters then internally there are only x and y type variables if there are y type variables for modeling piecewise linear costs then some additional constraints will be constructed to model the cost segments If there are dispatchable loads with either polynomial or piecewise linear costs then additional constraints will be included to maintain a constant power factor If a user does provide A u parameters to add general linear constraints then a if the number of columns in A is the same as the number of variables in x y then any linear cost vector needed for modeling of the piecewise linear costs is constructed automatically and the user 1s not expect
6. addition to the values listed for the power flow solvers the OPF solution also includes the following values bus LAM P Lagrange multiplier on bus real power mismatch bus LAM Q Lagrange multiplier on bus reactive power mismatch bus MU_VMAX Kuhn Tucker multiplier on upper bus voltage limit bus MU_VMIN Kuhn Tucker multiplier on lower bus voltage limit gen MU_PMAX Kuhn Tucker multiplier on upper generator real power limit gen MU_PMIN Kuhn Tucker multiplier on lower generator real power limit gen MU_QMAX Kuhn Tucker multiplier on upper generator reactive power limit gen MU_QMIN Kuhn Tucker multiplier on lower generator reactive power limit branch MU_SF Kuhn Tucker multiplier on MVA limit at from end of branch branch MU_ST Kuhn Tucker multiplier on MVA limit at to end of branch f final objective function value The chronologically first of the OPF solvers in MATPOWER is based on the constr function included in earlier versions of MATLAB s Optimization Toolbox which uses a successive quadratic programming technique with a quasi Newton approximation for the Hessian matrix The second approach is based on linear programming It can use the LP solver in the Optimization Toolbox or other MATLAB LP solvers available from third parties Version 3 of MATPOWER has a new generalized OPF formulation that al lows general linear constraints on the optimization variables but requires fmincon m found in MATLAB
7. contain the reactive power costs in the same format 1 model 1 piecewise linear 2 polynomial MATPOWER User s Manual Version 3 0 0 2 startup startup cost in US dollars shutdown shutdown cost in US dollars 4 n number of cost coefficients to follow for polynomial cost function or number of data points for piecewise linear 5 and following cost data defining total cost function For polynomial cost c2 cl c0 where the polynomial is c0 c1 P c2 P 2 For piecewise linear cost x0 yO xl yl x2 y2 where x0 lt xl lt x2 lt and the points x0 y0 x1 y1 x2 y2 are the end and break points of the cost function Ww Some columns are added to the bus branch and gen matrices by the solvers See the help for idx_bus idx_brch and idx_gen for more details 3 2 Modeling AC Formulation Fixed loads are modeled as constant real and reactive power injections P and Q specified in columns 3 and 4 respectively of the bus matrix The shunt admittance of any constant impedance shunt elements at a bus are specified by G and B in columns 5 and 6 respectively of the bus matrix G J B sh baseMVA Each branch whether transmission line transformer or phase shifter is modeled as a standard st model transmission line with series resistance R and reactance X and total line charging capacitance B in series with an ideal transformer and phase shifter at the from end with tap ratio t and phase shift an
8. expense of V 0 or 1 use DC power flow formulation for power flow and OPF 0 use AC formulation amp corresponding algorithm opts 1 use DC formulation OPF options 11 OPF_ALG 0 0 choose best default solver available in the 12 OPF_ALG POLY 13 14 16 17 18 19 20 21 22 23 24 following order ignore AC algorithm options algorithm to use for OPF 500 520 then 100 200 Otherwise the first digit specifies the problem formulation and the second specifies the solver as follows see the User s Manual for more details 100 standard formulation old constr 120 standard formulation old dense LP 140 standard formulation old sparse LP relaxed 160 standard formulation old sparse LP full 200 CCV formulation old constr 220 CCV formulation old dense LP 240 CCV formulation old sparse LP relaxed 260 CCV formulation old sparse LP full 500 generalized formulation MINOS 520 generalized formulation fmincon See the User s Manual for details on the formulations 100 OPF_ALG PWL 200 OPF_POLY2PWL PTS 10 OPF_VIOLATION CONSTR TOL X le 4 CONSTR TOL F le 4 CONSTR _MAX IT 0 5e 6 LPC_TOL GRAD 3e 3 LPC_ TOL X le 4 LPC MAX IT 400 LPC MAX RESTART 5 OPF_P LINE LIM 0 default OPF algorithm for use with polynomial cost functions used only if no solver available for generalized
9. formulation default OPF algorithm for use with piece wise linear cost functions used only if no solver available for generalized formulation number of evaluation points to use when converting from polynomial to piece wise linear costs constraint violation tolerance Version 3 0 0 Gs ee es e e es es e ee e e e e termination tol on x for copf amp fmincopf termination tol on F for copf amp fmincopf max number of iterations for copf amp fmincopf 0 gt 2 nb 150 termination tolerance on gradient for lpopf termination tolerance on x min step size for lpopf maximum number of iterations for lpopf maximum number of restarts for lpopf use active power instead of apparent power for line flow limits 0 or 1 22 MATPOWER User s Manual output 31 32 33 34 35 36 37 38 39 40 41 42 43 options VERBOSE OUT_ALL 1 individual flags control what prints 1 Version 3 0 0 amount of progress info printed 0 print no progress info 1 print a little progress info 2 print a lot of progress info 3 print all progress info 1 controls printing of results 0 don t print anything 1 print everything overrides individual flags except OUT_RAW overrides individual flags except OUT_RAW OUT_SYS SUM OUT_AREA SUM OUT BUS OUT_BRANCH OUT_GEN 1 0 OUT_ALL LIM OUT _V_LIM 1
10. negligible i e branches are lossless e All bus voltage magnitudes are close to 1 p u e Voltage angle differences are small enough that sin0 0 Combining these assumptions and equation 1 with the fact that S VT the relationship between the real power flows and voltage angles for an individual branch can be written as P 5 6 P shift where Be fel 5 Xoi 1 P shift 0 i 1 fs hifi shift E 4 P snif Xt 1 The elements of the individual branch shift injections and B matrices are combined by MATPOWER to form a bus B matrix and P si Shift injection vector which can be used to compute bus real power bus injections from bus voltage angles MATPOWER User s Manual Version 3 0 0 P bus BpusOpus P bus bus bus shift Similarly MATPOWER builds the matrix B and the vector Pesin Which can be used to compute the vector s P and P of branch real power injections P B Opus Pi shirt P P 3 3 Power Flow MATPOWER has five power flow solvers which can be accessed via the runpf function In addition to printing output to the screen which it does by default runpf optionally returns the solution in output ar guments gt gt baseMVA bus gen branch success et runpf casename The solution values are stored as follows bus VM bus voltage magnitudes bus VA bus voltage angles gen PG generator real power injections gen QG generator reactive po
11. parameter MNS PENALTY PARM 0 1 0 penalty parameter MNS MAJOR_IT 0 200 major iterations MNS_MINOR_IT 0 2500 minor iterations MNS MAX IT 0 2500 iterations limit MNS VERBOSITY 1 m m ma mna m WNrR OF controlled by VERBOSE flag 0 or 1 below print nothing print only termination status message print termination status and screen progress print screen progress report file usually fort 9 71 MNS_CORE 1200 nb 5000 72 MNS _SUPBASIC_ LIM 0 2 ng superbasics limit 73 MNS MULT PRICE O 30 multiple price A typical usage of the options vector might be as follows Get the default options vector gt gt opt mpoption Use the fast decoupled method to solve power flow gt gt opt mpoption opt PF_ALG 2 Display only system summary and generator info gt gt opt mpoption opt OUT_BUS 0 OUT_BRANCH 0 OUT_GEN 1 Show all progress info gt gt opt mpoption opt VERBOSE 3 Now run a bunch of power flows using these settings gt gt runpf case57 opt gt gt runpf casell8 opt gt gt runpf case300 opt 24 Version 3 0 0 Gs ss es MATPOWER User s Manual Version 3 0 0 3 7 Summary of the Files Documentation files README basic intro to MATPOWER README txt basic intro to MATPOWER with DOS line endings for Windows docs CHANGES modification history of MATPOWER docs CHANGES txt modification history of MATPOWER with DOS li
12. s Optimization Toolbox 2 0 or later or the MINOS 14 based MEX file available separately as part of the optional MINOPF package see http www pserc cornell edu minopf MINOPF is distributed sepa rately because it has a more restrictive license than MATPOWER The performance of MATPOWER s OPF solvers depends on several factors First the constr function uses an algorithm which does not exploit or preserve sparsity so it is inherently limited to small power systems The same is still true for the combination of parameters required to be able to employ the newer fmincon function The LP based algorithm on the other hand does preserve sparsity However the LP solver included in the older Optimization Toolbox does not exploit this sparsity In fact the LP based method with the old LP solver performs worse than the constr based method even on small systems Fortunately there are LP solvers available from third parties which do exploit sparsity In general these yield much higher performance One in particular called BPMPD 8 actually a QP solver has proven to be robust and efficient Even the constr or fmincon based methods when tricked into calling BPMPD with full matrix data instead of the older qp m become much faster It should be noted however that even with a good LP solver MATPOWER s LP based OPF solver un like its power flow solver is not suitable for very large scale problems Substantial improvements in per forman
13. 21 ows Summary OF the Pleno 25 4 Acknowledgments sssesssssrisicsiesesssssisssoissseesessossestcosssedsosssvisicossseievoosesdt isasesosn drini dosesesroosissti ose 29 5 SI TE EET A EE EE E 29 Appendix A Notes on LP Solvers for MATLAB ssessseessecesocesocessccesocesoocesocesocesooessocesoosesocesocessoessoee 30 Appendix B Additional Notes seessscessocssocesocesoocesocessocesocesocesocessocesocsesocesocesocessocesocsesocesocesssessose 30 Appendix Cz Auction Code sicscsscccassessssansossesssvsoveseveosssyavesesessveeessssvnes sesevesssess soosesseneasssoevevenevevenensvenees 31 MATPOWER User s Manual Version 3 0 0 1 Introduction What is MATPOWER MATPOWER is a package of MATLAB M files for solving power flow and optimal power flow problems It is intended as a simulation tool for researchers and educators that is easy to use and modify MATPOWER is designed to give the best performance possible while keeping the code simple to under stand and modify The MATPOWER home page can be found at http www pserc cornell edu matpower Where did it come from MATPOWER was developed by Ray D Zimmerman Carlos E Murillo S nchez and Degiang Gan of PSERC at Cornell University http www pserc cornell edu under the direction of Robert Thomas The initial need for MATLAB based power flow and optimal power flow code was born out of the computa tional requirements of the PowerWeb project see http www pserc cornell edu powerweb
14. 30 bus system that has 9 generators where the last three have negative PMIN to model the dispatchable loads To solve this case using an AC optimal power flow and a last accepted offer LAO pricing rule we use a market code of 1110 and set up the problem as follows q 12 12 12 12 12 12 10 10 10 24 24 24 24 24 24 10 10 10 24 24 24 24 24 24 10 10 10 33 MATPOWER User s Manual Version 3 0 0 p 20 50 60 20 40 70 20 42 80 20 44 90 20 46 75 20 48 60 100 70 60 100 50 20 100 60 50 mpopt mpoption baseMVA cq cp bus gen gencost branch f dispatch success et runmkt my_case q p 1110 mpopt The resulting cleared offers and bids are gt gt cq cq 12 0000 23 3156 0 12 0000 24 0000 0 12 0000 24 0000 0 12 0000 24 0000 0 12 0000 24 0000 0 12 0000 24 0000 0 10 0000 10 0000 10 0000 10 0000 0 0 10 0000 10 0000 0 gt gt cp cp 50 0000 50 0000 50 0000 50 2406 50 2406 50 2406 50 3368 50 3368 50 3368 51 0242 51 0242 51 0242 52 1697 52 1697 52 1697 52 9832 52 9832 52 9832 51 8207 51 8207 51 8207 54 0312 54 0312 54 0312 55 6208 55 6208 55 6208 34 MATPOWER User s Manual Version 3 0 0 In other words the generators sold Quantity Sold Selling Price MW MWh 50 00 And the dispatchable loads bought MW MWh 30 0 51 82 35
15. MATPOWER A MATLAB Power System Simulation Package Version 3 0 0 February 14 2005 User s Manual Ray D Zimmerman Carlos E Murillo Sanchez Deqiang David Gan rz10 cornell edu carlos_murillo ieee org dgan zju edu cn 1997 2005 Power Systems Engineering Research Center PSERC School of Electrical Engineering Cornell University Ithaca NY 14853 MATPOWER User s Manual Version 3 0 0 Table of Contents Table OF Contents jckccesesdesntsacvacsdscedacsssenussdescndbencensedecdsdoeskasaneoucascoubsidsebensededstousasensdecksapusvadsevenstescstostesess 2 1 A vuacvcnasanctiossansnsbesd scues bacneeaandancsuos asaesleddecssobusceatacensse 3 2 Getting Started A e a E 3 2 1 SYSIEMUR QUIE ti tas deca 3 232 In tallation a seve ccdas E E ERR EEE E RET TAE E EEE R ES 4 Dd Running a Poner lo AA A aaa 4 24 Running an Optimal Power Flo Wa iaa 4 2 5 Getting Helpe a O o rE a E E A eter sou rE stds ans che S TEE R SEREA ARRE 4 3 Technical Reference sissicssssscstsavsscasnsssstesssoutsvensvestsadavesensosssdeusscoasenanseus ceiesedenssansetusdevssevansvesivesass 5 3 1 Data File Formater id 5 32 MOE Md 7 3 3 NS a E EA E RE R N EEE RT AEE E E R ERA 9 3 4 Optimal Power PIO Wi AS A a AAA ia 10 3 4 1 Traditional AC OPF Formula is 11 3 4 2 Generalized AC OPF Formulation fmincon and MINOPE ccccccnnnnnnonannnononononananananononoss 15 3 4 3 DC OPE Formulation di 20 3 5 Unit Decommitment Alcoi a a taa 20 3 6 MATPOWER Options ui ts
16. Q LIMS option is set to true default is false then if any generator reactive power limit is violated after running the AC power flow the corresponding bus is con verted to a PQ bus with the reactive output set to the limit and the case is re run The voltage magnitude at the bus will deviate from the specified value in order to satisfy the reactive power limit If the generator at the reference bus is reaches a reactive power limit and the bus is converted to a PQ bus the first re maining PV bus will be used as the slack bus for the next iteration This may result in the real power out put at this generator being slightly off from the specified values MATPOWER User s Manual Version 3 0 0 Currently none of MATPOWER s power flow solvers include any transformer tap changing or handling of disconnected or de energized sections of the network Performance of the power flow solvers with the exception of Gauss Seidel should be excellent even on very large scale power systems since the algorithms and implementation take advantage of MATLAB s built in sparse matrix handling 3 4 Optimal Power Flow MATPOWER includes several solvers for the optimal power flow OPF problem which can be accessed via the runopf function In addition to printing output to the screen which it does by default runopf op tionally returns the solution in output arguments gt gt baseMVA bus gen gencost branch f success et runopf casename In
17. ce may still be possible though they may require significantly more complicated coding and pos sibly a custom LP solver However when speed is of the essence the preferred choice is the MINOS 10 MATPOWER User s Manual Version 3 0 0 based MEX file solver assuming that its licensing requirements can be met It is coded in FORTRAN and evaluates the required Jacobians using an optimized structure that follows the order of evaluation im posed by the compressed column sparse format which is employed by MINOS In fact the new general ized formulation introduced in this version of MATPOWER is inspired by the data format used by MINOS MATPOWER s OPF implementation is not able to handle de energized sections of the network 3 4 1 Traditional AC OPF Formulation The AC optimal power flow problem solved by MATPOWER is a smooth OPF with no discrete vari ables or controls The objective function is the total cost of real and or reactive generation These costs may be defined as polynomials or as piecewise linear functions of generator output The problem is for mulated as follows io 2 JP O subject to P 0 V P Py 0 active power balance equations 0 0 V 0 0 0 reactive power balance equations S A 9 V lt 5 apparent power flow limit of lines from end S 0 v SS apparent power flow limit of lines to end Vr s V aye bus voltage limits Be apap active power generation limits Or lt Q lt Or reac
18. context of an LP based OPF Some of them we were unable to get to compile on our architecture of choice and others proved to be less than robust in an OPF context Here is a list of the solvers we tested at the time e bpmpd QP solver from http www sztaki hu meszaros bpmpd Please see http www pserc cornell edu bpmpd for a MATLAB MEX version e lpm LP solver included with Optimization Toolbox 1 x and 2 x from MathWorks e Ip_solve LP solver from ftp ftp ics ele tue nl pub lp_solve e loqo LP solver from http www princeton edu rvdb e sol_qps m LP solver developed at U of Wisconsin not publicly available Of all of the packages tested the bpmpd solver has been the only one which worked reliably for us It has proven to be very robust and has exceptional performance More information about free optimizers is available in Decision Tree for Optimization Software maintained by Mittenlmonn Hans and P Spellucci at http plato la asu edu guide html Since the initial development of MATPOWER more recent versions of the MATLAB Optimization Tool box have moved to new LP and QP solvers Linprog m and quadprog m The LP solver base on LIPSOL does support sparsity but is still typically slower than bpmpd The QP solver does not support sparsity in general only for certain restricted special cases Appendix B Additional Notes e Some versions of MATLAB 5 were slow at selecting rows of a large
19. corporate additional linear constraints however it is necessary to know in ad vance how many y variables there are so that the coefficient matrix for the user s constraints have a matching number of columns to multiply x y The number of y variables is equal to the number of piecewise linear cost curves both active and reactive there are for the generators that are online Dispatchable loads In general dispatchable or price sensitive loads can be modeled as negative real power injections with associated costs The current test is that if PMIN lt PMAX 0 for a generator then it is really a dispatchable load If a load has a demand curve like the following quantity P2 P1 price price1 price2 so that it will consume zero if the price is higher than price2 P1 if the price is less than price2 but higher than pricel and P2 if the price is equal or lower than price Considered as a negative injection the de sired dispatch is zero if the price is greater than price2 P1 if the price is higher than price but lower than price2 and P2 if the price is equal to or lower than price This suggests the following piecewise linear cost curve cost power slope price2 slope pricel Note that this assumes that the demand blocks can be partially dispatched or split if the price trigger is reached half way through the block the load must accept the partial block Otherwise accepting or re 18 MATPOWER User
20. criminative pricing and uniform pricing The various uni form pricing options are best explained in the context of an unconstrained lossless network In this con text the allocation is identical to what one would get by creating bid and offer stacks and finding the in tersection point The nodal prices A computed by the OPF and returned in bus LAM_P are all equal to the price of the marginal block This is either the last accepted offer LAO or the last accepted bid LAB depending which is the marginal block i e the one that is split by intersection of the offer and bid stacks There is often a gap between the last accepted bid and the last accepted offer Since any price within this range is acceptable to all buyers and sellers we end up with a number of options for how to set the price as listed in the table below 2 See http www pserc cornell edu minopf gt See http www pserc cornell edu powerweb 31 MATPOWER User s Manual Version 3 0 0 discriminative LAO FRO LAB niform price equal to the first rejected bid first price Uniform price equal to the offer bid price of marginal unit Uniform price equal to min FRO LAB if the marginal unit is an of fer or max FRB LAO if it is a bid split the difference Uniform price equal to the average of the LAO and LAB dual LAOB Uniform price for sellers equal to LAO for buyers equal to LAB second price Oo F a E Generalizing to a network w
21. ction is simply the sum of these cost variables which are then constrained to lie above each of the lin ear functions which make up the piecewise linear cost function Clearly this method works only for con vex cost functions In the MATPOWER documentation this will be referred to as a constrained cost vari able CCV formulation The algorithm codes 100 and 200 respectively are used to identify the constr based solver for polyno mial and piecewise linear cost functions If algorithm 200 is chosen for a system with polynomial cost function the cost function will be approximated by a piecewise linear function by evaluating the polyno mial at a fixed number of points determined by the options vector see Section 3 6 for more details on the MATPOWER options It should be noted that the constr based method can also benefit from a superior QP solver such as bpmpd See Appendix A for more information on LP and QP solvers LP Based OPF Solver LPconstr Linear programming based OPF methods are in wide use today in the industry However the LP based algorithm included in MATPOWER is much simpler than the algorithms used in production grade soft ware The LP based methods in MATPOWER use the same problem formulation as the constr based meth ods including the CCV formulation for the case of piecewise linear costs The compact form of the OPF problem can be rewritten to partition g into equality and inequality constraints and to partition the va
22. ding to the generators in buses 1 2 and 3 in that order and elements 22 24 are the corresponding reactive injections Note that in this case the generators in the original data already ap 16 MATPOWER User s Manual Version 3 0 0 pear in ascending bus order so no permutation with respect to the original data is necessary Going back to the angle restriction we see that it can be cast as 010000 1 0 0 zgeros 1 nbtng ng x lt 5 degrees We can set up the problem as follows A sparse 1 1 257 15 11 1 24 l Inf u 5 pi 180 mpopt mpoption OPF_ALG 520 use fmincon with generalized formulation opf case9 A 1 u mpopt which indeed restricts the angular separation to 5 degrees NOTE In this example the total number of variables is 24 but if there are any piecewise linear cost functions there may be additional helper vari ables used by the solver and in that case the number of columns in A may need to be larger The next section describes how this is done If all costs are polynomial however no extra variables are needed Piecewise linear convex cost formulation using constrained cost variables The generalized formulation allows for an easy way to model any piecewise linear costs Such a cost curve looks like O N c Ne lt ha xO This non differentiable cost can be modeled using one helper cost variable for each such cost curve and additional restrictions on this variabl
23. down starting with N 0 The algorithm proceeds as follows Step 1 Begin at stage zero N 0 assuming all generators are on line with all limits in place Step 2 Solve a normal OPF Save the solution as the current best Step 3 Go to the next stage N N 1 Using the best solution from the previous stage as the base case for this stage form a candidate list of generators with minimum generation limits binding If there are no candidates skip to step 5 Step 4 For each generator on the candidate list solve an OPF to find the total system cost with this generator shut down Replace the current best solution with this one if it has a lower cost If any of the candidate solutions produced an improvement return to step 3 Step 5 Return the current best solution as the final solution 20 MATPOWER User s Manual Version 3 0 0 3 6 MATPOWER Options MATPOWER uses an options vector to control the many options available It is similar to the options vector produced by the foptions function in early versions of MATLAB s Optimization Toolbox The primary difference is that modifications can be made by option name as opposed to having to remember the index of each option The default MATPOWER options vector is obtained by calling mpoption with no arguments So typing gt gt runopf case30 mpoption is another way to run the OPF solver with the all of the default options The MATPOWER options vector controls the following
24. e and Pg one restriction for each segment of the curve The restric tions build a convex basin and they are equivalent to saying that the cost variable must lie in the epi graph of the cost curve When the cost is minimized the cost variable will be pushed against this basin If the helper cost variable is y then the contribution of the generators cost to the total cost is exactly y and in the above case the two restrictions needed are 1 y gt m P X cy y must lie above the first segment 2 yam P x C y must lie above the second segment where m and m are the slopes of the two segments Also needed of course are the box restrictions on Po Pain Py Pmax The additive part of the cost contributed by this generator is y In the generalized OPF formulation the capability to accept general linear constraints is used to introduce new y variables one for each piecewise linear cost in the problem and constraints one for each cost segment in the problem The function that builds the coefficient matrix for the restrictions is makeAy 17 MATPOWER User s Manual Version 3 0 0 Because a linear cost on the y variables is also required the last row of the matrix that is passed to the solver is expected to contain not some linear restriction coefficients but a linear cost vector on x y In normal use this is done automatically inside fmincopf or mopf when using MINOPF and the user need not worry about this To in
25. ed to provide a cost row in A b if the number of columns in A is greater than the number of elements in x y then the user is re sponsible to provide b1 the appropriate linear restrictions on y and the P O sections of the x vector to model each E 5 g Ean s e g of the segments of the piecewise linear costs as described previously this includes both the coefficient matrix and the left and right hand sides of the restrictions The function makeAy can be used for this but keep in mind that it will return a coefficient matrix that has only as many columns as elements in x y It must be padded with enough sparse zero columns on the right to make it conformable with x y z if there are any z variables b2 the appropriate linear cost in the last row of A and this includes any necessary cost coeffi cients on the y section of the cost vector Note that and u must still have the same num ber of elements as A has rows but the last elements in and u are meaningless set them to large large 19 MATPOWER User s Manual Version 3 0 0 Note that this implies that in order to add linear costs on just the x y variables at least one dummy z variable must be created for the interface to provide the user with the opportunity to specify the linear cost vector 3 4 3 DC OPF Formulation The DC optimal power flow problem solved by MATPOWER is similar to the traditional AC OPF for mulation described above but using the DC model o
26. es x and the equality constraints g are eliminated from the problem before posing the LP sub problem This procedure is outlined below Suppose the LP sub problem is given by 13 MATPOWER User s Manual Version 3 0 0 T min c Ax subject to A Ax lt b AsAxsA If this is rewritten as min ci Ax c Ax subject to A Ax A Ax b A Ax A Ax lt b AsAxsA Where A is a square matrix Ax can be computed as Ax A b 4 Ax Substituting back in to the problem yields a new LP problem min cl An Ay ch Ax subject to A Ax A Ax A A b Anp Ax A Ax lt b A lt A b A Ax lt A A lt Ax lt A This new LP problem is smaller than the original but it is no longer sparse As mentioned above to realize the full potential of the LP based OPF solvers it will be necessary to ob tain a good LP solver such as bpmpd See Appendix A for more details 14 MATPOWER User s Manual Version 3 0 0 3 4 2 Generalized AC OPF Formulation fmincon and MINOPF The generalized AC OPF formulation used by the fmincon and MINOPF solvers can be written as fol lows x min Y AP faa 4 y f z subject to 8p x P 0 V P P 0 active power balance equations 8o x 0 0 V 0 0 0 reactive power balance equations 8s x S 0 V Smax apparent power flow limit of lines from end 85 4 8 0 V lt Smax apparent power flow limit of lines to end x l lt
27. f the network which only includes bus voltage an gles and real power injections and flows min gt fP OP gt TF subject to B s9 P Pa Paus shit 7 Esp active power balance equations BOs P P sup real power flow limit of lines from end B0 s P P pip real power flow limit of lines to end pa lt P s Pi active power generation limits The voltage angle at the reference bus is also constrained to the specified value Since all constraints are linear the problem is a simple LP or QP problem depending on the form of the cost function The current implementation of the DC OPF does not allow additional user supplied linear constraints and costs as in the generalized AC OPF formulation described above 3 5 Unit Decommitment Algorithm The standard OPF formulation described in the previous section has no mechanism for completely shut ting down generators which are very expensive to operate Instead they are simply dispatched at their minimum generation limits MATPOWER includes the capability to run an optimal power flow combined with a unit decommitment for a single time period which allows it to shut down these expensive units and find a least cost commitment and dispatch To run this for a case30 for example type gt gt runuopf case30 MATPOWER uses an algorithm similar to dynamic programming to handle the decommitment It pro ceeds through a sequence of stages where stage N has N generators shut
28. g the problem so that output data is in the right place in the tables 15 MATPOWER User s Manual Version 3 0 0 The first step filters out inactive generators and branches original tables are saved for data output comgen find gen GEN_STATUS gt 0 find online generators onbranch find branch BR_STATUS 0 find online branches gen gen comgen branch branch onbranch The second step is a renumbering of the bus numbers in the bus table so that the resulting table contains consecutively numbered buses starting from 1 i2e bus gen branch areas ext2int bus gen branch areas where i2e is saved for inverse reordering at the end Finally generators are further reordered by bus number ng size gen 1 number of generators or injections tmp igen sort gen GEN_BUS tmp inv_gen_ord sort igen save for inverse reordering at the end gen gen igen if ng size gencost 1 This is because gencost might have gencost gencost igen twice as many rows as gen if there else are reactive injection costs gencost gencost igen igentng end Having done this the variables inside the x vector now have the same ordering as in the bus gen tables x Theta nb bus voltage angles V nb bus voltage magnitudes Pg ng active power injections p u ascending bus order Qg ng reactive power injections p u ascending bus order and the nonlinear con
29. gle 0 The parameters R X B tT and Onit are found in columns 3 4 5 9 and 10 of the branch matrix respec tively The branch voltages and currents at the from and to ends of the branch are related by the branch admittance matrix Y as follows I V f f A vlv i B 1 1 Y J S s qe Pu 1 where Y and Y y 1 ed R jx s Ti JO snip tI e The elements of the individual branch admittance matrices and the bus shunt admittances are combined by MATPOWER to form a complex bus admittance matrix Y relating the vector of complex bus volt us ages V With the vector of complex bus current injections Ips Tus Yous Vous MATPOWER User s Manual Version 3 0 0 Similarly admittance matrices Y and Y are formed to compute the vector of complex current injections at the from and to ends of each line given the bus voltages V L Y V I Y Y us us The vectors of complex bus power injections and branch power injections can be expressed as Spus diag Vpus S diag V JI S diag V I bus Mus where V and V are vectors of the complex bus voltages at the from and to ends respectively of all branches and diag converts a vector into a diagonal matrix with the specified vector on the diagonal DC Formulation For the DC formulation the same parameters are used with the exception that the following assumptions are made e Branch resistances R and charging capacitances B are
30. his input Thanks also to Andrew Ward for code which helped us verify and test the ability of the OPF to optimize reactive power costs Thanks to Alberto Borghetti for contributing code for the Gauss Seidel power flow solver Thanks also to many others who have contributed code bug reports and suggestions over the years Last but not least we would like to acknowledge the input of Bob Thomas throughout the development of MATPOWER here at PSERC Cornell 5 References 1 R van Amerongen A General Purpose Version of the Fast Decoupled Loadflow IEEE Transac tions on Power Systems Vol 4 No 2 May 1989 pp 760 770 2 O Alsac J Bright M Prais B Stott Further Developments in LP based Optimal Power Flow IEEE Transactions on Power Systems Vol 5 No 3 Aug 1990 pp 697 711 3 R Fletcher Practical Methods of Optimization 2 Edition John Wiley amp Sons p 96 P E Gill W Murry M H Wright Practical Optimization Academic Press London 1981 5 A F Glimm and G W Stagg Automatic calculation of load flows AIEE Transactions Power Apparatus and Systems vol 76 pp 817 828 Oct 1957 6 A Grace Optimization Toolbox The MathWorks Inc Natick MA 1995 C Li R B Johnson A J Svoboda A New Unit Commitment Method IEEE Transactions on Power Systems Vol 12 No 1 Feb 1997 pp 113 119 8 C M sz ros The efficient implementation of interior point methods for linear prog
31. inted output will be appended to the file whose name is given in fname If solvedcase is specified the solved case will be written to a Case file in MATPOWER format with the specified name If solvedcase ends with mat it saves the case as a MAT file otherwise it saves it as an M file MATPOWER User s Manual Version 3 0 0 MATPOWER also has many options which control the algorithms and the output Type gt gt help mpoption and see Section 3 6 for more information on MATPOWER s options 3 Technical Reference 3 1 Data File Format The data files used by MATPOWER are simply MATLAB M files or MAT files which define and return the variables baseMVA bus branch gen areas and gencost The baseMVA variable is a scalar and the rest are matrices Each row in the matrix corresponds to a single bus branch or generator The columns are similar to the columns in the standard IEEE and PTI formats The details of the specification of the MATPOWER case file can be found in the help for caseformat m gt gt help caseformat CASEFORMAT Defines the MATPOWER case file format A MATPOWER case file is an M file or MAT file which defines the variables baseMVA bus gen branch areas and gencost With the exception of baseMVA a scalar each data variable is a matrix where a row corresponds to a single bus branch gen etc The format of the data is similar to the PTI format described in http ww ee washington edu research pstca formats pti t
32. is machine defaults to baseMVA machine impedance p u on mBase step up transformer impedance p u on mBase step up transformer off nominal turns ratio 8 status gt 0 machine in service lt 0 machine out of service of total VAr s to come from this gen in order to hold V at remote bus controlled by several generators 9 Pmax maximum real power output MW 10 Pmin minimum real power output MW nu B WN Branch Data Format 1 f from bus number 2 t to bus number circuit identifier r resistance p u x reactance p u b total line charging susceptance p u rateA MVA rating A long term rating rateB MVA rating B short term rating rateC MVA rating C emergency rating ratio transformer off nominal turns ratio 0 for lines taps at from bus impedance at to bus i e ratio Vf Vt 10 angle transformer phase shift angle degrees Gf shunt conductance at from bus p u Bf shunt susceptance at from bus p u Gt shunt conductance at to bus p u Bt shunt susceptance at to bus p u 11 initial branch status 1 in service 0 out of service wW 0 JO U amp WwW Area Data Format 1 i area number 2 price ref bus reference bus for that area Generator Cost Data Format NOTE If gen has n rows then the first n rows of gencost contain the cost for active power produced by the corresponding generators If gencost has 2 n rows then rows n l to 2 n
33. ith possible losses and congestion results in nodal prices A which vary ac cording to location These A values can be used to normalize all bids and offers to a reference location by adding a locational adjustment For bids and offers at bus i the adjustment is A Ap where Ap ep is the nodal price at the reference bus The desired uniform pricing rule can then be applied to the ad justed offers and bids to get the appropriate uniform price at the reference bus This uniform price is then adjusted for location by subtracting the locational adjustment The appropriate locationally adjusted uni form price is then used for all cleared bids and offers There are certain circumstances under which the price of a cleared offer determined by the above proce dures can be less than the original offer price such as when a generator is dispatched at its minimum generation limit or greater than the price cap max_p For this reason all cleared offer prices are clipped to be greater than or equal to the offer price but less than or equal to max_p Likewise cleared bid prices are less than or equal to both the bid price and max_p Handling Supply Shortfall Initial implementations of the auction software did not include dispatchable or price sensitive loads so it only handled single sided auctions In an attempt to handle situations where the offered capacity was in sufficient to meet the demand under all of the other constraints resulting in an infea
34. m solves a non linear optimization via sequential linear programming LPeqslvr m runs Newton power flow LPrelax m solves LP problem with constraint relaxation LPsetup m solves LP problem using specified method files used only for generalized OPF formulation mincon and MINOS based genform m documentation for generalized OPF formulation makeAy m forms A matrix and b vector for generalized OPF formulation files used only by mincon based OPF consfmin m computes value and gradient of constraints costfmin m computes value and gradient of objective function fmincopf m implements fmincon based OPF solver files used only for OPF with unit decommitment fairmax m same as MATLAB s built in max except breaks ties randomly uopf m implements unit decommitment for OPF 27 MATPOWER User s Manual Version 3 0 0 Extras in extras subdirectory auction market software in smartmarket subdirectory auction m clears set of bids and offers based on pricing rules and OPF result case2off m creates set of price quantity bids offers given gen and gencost matrices idx disp m named column index definitions for dispatch matrix off2case m updates gen and gencost matrices based on quantity price bids offers printmkt m prints the market output runmkt m top level program runs an OPF based auction SM_CHANGES modification history of the smartmarket software smartmkt m implements the smartmarket solver unfinished state estimator in state_estimator s
35. ne endings docs manual pdf PDF version of the MATPOWER User s Manual see also caseformat m amp genform m below Top level programs cdf2matp m converts data from IEEE CDF to MATPOWER format runcomp m runs 2 OPFs and compares results rundcopf m runs a DC optimal power flow rundcpf m runs a DC power flow runduopf m runs a DC OPF with unit decommitment runopf m runs an optimal power flow runpf m runs a power flow runuopf m runs an OPF with unit decommitment see also opf m copf m fmincopf m l1popf m below which can also be used as top level pro grams Input data files caseformat m documentation for input data file format case_ieee30 m IEEE 30 bus system casel18 m IEEE 118 bus system casel4 m IEEE 14 bus system case30 m modified IEEE 30 bus system case300 m IEEE 300 bus system case30pwl m case30 m with piecewise linear costs case300 m case30 m with reactive power costs case39 m 39 bus system case4gs m 4 bus system from Grainger amp Stevenson case57 m IEEE 57 bus system case6ww m 6 bus system from Wood amp Wollenberg case9 m 3 generator 9 bus system default case file case9Q m case9 m with reactive power costs 25 MATPOWER User s Manual Version 3 0 0 Common source files and utility functions used by multiple programs bustypes m creates vectors of bus indices for ref bus PV buses PQ buses compare m prints summary of differences between 2 solved cases dAbr_dV m computes partial derivatives of branch apparent p
36. nt solution x x Ax Step 4 If x meets termination criteria stop otherwise go to step 5 Step 5 Adjust step size limit A based on the trust region algorithm in 3 go to step 1 The termination criteria is outlined below OL qe eee tolerance Ox Ox Ox g x s tolerance Ax lt tolerance Here A is the vector of Lagrange multipliers of the LP problem The first condition pertains to the size of the gradient the second to the violation of constraints and the third to the step size More detail can be found in 4 Quite frequently the value of x given by step 1 is infeasible and could result in an infeasible LP problem In such cases a slack variable is added for each violated constraint These slack variables must be zero at the optimal solution The LPconstr function implements the following three methods e sparse formulation with full set of inequality constraints e sparse formulation with relaxed constraints ICS Iterative Constraint Search e dense formulation with relaxed constraints ICS 11 These three methods are specified using algorithm codes 160 140 and 120 respectively for systems with polynomial costs and 260 240 and 220 respectively for systems with piecewise linear costs As with the constr based method selecting one of the 2xx algorithms for a system with polynomial cost will cause the cost to be replaced by a piecewise linear approximation In the dense formulation some of the variabl
37. ower flows wit voltage used by OPF dSbr_dV m computes partial derivatives of branch complex power flows wrt voltage used by OPF amp state estimator dSbus_dV m computes partial derivatives of bus complex power injections wrt voltage used by OPF Newton PF state estimator ext2int m converts data matrices from external to internal bus numbering have_fcn m checks for availability of optional functionality idx_area m named column index definitions for areas matrix idx _brch m named column index definitions for branch matrix idx_bus m named column index definitions for bus matrix idx_cost m named column index definitions for gencost matrix idx_gen m named column index definitions for gen matrix int2ext m converts data matrices from internal to external bus numbering isload m checks 1f generators are actually dispatchable loads loadcase m loads data from a case file or struct into data matrices makeB m forms B matrix used by fast decoupled power flow makeBdc m forms B matrix used by DC PF and DC OPF makeSbus m forms bus complex power injections from specified generation and load injections makeYbus m forms complex bus admittance matrix mp_1p m solves an LP problem with best solver available mp _gp m solves a QP problem with best solver available mpver m prints MATPOWER version information printpf m pretty prints solved PF or OPF case savecase m saves data matrices to a case file mpoption m set MATPOWER options Power Flow PE
38. power flow algorithm power flow termination criterion OPF algorithm OPF default algorithms for different cost models OPF cost conversion parameters OPF termination criterion verbose level printing of results The details are given below gt gt help mpoption MPOPTION Used to set and retrieve a MATPOWER options vector opt mpoption returns the default options vector opt mpoption namel valuel name2 value2 returns the default options vector with new values for up to 7 options name is the name of an option and value is the new value Example options mpoption PF _ALG 2 PF_TOL le 4 opt mpoption opt namel valuel name2 value2 same as above except it uses the options vector opt as a base instead of the default options vector The currently defined options are as follows idx NAME default description options power flow options 1 PF_ALG 1 power flow algorithm 1 Newton s method 2 Fast Decoupled XB version 3 Fast Decoupled BX version Gs ss es 4 Gauss Seidel 2 PF_TOL le 8 termination tolerance on per unit P O mismatch 3 PF_MAX IT 10 maximum number of iterations for Newton s method 21 MATPOWER User s Manual 10 PF MAX IT FD 30 PF MAX IT GS 1000 ENFORCE _Q LIMS 0 PF DC 0 maximum number of iterations for fast decoupled method maximum number of iterations for Gauss Seidel method enforce gen reactive power limits at
39. ramming and their applications Ph D Thesis E tv s Lor nd University of Sciences 1996 9 B Stott Review of Load Flow Calculation Methods Proceedings of the IEEE Vol 62 No 7 July 1974 pp 916 929 10 B Stott and O Alsac Fast decoupled load flow IEEE Transactions on Power Apparatus and Systems Vol PAS 93 June 1974 pp 859 869 11 B Stott J L Marino O Alsac Review of Linear Programming Applied to Power System Re scheduling 1979 PICA pp 142 154 12 W F Tinney and C E Hart Power Flow Solution by Newton s Method IEEE Transactions on Power Apparatus and Systems Vol PAS 86 No 11 Nov 1967 pp 1449 1460 13 A J Wood and B F Wollenberg Power Generation Operation and Control 2 Edition John Wiley amp Sons p 108 111 14 B A Murtagh andM A Saunders MINOS 5 5 User s Guide Stanford University Systems Opti mization Laboratory Technical Report SOL83 20R 29 MATPOWER User s Manual Version 3 0 0 Appendix A Notes on LP Solvers for MATLAB When MATPOWER was initially developed the LP and QP solvers available in MATLAB s Optimization Toolbox 1p m and qp m did not exploit sparsity and were therefore very slow for the large sparse prob lems typically encountered in power system simulation Fortunately there were some third party LP and QP solvers for MATLAB with much better performance Several LP and QP solvers were tested for use in the
40. rator These block offers bids are converted to the equivalent piecewise linear generator costs and generator capacity limits by the of f2case function Offer blocks must be in non decreasing order of price and the offer must correspond to a generator with O lt PMIN lt PMAX A price Cap max_p specifies the maximum allowed offer price Capacity offered above this price is considered to be withheld from the auction and is not included in the cost function produced Bids must be in non increasing order of price and correspond to a generator with PMIN lt PMAX lt 0 see Dispatchable loads on page 18 Bids are not affected by max_p The data specified by a MATPOWER case file with the gen and gencost matrices modified according the step 1 are then used to run an OPF A market code parameter mkt is used to specify what type of OPF to use where a value of 11x0 indicates AC OPF and 12x0 indicates DC OPF A decommitment mechanism is used to shut down generators if doing so results in a smaller overall system cost see Sec tion 3 5 Unit Decommitment Algorithm In step 3 the OPF solution is used to determine for each offer bid block how much was cleared and at what price These values are returned in cq and cp which have the same dimensions as q and p The mkt parameter also specifies the rules to use for determining the cleared prices where the second digit is the rule number described below There are two basic types of pricing options dis
41. ri able x as follows min f x subject to g x x 0 equality constraints g x x lt 0 inequality constraints where x contains the system voltage magnitudes and angles and x contains the generator real and reac tive power outputs and corresponding cost variables for the CCV formulation This is a general non linear programming problem with the additional assumption that the equality constraints can be used to solve for x given a value for x The LP based OPF solver is implemented with a function LPconstr which is similar to constr in that it uses the same M files for computing the objective function constraints and their respective gradients In addition a third M file lpeqslvr m is needed to solve for x from the equality constraints given a value for x This architecture makes it relatively simple to modify the formulation of the problem and still be able to use both the constr based and LP based solvers 12 MATPOWER User s Manual Version 3 0 0 The algorithm proceeds as follows where the superscripts denote iteration number Step 0 Set iteration counter k lt 0 and choose an appropriate initial value call it x for x Step 1 Solve the equality constraint power flow equations g x x5 0 for xf Step 2 Linearize the problem around x solve the resulting LP for Ax min Ax Ax Ox iaa subject to Axs g x OX pax AsAx lt A Step 3 Set k k 1 update curre
42. s Manual Version 3 0 0 jecting whole blocks really poses a mixed integer problem which is outside the scope of the current MATPOWER implementation When there are dispatchable loads the issue of reactive dispatch arises If the QMIN QMAX generation lim its for the negative generator in question are not set to zero then the algorithm will dispatch the reac tive injection to the most convenient value Since this is not normal load behavior in the generalized for mulation it is assumed that dispatchable loads maintain a constant power factor The mechanism for posing additional general linear constraints is employed to automatically include restrictions for these injections to keep the ratio of P and Q constant This ratio is inferred from the values of PMIN and either OMIN for inductive loads or oMax for capacitive loads in the gen table It is important to set these ap propriately keeping in mind that PG is negative and that for normal inductive loads Qc should also be negative a positive reactive load is a negative reactive injection The initial values of the PG and Qe col umns of the gen matrix must be consistent with the ratio defined by PMIN and the appropriate Q limit Additional Information on the Generalized Formulation Structure The advanced user may want to incorporate additional linear constraints and or linear costs to the prob lem Sometimes new state variables may need to be defined in addition to x and y discussed
43. sible OPF imports were introduced These were simply generators with GEN_STATUS set to 1 If the auction software failed to find an OPF solution it would turn on these generators with costs set to 5 MWh above the highest offer and retry This feature still exists but we no longer use it Instead for single sided markets we model an import as a fixed injection together with an equal sized dispatchable load which is bid in at a high price Under nor mal circumstances the two cancel each other and have no effect on the solution Under supply shortage situations the dispatchable load is not fully dispatched resulting in a net injection at the bus mimicking an import When used in conjunction with the LAO pricing rule the marginal load bid will not set the price if all offered capacity can be used 32 MATPOWER User s Manual Version 3 0 0 Example Six generators with three blocks of capacity each offering as follows Block 1 Block 2 Block 3 12 20 24 50 24 60 12 20 24 40 24 70 12 20 24 44 24 90 12 20 24 46 24 75 12 20 24 48 24 60 EST One fixed load of 151 64 MW Three dispatchable loads bidding three blocks each as follows Block 1 Block 2 Block 3 MW MWh MW MWh MW MWh 10 100 1004 7 100560 10 100 100 50 10 20 10 100 10 60 10 50 The case file t t_auction_case m used for this example is a modified version of the
44. sparse matrix but much faster at transposing and selecting columns e fmincon m seems to compute inaccurate shadow prices for Optimization Toolbox 3 0 and earlier 30 MATPOWER User s Manual Version 3 0 0 Appendix C Auction Code MATPOWER 3 includes in the extras smartmarket directory code which implements a smart mar ket auction clearing mechanism The purpose of this code is to take a set of offers to sell and bids to buy and use MATPOWER s optimal power flow to compute the corresponding allocations and prices It has been used extensively by the authors with the optional MINOPF package in the context of PowERWEB but has not been widely tested in other contexts It has evolved over time and includes a mixture of currently used features and legacy code which we no longer use The smart market algorithm consists of the following basic steps Convert block offers and bids into corresponding generator capacities and costs 2 Run an optimal power flow with decommitment option uop to find generator allocations and nodal prices A 3 Convert generator allocations and nodal prices into set of cleared offers and bids 4 Print results For step 1 the offers and bids are supplied as two matrices q for offer bid quantities and p for the corre sponding offer bid prices The element i th row and j th column of q and p are the quantity and price re spectively of the j th block of capacity being offered bid by the i th gene
45. straints have the same order as in the bus branch tables g gp nb real power flow mismatches p u gq nb reactive power flow mismatches p u gsf nl from end apparent power injection limits p u gst nl to end apparent power injection limits p u With this setup box bounds on the variables are applied as follows the reference angle is bounded above and below with the value specified for it in the original bus table The V section of x is bounded above and below with the corresponding values for VMAX and VMIN in the bus table The Pg and Qg sections of x are bounded above and below with the corresponding values for PMAX PMIN OMAX and QMIN in the gen table The nonlinear constraints are similarly setup so that gp and gq are equality constraints zero RHS and the limits for gs gst are taken from the RATE_A column in the branch table The following example illustrates how an additional general linear constraint can be added to the problem formulation In the standard solution to case9 m the voltage angle for bus 7 lags the voltage angle in bus 2 by 6 09 degrees Suppose we want to limit that lag to 5 degrees at the most A linear restriction of the form Theta 2 Theta 7 lt 5 degrees would do the trick We have nb 9 buses ng 3 generators and nl 9 branches Therefore the first 9 elements of x are bus voltage angles elements 10 18 are bus voltage magnitudes elements 19 21 are ac tive injections correspon
46. tive power generation limits Here f and f are the costs of active and reactive power generation respectively for generator i at a given dispatch point Both f and f are assumed to be polynomial or piecewise linear functions By defining the variable x as 0 V x P Q the problem can be expressed compactly as follows min f x subject to g x 0 power balance equations g x lt 0 branch flow limits X min X S Xmax variable limits 11 MATPOWER User s Manual Version 3 0 0 Optimization Toolbox Based OPF Solver constr The first of the two original OPF solvers in MATPOWER is based on the constr non linear constrained optimization function in MATLAB s Optimization Toolbox The constr function and the algorithms it uses are covered in the older Optimization Toolbox manual 6 MATPOWER provides constr with two M files which it uses during for the optimization One computes the objective function f and the con straint violations g at a given point x and the other computes their gradients df dx and dg ox MATPOWER has two versions of these M files One set is used to solve systems with polynomial cost functions In this formulation the cost functions are included in a straightforward way into the objective function The other set is used to solve systems with piecewise linear costs Piecewise linear cost func tions are handled by introducing a cost variable for each piecewise linear cost function The objective fun
47. ubdirectory runse m runs a state estimator state_est m implements a state estimator Tests in t subdirectory soln9_dcopf mat data used for tests soln9 dcpf mat data used for tests soln9 opf mat data used for tests soln9 opf Plim mat data used for tests soln9 pf mat data used for tests t_auction m tests auction m in extras smartmarket t_auction_case m test case for t_auction m t_auction fmincopf m fmincon based tests of auction m in extras smartmarket t_begin m starts a set of tests t_case9 opf m case file for OPF tests t_case9 pf m case file for power flow tests t_end m finishes a set of tests and prints statistics t_is m tests if two matrices are identical to some tolerance t_jacobian m does numerical test of partial derivatives t_loadcase m tests load_case m t_ok m tests if an expression is true t_opf m tests OPF solvers t_pf m tests PF solvers t_run_tests m framework for running a series of tests t_skip m skips a specified number of tests test_matpower m runs all available MATPOWER tests 28 MATPOWER User s Manual Version 3 0 0 4 Acknowledgments The authors would like to acknowledge contributions from several people Thanks to Chris DeMarco one of our PSERC associates at the University of Wisconsin for the technique for building the Jacobian matrix Our appreciation to Bruce Wollenberg for all of his suggestions for improvements to version 1 The enhanced output functionality in version 2 0 are primarily due to
48. w To run an optimal power flow on the 30 bus system whose data is in case30 m with the default algo rithm options at the MATLAB prompt type gt gt runopf case30 To run an optimal power flow on the same system but with the option for MATPOWER to shut down decommit expensive generators type gt gt runuopf case30 2 5 Getting Help As with MATLAB s built in functions and toolbox routines you can type help followed by the name of a command or M file to get help on that particular function Nearly all of MATPOWER s M files have such documentation For example the help for runopf looks like gt gt help runopf RUNOPF Runs an optimal power flow baseMVA bus gen gencost branch f success et runopf casename mpopt fname solvedcase Runs an optimal power flow and optionally returns the solved values in the data matrices the objective function value a flag which is true if the algorithm was successful in finding a solution and the elapsed time in seconds All input arguments are optional If casename is provided it specifies the name of the input data file or struct see also help caseformat and help loadcase containing the opf data The default value is case9 If the mpopt is provided it overrides the default MATPOWER options vector and can be used to specify the solution algorithm and output options among other things see help mpoption for details If the 3rd argument is given the pretty pr
49. wer injections branch PF real power injected into from end of branch branch PT real power injected into to end of branch branch QF reactive power injected into from end of branch branch QT reactive power injected into to end of branch success 1 solved successfully O unable to solve et computation time required for solution The default power flow solver is based on a standard Newton s method 12 using a full Jacobian up dated at each iteration This method is described in detail in many textbooks Algorithms 2 and 3 are variations of the fast decoupled method 10 MATPOWER implements the XB and BX variations as de scribed in 1 Algorithm 4 is the standard Gauss Seidel method from Glimm and Stagg 5 based on code contributed by Alberto Borghetti from the University of Bologna Italy To use one of the power flow solvers other than the default Newton method the PF_ALG option must be set explicitly For ex ample for the XB fast decoupled method gt gt mpopt mpoption PF ALG 2 gt gt runpf casename mpopt The last method is a DC power flow 13 which is obtained by executing runpf with the PF_Dc option set to 1 or equivalently by executing rundepf directly The DC power flow is obtained by a direct non iterative solution of the bus voltage angles from the specified bus real power injections based on equa tions 2 3 and 4 For the AC power flow solvers if the ENFORCE_
50. xt except where noted An item marked with indicates that it is included in this data but is not part of the PTI format An item marked with is one that is in the PTI format but is not included here The columns for each data matrix are given below See also IDX_BUS IDX_BRCH IDX_GEN IDX_AREA and IDX_COST regarding constants which can be used as named column indices for the data matrices Also described in the first three are additional columns that are added to the bus branch and gen matrices by the power flow and OPF solvers Bus Data Format 1 bus number 1 to 29997 2 bus type PQ bus PV bus reference bus isolated bus PWN Pd real power demand MW Qd reactive power demand MVAr Gs shunt conductance MW demanded at V 1 0 p u Bs shunt susceptance MVAr injected at V 1 0 p u area number 1 100 Vm voltage magnitude p u Va voltage angle degrees bus name 10 baseKV base voltage kV OoOANIAH UU amp W MATPOWER User s Manual Version 3 0 0 11 zone loss zone 1 999 12 maxVm maximum voltage magnitude p u 13 minVm minimum voltage magnitude p u Generator Data Format 1 bus number machine identifier 0 9 A Z Pg real power output MW Qg reactive power output MVAr Qmax maximum reactive power output MVAr Qmin minimum reactive power output MVAr Vg voltage magnitude setpoint p u remote controlled bus index 7 mBase total MVA base of th
Download Pdf Manuals
Related Search
Related Contents
Traduction manuel d`utilisation télémétrie SPEKTRUM 24. 3. 21 支出負担行為担当官 防衛省防衛研究所企画部総務課 会計 NEC PlasmaSync PX-42VP4DP-A User's Manual repères pour les services à domicile au bénéfice des Software Configurator User Manual - Cat. No. 931U-C9C7C-BC SoftBank 007Z for Biz取扱説明書 - モバイル Fixapart BD912-MBR Copyright © All rights reserved.
Failed to retrieve file