Primary tabs

Power Systems Engineering Research Center 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 understand and modify.

MATPOWER is developed by Ray D. Zimmerman, Carlos E. Murillo-Sánchez & others

Copyright © 1997-2016 PSERC

To use MATPOWER you will need:

MATLAB® version 7 (R14) or later, available from The MathWorks, Inc., or
GNU Octave version 3.4 or later.


Other (Public Domain)

Other Access

The information on this page (the dataset metadata) is also available in these formats.


via the DKAN API

DOI Information

No DOI assigned at this time.

4-bus, 2-generator transmission network model

Power flow data for 4-bus, 2-generator transmission network case from Grainger & Stevenson.

This is the 4-bus example from "Power System Analysis", by John Grainger, Jr., and William Stevenson, McGraw-Hill, pp. 337-338, 1994.

Modified Date
Release Date
Other (Public Domain)
John Grainger Jr., William Stevenson
Data Dictionary

The data files used by MATPOWER are MATLAB m-files or mat-files which define and return a single MATLAB structure. The m-file format is plain text that can be edited using any standard text editor.

The fields of the structure are baseMVA, bus, branch, gen, and optionally gencost, where baseMVA is a scalar and the rest are matrices. In the matrices, each row corresponds to a single bus, branch, or generator. The columns are similar to the columns in the standard IEEE CDF and PTI formats.

Bus Data Format
1 bus number (positive integer)
2 bus type
PQ bus = 1
PV bus = 2
reference bus= 3
isolated bus= 4
3 Pd, real power demand (MW)
4 Qd, reactive power demand (MVAr)
5 Gs, shunt conductance (MW demanded at V = 1.0 p.u.)
6 Bs, shunt susceptance (MVAr injected at V = 1.0 p.u.)
7 area number, (positive integer)
8 Vm, voltage magnitude (p.u.)
9 Va, voltage angle (degrees)
10 baseKV, base voltage (kV)
11 zone, loss zone (positive integer)
12 maxVm, maximum voltage magnitude (p.u.)
13 minVm, minimum voltage magnitude (p.u.)

Generator Data Format
1 bus number
2 Pg, real power output (MW)
3 Qg, reactive power output (MVAr)
4 Qmax, maximum reactive power output (MVAr)
5 Qmin, minimum reactive power output (MVAr)
6 Vg, voltage magnitude setpoint (p.u.)
7 mBase, total MVA base of this machine, defaults to baseMVA
8 status, > 0 - machine in service
<= 0 - machine out of service
9 Pmax, maximum real power output (MW)
10 Pmin, minimum real power output (MW)
11 Pc1, lower real power output of PQ capability curve (MW)
12 Pc2, upper real power output of PQ capability curve (MW)
13 Qc1min, minimum reactive power output at Pc1 (MVAr)
14 Qc1max, maximum reactive power output at Pc1 (MVAr)
15 Qc2min, minimum reactive power output at Pc2 (MVAr)
16 Qc2max, maximum reactive power output at Pc2 (MVAr)
17 ramp rate for load following/AGC (MW/min)
18 ramp rate for 10 minute reserves (MW)
19 ramp rate for 30 minute reserves (MW)
20 ramp rate for reactive power (2 sec timescale) (MVAr/min)
21 APF, area participation factor

Branch Data Format
1 f, from bus number
2 t, to bus number
3 r, resistance (p.u.)
4 x, reactance (p.u.)
5 b, total line charging susceptance (p.u.)
6 rateA, MVA rating A (long term rating), set to 0 for unlimited
7 rateB, MVA rating B (short term rating), set to 0 for unlimited
8 rateC, MVA rating C (emergency rating), set to 0 for unlimited
9 ratio, transformer off nominal turns ratio ( = 0 for lines )
10 angle, transformer phase shift angle (degrees), positive => delay
11 initial branch status, 1 - in service, 0 - out of service
12 minimum angle difference, angle(Vf) - angle(Vt) (degrees)
13 maximum angle difference, angle(Vf) - angle(Vt) (degrees)

Generator Cost Data Format
NOTE: If gen has ng rows, then the first ng rows of gencost contain
the cost for active power produced by the corresponding generators.
If gencost has 2ng rows then rows ng+1 to 2ng contain the reactive
power costs in the same format.
1 model, 1 - piecewise linear, 2 - polynomial
2 startup, startup cost in US dollars
3 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, parameters defining total cost function f(p),
units of f and p are $/hr and MW (or MVAr), respectively.
(MODEL = 1) : p0, f0, p1, f1, ..., pn, fn
where p0 < p1 < ... < pn and the cost f(p) is defined by
the coordinates (p0,f0), (p1,f1), ..., (pn,fn) of the
end/break-points of the piecewise linear cost function
(MODEL = 2) : cn, ..., c1, c0
n+1 coefficients of an n-th order polynomial cost function,
starting with highest order, where cost is
f(p) = cnp^n + ... + c1p + c0

For more information, check Appendix B in MATPOWER manual pages 121 - 126.

Public Access Level
Additional Info: