Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction:
Power System simulation relates to simulation and modelling power system networks and
its corresponding components. A power system network may relate to a vast nationwide
network, e.g. the Malaysian National Grid or even a simple power system network in a
factory e.g. in an iron smelting plant. Analysing a power system network requires the
user some mathematical manipulation and modelling knowledge which may be very
complex in a highly meshed environment.
MATPOWER
MATPOWER is a freeware package of Matlab m-files for solving power flow and optimal
power flow problems developed for educational purposes by Ray Zimmerman and
Deqiang (David) Gan from the Power System Engineering Research Centre based in the
US. It is intended as a simulation tool for researchers and educators which will be easy to
use and modify. MATPOWER is designed to give the best performance possible while
keeping the code simple to understand and modify.
The initial objective of its creation is intended for the Matlab based power and optimal
power flow code to be included in a web-based application known as the PowerWeb
project. (see http://www.pserc.cornell.edu/powerweb/).
System Requirements
Step 1: Go to the MATPOWER home page and follow the download instructions.
(see http://www.pserc.cornell.edu/matpower/matpower.html)
Step 2: Unpack the archive using the appropriate software for your machine (StuffIt
Expander for Mac, gunzip and tar for UNIX, pkzip, WinZip, etc. for PC).
Step 3: Copy all of the m-files in the MATPOWER distribution to a location in your
Matlab path.
Documentation files:
• bustypes.m
• dSbus_dV.m - computes partial derivatives for Jacobian
• ext2int.m
• idx_brch.m
• idx_bus.m
• idx_gen.m
• int2ext.m
• makeSbus.m
• makeYbus.m - builds Ybus matrix
• mpoption.m - sets MATPOWER options
• printpf.m - prints output
• LPconstr.m
• LPeqslvr.m
• LPrelax.m
• LPsetup.m
As mentioned earlier, MATPOWER is designed for power flow and optimal power flow
iterations. Since this course is catered for participants from a wide variety of background,
there is a need to go through the basic concepts of power flow and optimal power flow
iterations before an appreciation can be made towards the function of MATLAB in these
iteration process..
Power Flow
In general, power flow has the sole purpose of analysing the static state of a power
system network. A typical power system network may comprise of several generators,
several kilometres of transmission lines, load demand points and support devices e.g.
transformers and compensators. In order to evaluate the stability of the power network,
there is a need to calculate the power flow and voltage levels of each points or bus in the
system. Consider a simple system consisting of a generator and one load point connected
via a transmission line. Its corresponding one line diagram will be as shown:
A B
Transmission line
Generator Load
Figure 1: 1 Generator, 1 Load connected together via a load bus
Using the assumptions given for the generator and load, values of the active and reactive
power flow and voltage levels at both busses A and B may be calculated using basic
power system equations.
The scenario shown in figure 1 is fairly straight forward. But considering a complex
system such as the IEEE 300 bus test system or the Malaysian Power Grid System where
transmission lines are highly meshed, evaluating power flow and voltage levels may be a
daunting task. Hence researchers has come up with a standardise approach known as the
power flow iteration. The general form for a power flow iteration is as shown.
N
Pi = ∑ YinVV
i n cos ( θ in + δ n − δ i ) , ∆Pi = Pi, sch − Pi, calc
n =1
N
Qi = − ∑ YinVV
i n sin ( θ in + δ n − δ i ) , ∆Qi = Qi, sch − Qi, calc
n =1
Based upon the equations above, an evaluation of the power flow values may be
determined using an iteration process involving matrix manipulations. Referring to well
established literature, there are 2 basic classes of iteration processes – Gauss Sidel and
Newton Raphson Iteration. Both iteration methods yield accurate results. However, the
amount of iteration process required is significant hence an increase in computation time.
Therefore researchers have come up with an improvement by modifying the Newton
Raphson process hence creating the Fast Decoupled Newton Raphson Iteration.
Regardless the type of iteration process, all of the method mentioned requires a form of
matrix manipulation. Solving the Jacobian matrix by manual calculation may be alright
for a small system, but as the system is bigger and highly meshed, manual calculation
would be impossible. A possible solution to this is by using Sparse Matrix Techniques
already available in MATLAB (also incorporated in MATPOWER) which improves the
calculation time.
The optimal power flow (OPF) is an extension to the power flow module with an addition
of unit commitment and generator cost implemented into it. In theory, since OPF takes
into account generator despatch, therefore its computation time would be longer as
compared to the standard power flow solution.
Data Set Structure
The data set structure required for MATPOWER is almost similar to the PTI data format.
To obtain the data structure format, type the following at the prompt in MATLAB:
The format for the data is similar to PTI format 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.
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+1 to 2*n contain the reactive power costs in the
same format.
<< this file created [97-Aug-26 12:29:15] by PB::System version 1.3 >>
To run a simple Newton power flow on the default 9-bus system specified in the file
case.m, with the default algorithm options, at the Matlab prompt, type:
>> runpf
To run a power flow on the 118-bus system whose data is in case118.m, type:
>> runpf('case118')
To run an optimal power flow on the default 9-bus system specified in the file case.m,
with the default algorithm options, at the Matlab prompt, type:
>> runopf
To run an optimal power flow on the 30-bus system whose data is in case30.m, type:
>> runopf('case30')
To run an optimal power flow on the same system, but with the option for MATPOWER
to shutdown (decommit) expensive generators, type:
>> runuopf('case30')
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 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:
is another way to run the OPF solver with the all of the default options. The
MATPOWER options vector controls the following:
opt = mpoption
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:
same as above except it uses the options vector opt as a base instead of the default
options vector.
The following mpoption listing is based upon the format below:
12 - OPF_ALG_POLY, 100 default OPF algorithm for use with polynomial cost
functions
13 - OPF_ALG_PWL, 200 default OPF algorithm for use with piece-wise linear cost
functions
14 - OPF_POLY2PWL_PTS, 10 number of evaluation points to use when converting
from polynomial to piece-wise linear costs