M ATPOWER ’s Extensible Optimal Power Flow Architecture Ray Zimmerman, Cornell University Carlos Murillo-Sánchez, Universidad Autonoma de Manizales Robert J. Thomas, Cornell University IEEE PES General Meeting 2009 July 30, 2009 Calgary, Alberta, Canada PS ERC
Outline • M ATPOWER Overview • Extensible OPF Formulation • Standard Extensions • Software Architecture • Example: Adding Reserves
Outline • M ATPOWER Overview ‣ What does M ATPOWER do? ‣ M ATPOWER History ‣ M ATPOWER Package • Extensible OPF Formulation • Standard Extensions • Software Architecture • Example: Adding Reserves
What does M ATPOWER do? • DC power flow • DC optimal power flow (OPF) ‣ BPMPD (MEX) • AC power flow ‣ Primal-Dual Interior Point Method ‣ Newton (PDIPM) ‣ Gauss-Seidel • AC optimal power flow (OPF) ‣ Fast decoupled ‣ Primal-Dual Interior Point Method • functions to compute ... (PDIPM) (pure Matlab & MEX) ‣ derivatives of power flow equations ‣ MINOS (MEX) ‣ generation costs ‣ successive LP’s (BPMPD MEX) ‣ linear shift factors (PTDFs, LODFs) ‣ Optimization Toolbox (fmincon, constr)
M ATPOWER 4.0 - refactored OPF (all using gen. form.) - pure-Matlab PDIPM solver M ATPOWER History - OPF with reserves - userfcn callbacks - multiple solvers for DC OPF - LODFs 1st work with Matlab power flow code for PowerWeb - support for interior point fmincon - based on code from Joe Chow & Chris DeMarco M ATPOWER 3.2 1st PF and OPF code of my own - version 2 case format - based on Opt Tbx, constr() - gen capability curves - branch angle diff lims - PTDFs 1st public M ATPOWER release - TSPOPF - not widely publicized - PWL costs M ATPOWER 3.0 - MINOS-based OPF (gen. form.) - fmincon-based OPF M ATPOWER 1.0 - DC PF & OPF - in-house successive LP-based OPF - multiple gens/bus - Gauss-Seidel PF M ATPOWER 2.0 - improved DP de-commitment - fast decoupled PF - automated tests - successive LP-based OPF - separate disp. load output section - options vector - option for active power line lims - User’s Manual - option to enforce Q g lims in PF 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
M ATPOWER Package • Open source Matlab code available at: http://www.pserc.cornell.edu/matpower/ • No GUI (graphical user interface) • Set of functions you can run from Matlab command line or include in your own programs • Example: >> result = runopf(‘case300’); or >> mpc = loadcase(‘case300’); >> mpc.bus = scale_load(1.1, mpc.bus); >> result = runopf(mpc); • Primary focus on research and education applications
Outline • M ATPOWER Overview • Extensible OPF Formulation ‣ Standard Formulation ‣ Generalized Formulation ‣ User-Defined Costs ‣ User-Defined Constraints • Standard Extensions • Software Architecture • Example: Adding Reserves
Standard OPF Formulation min x f ( x ) subject to g ( x ) = 0 h ( x ) ≤ 0 x min ≤ x ≤ x max
Standard OPF Formulation n g � f i P ( p i ) + f i � � min Q ( q i ) Θ ,V,P,Q i =1 subject to g P ( Θ , V, P ) = 0 g Q ( Θ , V, Q ) = 0 h f ( Θ , V ) ≤ 0 h t ( Θ , V ) ≤ 0 i = i ref θ ref ≤ θ i ≤ θ ref , v min ≤ v i ≤ v max i = 1 . . . n b , i i p min ≤ p i ≤ p max i = 1 . . . n g , i i q min ≤ q i ≤ q max i = 1 . . . n g , i i
Generalized Formulation min x,z f ( x ) + f u ( x, z ) subject to g ( x ) = 0 h ( x ) ≤ 0 x min ≤ x ≤ x max � x � l ≤ A ≤ u z z min ≤ z ≤ z max
Generalized Formulation min x,z f ( x ) + f u ( x, z ) subject to g ( x ) = 0 h ( x ) ≤ 0 x min ≤ x ≤ x max � x � l ≤ A ≤ u z z min ≤ z ≤ z max additional variables
Generalized Formulation min x,z f ( x ) + f u ( x, z ) additional costs subject to g ( x ) = 0 h ( x ) ≤ 0 x min ≤ x ≤ x max � x � l ≤ A ≤ u z z min ≤ z ≤ z max additional variables
Generalized Formulation min x,z f ( x ) + f u ( x, z ) additional costs subject to g ( x ) = 0 h ( x ) ≤ 0 x min ≤ x ≤ x max � x � l ≤ A ≤ u additional constraints z z min ≤ z ≤ z max additional variables
User-Defined Costs � x � f u ( x, z ) = 1 2 w T Hw + C T w r = N z w i w i m i ˆ r i ˆ r i r i r i k i k i k i k i m i f d i ( u i + k i ) , u i < − k i � α , if d i = 1 w i = 0 , − k i ≤ u i ≤ k i f d i ( α ) = u = r − ˆ r α 2 , if d i = 2 m i f d i ( u i − k i ) , u i > k i
User-Defined Constraints • additional linear restrictions on all optimization variables � x � l ≤ A ≤ u z • inequality constraints l = u • equality constraints if
Outline • M ATPOWER Overview • Extensible OPF Formulation • Standard Extensions ‣ piece-wise linear costs ‣ dispatchable (price sensitive) loads ‣ generator reactive capability constraints ‣ branch angle difference limits • Software Architecture • Example: Adding Reserves
Piece-wise Linear Generation Costs m 1 ( x − x 1 ) + c 1 , • given the sequence of points x ≤ x 1 m 2 ( x − x 2 ) + c 2 , x 1 < x ≤ x 2 ( x j , c j ) , j = 0 . . . n c ( x ) = . . . . . . where is the slope of m j m n ( x − x n ) + c n , x n − 1 < x segment j m j = c j − c j − 1 c , j = 1 . . . n x j − x j − 1 c n • add a new variable and, for y y each segment, a new linear constraint on y y ≥ m j ( x − x j ) + c j , j = 1 . . . n c 2 • use in place of in the c 1 c ( x ) y c 0 cost function x x 0 x 1 x 2 x n
Dispatchable (price sensitive) Loads • modeled as “negative generator” $/MW $ c (total cost) λ (marginal benefit) λ 1 MW p (injection) p 2 p 1 p 1 λ 1 λ 2 p 1 p 2 λ 2 MW p 2 p (load) • with an additional constant power factor constraint
Generator Reactive Capability Constraints • Instead of simple box constraints ... q q max 1 q max q max 2 p q min 2 q min q min 1 p 1 p min p max p 2
Generator Reactive Capability Constraints • Instead of simple box constraints ... q q max 1 q max q max 2 p q min 2 q min q min 1 p 1 p min p max p 2
Outline • M ATPOWER Overview • Extensible OPF Formulation • Standard Extensions • Software Architecture ‣ Overview of Execution - Callbacks ‣ Adding Variables ‣ Adding Constraints • Example: Adding Reserves
Overview of Execution • load data • convert to internal indexing • set up problem formulation • run optimization • convert results back to external indexing • print results (optional) • save results (optional)
Overview of Execution Overview of Execution – Callbacks • load data • convert to internal indexing • set up problem formulation • run optimization • convert results back to external indexing • print results (optional) • save results (optional)
Overview of Execution – Callbacks Overview of Execution • load data Modifying the Formulation • convert to internal indexing • Option 1 – externally supply complete constraint matrix A , cost coeff matrix N , etc. • set up problem formulation (taking into account internal conversions) • run optimization • Option 2 – modify formulation • convert results back to external indexing directly in a callback function • print results (optional) • save results (optional)
Software Architecture - Variables AC OPF DC OPF • Utilizes an “OPF-Model” object (OM) to manage variable and constraint indexing Va Va • Variables are added in named blocks, with dimension, initial value and bounds, e.g. Pg om = add_vars(om, 'Pg', ng, Pg0, Pmin, Pmax); x = Vm • Portions of optimization variable x or limit y shadow prices can be accessed by name, x = z w/o need to keep track of explicit indexing Pg Qg name description y bus voltage angles Va bus voltage magnitudes Vm z generator real power injections Pg generator reactive power injections Qg CCV helper variables for pwl costs y other user defined variables z
Software Architecture - Constraints • Constraints added in named blocks, with A , l , u and block column names, e.g. om = add_constraints(om, 'Res', Ar, lr, ur, {'Pg', 'R'}); Va Vm Pg Qg y R � x � l ≤ A ≤ u z AC OPF A = 0 0 A1 0 0 A2 � P g � l r ≤ A r ≤ u r R � � P g � A 1 Ar = A1 A2 � A 2 l r ≤ ≤ u r R • Constraint multipliers can be accessed by name (e.g , 'Res' ) DC OPF A = 0 A1 0 A2 w/o need to keep track of explicit indexing Va Pg y R
Outline • M ATPOWER Overview • Extensible OPF Formulation • Standard Extensions • Software Architecture • Example: Adding Reserves
Example – Adding Reserves • Jointly optimize the allocation of both energy and reserves • Reserve requirements are set of fixed zonal quantities • New reserve variable: 0 ≤ r i ≤ r max i • Additional reserve cost: � f u ( x, z ) = c i r i i ∈ U • Reserve constraints: p i + r i ≤ p max , ∀ i ∈ U i � r i ≥ R k , ∀ k i ∈ Z k
Recommend
More recommend