Sie sind auf Seite 1von 10

MATPOWER: A Matlab Power System Simulation Package

R. Zimmerman
D. Gan
rz10@cornell.edu
deqiang@ee.cornell.edu
Power Systems Engineering Research Center (PSERC)
School of Electrical Engineering, Cornell University

INTRODUCTION.............................................................................................................................................1
THE POWER FLOW SOLVER.........................................................................................................................2
THE OPTIMAL POWER FLOW FORMULATION............................................................................................2
THE OPTIMIZATION TOOLBOX BASED OPF SOLVER.................................................................................2
THE LP-BASED OPF SOLVER........................................................................................................................2
General Introduction......................................................................................................................................3
The Sparse Solver..........................................................................................................................................4
The Dense Solver............................................................................................................................................7
The Formulation of LP Sub-problem................................................................................................................7
Solving the LP Sub-problem..........................................................................................................................8
Computing KT Multipliers (incomplete)...........................................................................................................8
Checking KT Conditions (incomplete)..............................................................................................................8
Computing Generation-load Shift Factors (incomplete)......................................................................................9
The Jacobian Matrix of Load Flow.................................................................................................................9
Linearized Formulation of Line Flow.............................................................................................................10
TEST RESULTS (INCOMPLETE)..................................................................................................................10
THE COMBINED UC-OPF SOLVER (INCOMPLETE).....................................................................................10
FINAL REMARKS (INCOMPLETE)................................................................................................................10
REFERENCE.................................................................................................................................................10

Introduction
The restructuring of the electric power industry in many parts of the world is creating a need for new analytical as well as
simulation tools. To test new ideas and methodologies for the operation of competitive power systems, researchers need to
have ready access to simulation tools which are easy to use and modify. The MATPOWER package, a set of Matlab m-files
developed by PSERC at Cornell University, is intended as such a tool.
At present, MATPOWER can be used to solve the following problems:

power flow (based on Newtons method)


optimal power flow (using the constr function in Matlabs Optimization Toolbox)
optimal power flow (using an LP-based approach)
optimal power flow with a heuristic for turning off expensive generators

Future versions of MATPOWER may include the ability to do:

economic dispatch
unit commitment
combined unit commitment and optimal power flow
transient stability
stability-constrained optimal power flow

This note is simply a technical note maintained by the authors describing the details of the algorithms implemented in
MATPOWER. Its purpose is to provide technical details for those interested in modifying or extending the current
functionality.

The Power Flow Solver


The power flow solver in MATPOWER is based on a standard full-Jacobian Newtons method, described in detail in many
textbooks. It does not include any transformer tap changing or feasibility checking. The method for building the Jacobian came
from Chris DeMarco.
We found that it solves the IEEE 300-bus system on our Sun Ultra in under 2 seconds.

The Optimal Power Flow Formulation


The OPF problem is formulated as follows:

Minimize
Pg ,Q g

S .T . Pgi PLi P(V , ) = 0


Qgi QLi Q(V , ) = 0
~
S ijf S ijM
~
S ijt S ijM

Vi V

Vi V m

(Active power equations)


(Reactive power equations)

(Constraints on apparent power of line flow, from side)


(Constraints on apparent power of line flow, to side)
(Voltage constraints)
(Voltage constraints)

Pgi PgiM

(Active power generation limits)

Pgi Pgim

(Active power generation limits)

Qgi QgiM

(Reactive power generation limits)

Qgi Qgim

(Reactive power generation limits)

The OPF formulation described above is used for both the Optimization Toolbox based OPF and the LP-based OPF. The
objective function of the OPF problem is assumed to be summation of costs of individual generators. The cost of each
generator is expressed in the form of either quadratic function or piece-wise linear curve.

The Optimization Toolbox based OPF Solver


Implementation of the Optimization Toolbox based OPF is quite straightforward. For details, see the file OTopf.m.

The LP-based OPF Solver


In this chapter, we will describe the algorithms implemented in our LP-based OPF solver.
The objective function of the OPF problem is assumed to be summation of costs of individual generators. The cost of each
generator is expressed in the form of either quadratic function or piece-wise linear curve. The quadratic cost function of ith
generator is defined as follows:
fi = C0 i + C1i Pgi + C 2 i Pgi2
The piece-wise linear cost function of ith generator is defined as follows (see Fig. 2):
fi = i + i1 Pgi 1 +...+ ik Pginseg
, (i ) .

Pgi = Pgi 1 +... + Pgi,n s e g(i )


0 Pgij
Pgij
M
Where i is a constant, ij denotes the slope of each linear function, Pgij
is called segmental power in this note. Note that
the cost curve must be convex, otherwise the solver could get wrong solution. This approach of modeling generator cost
function is called one-segment-one-variable approach [Stott, 1979].
cost

Pg1

Pg2

Fig. 2 Cost Curve of Generator

General Introduction
LP-based OPF method has been extensively examined, and used in quite a few modern power systems. The algorithm we
coded is perhaps different from that in production-grade software. The major difference is that our algorithm is much simpler.
The reason of doing so is, certainly, to make the OPF solver more re-usable. The flow chart of our solver is demonstrated in
Fig. 3.

Run AC load flow

Linearize OPF constraints

Formulate and solve LP sub-problem

Update solution

Check if the solution meets KT Condition

yes
STOP
Fig. 3 Flow Chart of LP-based OPF Solver

The stopping criteria, the selection of starting point, handling infeasibilities, etc. will be explained in the coming version of
this note.
The LP-based OPF solver can not handle OPF problems with quadratic cost function directly. If the cost information of
generators is given by quadratic functions, the quadratic curves will be discretized into piece-wise linear functions in M-file
opf.m. So in this chapter, we assume that the cost of generators is piece-wise linear.
We have developed two variants of LP-based OPF solver, one is called dense solver, and another is sparse solver. In the
algorithm of dense solver, load flow equations are eliminated, so are network voltages. In sparse solver, load flow equations are
preserved. The dense solver is more independent on the performance of LP solver but is less readable, while sparse solver is
more readable but is more dependent on the performance of LP solver. In subsequent text, we will give the details underlying
both solvers.

The Sparse Solver


The algorithm of sparse solver is pretty straightforward. In this section, we will just give the equations of linearized OPF only:

Minimize

V , , PG , Q G

11 Pg11 + ...+ 1 i Pg1, nsegi( )

)+...+(

1 +... + ni Pgn,n s e g(i )


n1 Pgn

nseg( i)

Pgi

S.T.

Gij

=0

(i=1, ,ng)

=0

(i=1, , nb)

=0

(i=1, , nb)

Pi
Vj +
V j
j=1
n

Pi


j= 2
n

Qi
Vj +
V j
j=1

~
S l f
V j +
V j
j =1
~
n
S lt
V j +
V j
j =1

~
S l f
j
j
j= 2
~
n
Sl t
j
j
j= 2

j= 2

- Pgi

Qi

- QGi

S lM S l0
S lM S l0

Vi

V M Vi0

Vi

Vi0 V m

(l=1,.., nl)

(l=1,.., nl)

PGi

PGiM PGi0

(i=1, , ng)

PGi

PGi0 PGim

(i=1, , ng)

QGi

QGi

m
Q0Gi QGi

PGij

PGij

QGiM

Q 0Gi

PGij
M

PGij
0

PGij
0

(i=1, , ng)
(i=1, , ng)
(i=1, , ng, j=1, , nseg(i))
(i=1, , ng, j=1, , nseg(i))

The above formulation can be expressed in matrix form as follows:

MIN

V


0
0
0
0

[
] Pg
Q g
Pg

Pg

S.T.
J PV ,ref V + J P ,ref
J PV V

+ J P

J QV V

+ J Q

~
S f

~
S f

V
V
V

V
~
St

~
St

- M ppg Pg = 0

E ref Pgref
,

=0

- Pg

=0
- Q g

S M S0

S M S0
V M V0
V0 Vm

V
Pg

PgM Pg0

Pg

Pg0 Pgm
Q g
Q g

- Pg 0
-
-

Note:

=0

QgM Q 0g
Q0g Q mg

Pg Pg M Pg 0
Pg
(Step size constraints)
Q g
(Step size constraints)

E ref , J PV ,ref , J P ,ref are the rows corresponding to reference bus.

The Dense Solver


The Formulation of LP Sub-problem
The voltage variables and load flow equations in sparse formulation can be eliminated based on:
J P 1 E 0 Pg
.
J Q 0 E Qg
V G11 G12 Pg

= G

21 G22 Q g
~
~
~
~
~ S S V S S G11
S =
=

V V G21
M jg = J ref G
V
=

J PV
J
QV

G12 V
= [T1
G 22

Pg
T2 ]

Qg

The well-known dense formulation of LP sub-problem is as follows:

MIN

S.T.

Pg

[0 0 ]Q g
P
g
Pg

- M ppg Pg

( M j g,P I ref ) Pg

=0

M jgQ
, Qg

=0

T1 f Pg

T2 f Q g

S M S0

T1t Pg

T2t Q g

S M S0

G11 Pg

G12 Qg

V M V0

- G11 Pg

G12 Qg

V0 Vm

Pg

PgM Pg0

Pg

Pg0 Pgm
Q g
Q g
- Pg 0
-
-

(Iref : the ref row of unit matrix)

QgM Q 0g
Q0g Q mg

Pg Pg M Pg 0
Pg
Q g

Solving the LP Sub-problem


It is well recognized that only a few constraints in a typical OPF problem are binding. Based on this observation, the so-called
Iterative Constraint Search [B. Stott, 1979] is employed in our code to solve LP sub-problem. We will explain the algorithm
in detail in coming version of our note.
Computing KT Multipliers (incomplete)
Since load flow equations do not appear explicitly in the dense LP sub-problem, so we can not get KT multipliers
corresponding to load flow equations directly from LP solver, we have to compute them. Before we explain how to compute
KT multipliers, let us recall what conditions optimal solution and KT multipliers meet. Applying the Kuhn-Tucker condition
directly to a LP problem, we have:
AT = c
Ax = b
AT

0 c
=
A x b

where A is composed of the binding terms of coefficients matrix A of a LP problem. The above formula is the basis we
compute KT multipliers. Let us rewrite the constraints of sparse LP formulation as:
E1u + J P1 x = 0

Eu + Jx = 0
Du + Bx = S~

Where: u contains controllable variables, x contains state variables V and . Matrix D and B jointly denote a submatrix of sparse linearized LP matrix. The sub-matrix is composed of the binding rows of the inequality constraints. Binding
constraints is identified after LP is solved.
Since AT = c , it follows:
J1T

E1T


J T B T 1
=
E T D T

We are only interested in the first equation, that is,


J1T 1 + J T + BT = 0
Variable

1 and are provided by LP solver (the dual vector). Solving the above equation, we get .

Checking KT Conditions (incomplete)


L=

f (P )+ g + h
i

i i

i i

L
= ij ij iju lij = 0
Pgij

trans

= i

Pgi
L

lf

Q gi

lf

i i + i = 0
u

= i i + i = 0
hk

L
=
Vi

L
=

P(V , )
i

Vi

iu + li

sk

~
S f

~
S kf
Vi

ks

~
S t

~
S kt
Vi

=0

=0

Computing Generation-load Shift Factors (incomplete)


This M-file is not available to users.
JP
J
Q

J PV P

=
J QV V Q

J P + J PV V = P
J + J V = 0
QV
Q

1
P = J P J PV J QV
J Q = J

Pij = ij / X ij = H J 1 P
Matrix

H J 1 is known as matrix of generation-load shift factor.

The Jacobian Matrix of Load Flow


NB

P (V , ) = Vi V j Gij cosij + Bij sinij


j =1

Pi
= VV
i j G ij sinij Bij cosij
j
Pi
= Vi
i

V (G

j i , j i

ij

= Qi BiiVi 2

Pi
= Vi Gij cosij + Bij sin ij
V j

j =1

j i

sin ij Bij cosij

ji

NB

Q(V , ) = Vi V j Gij sinij Bij cosij

Qi
= VV
i j Gij cosij + Bij sinij
j

Qi
= Vi V j Gij cosij + Bij sin ij
i
j i , j i
= Pi GiiVi 2
Qi
= Vi Gij sinij Bij cosij
V j

)
j i

)
ji

Pi
=
Vi
=

V (G

j i , j i

ij

V (G

Qi
=
Vi

cosij + Bij sinij + 2Vi Gii

1
Pi + GiiVi2 )
(
Vi

j i , j i

ij

sin ij Bij cosij 2Vi Bii

1
Qi BiiVi 2 )
(
Vi

Linearized Formulation of Line Flow

Sij = Vi
Pij =

Vi Vj
R + jX

R + jX

R Vi2 VV
i j cosij VV
i j X sin ij
2

Qij
Vi
Qij
V j
Qij

Pij RVV
i j sin ij VV
i j X cosij
=
2
i
R +X2
Pij
RVV
i j sin ij VV
i j X cosij
=
2
j
R +X2
P +Q
2
ij

2
ij

Qij =

R +X
Pij R( 2Vi V j cosij ) V j X sin ij
=
Vi
R2 + X 2
Pij RVi cosij Vi X sin ij
=
V j
R2 + X 2

~
Sij =

)= V

Vi 2 VV
i j (cosi j sini ) cos j + j sin j

=
=

jVV
i j sin ij VV
i j cosij
R2 + X 2

2
RVV
i j sin ij + X Vi VV
i j cosij

R +X
RVj sin ij + X 2Vi V j cosij
2

jX )

R +X
RVi sinij XVi cosij
2

(R

R2 + X 2
RVV
i j cosij + XVV
i j sinij

=
i
R2 + X 2
Qij RVV
i j cosij + XVV
i j sin ij
=
2
2
j
R +X

S~ij
Vi

= 2 Pij0

Pij
Vi

+ 2Qij0

Qij
Vi

Test Results (incomplete)


The Combined UC-OPF Solver (incomplete)
Final Remarks (incomplete)
Reference
O. Alsac, J. Bright, M. Prais, B. Stott, Further Developments in LP-based Optimal Power Flow, IEEE Trans. On Power
Systems, vol. 5, no. 3, 1990, pp. 697-711
B. Stott, J.L. Marino, O. Alsac, Review of Linear Programming Applied to Power System Rescheduling, 1979 PICA, pp
142-154

10

Das könnte Ihnen auch gefallen