Professional Documents
Culture Documents
The problem
The main problem of interest in power system analysis is the solution of the so-called power flow
(or load flow) problem. The assumptions for the basic power flow problem are:
• A passive linear network of admittances describes the transmission grid. The nodal
admittance matrix Y-bus (denoted by Y) characterizes the behavior of the nodal voltages to
nodal current injections. The components of Y are complex numbers of the form
Yij = g ij + jbij . There are n nodes in the network. The dimension of Y is n by n.
• Every node can have active and reactive generation and active and reactive demand, each
represented as a complex number. The complete set of generation injections for the network
is denoted by the vector Sg, and the demands by the vector Sd, each a vector of dimension n.
• Every node (or bus) is classified as either a PV or a PQ node. For a PV node, the voltage
magnitude and the net power injection are fixed, while the generation Q is a variable. For a
PQ node, both the active and reactive net power injections are fixed (either positive or
negative).
• One node (usually a PV node) is designated as the angle reference for all voltages. At least
one node (usually the same PV node) is designated as a node where the net injection P is not
specified but rather determined as a variable. Thus, in this node both voltage magnitude and
angle are known. The node is called the slack node. When multiple nodes are designated as
slack nodes, some means for resolving the uncertainty as to which node picks up the “slack”
is necessary.
The following complex equations must be satisfied at every node in the network, no exceptions:
S g − S d = V i* ( YiV )
∗
where i* denotes element-wise product of two vectors (using Matlab notation), and * as a
superscript denotes the complex conjugate. The dot i denotes the ordinary dot product of a
matrix times a vector.
Since at least one voltage V is known (and possibly many magnitudes of several other voltages),
this means that only a subset of these equations is solved as a simultaneous set. In particular, the
equations that are selected for a simultaneous solution are:
• The real and reactive parts of these equations for all PQ nodes.
• The real-only part of the above equations for all PV nodes excluding the slack.
Likewise, the only variables of immediate interest are:
1
The key idea used for the vectorization of Jacobian computations is based on work by Christopher
DeMarco of the University of Wisconsin.
∆Pi = − Pi + | Vi | ∑ | V j | g ij cos(δ i − δ j ) + ∑ | V j | bij sin(δ i − δ j )
j∈αˆ i j ∈α i
∆Qi = −Qi + | Vi | ∑ | V j | g ij sin(δ i − δ j ) − ∑ | V j | bij cos(δ i − δ j )
j∈α i j∈αˆ i
is the set of power flow equations of interest:
where gij and boj are the real and imaginary components of the entries of the nodal admittance
matrix, δi is the angle of Vi, αi denotes all neighbors or node i excluding i itself, and α^ i denotes
the neighbors of i including i itself.
In matrix form, these equations can be expressed as:
∆S = S d − S g + V i* ( Y iV )
*
F I + I .*F dV I
*
dS
d | V| GH JK GH d V JK
= V.*
dI
dV
*
dS F dI I F dV IJ
*
= V.*G J + I .*G
H dδ K H dδ K
*
dδ
where:
I = YV
Penalty factors
The following code illustrates the construction of the loss penalty factors in accordance with the
Transposed Jacobian method (Alvarado 1979):
Bus3
Bus2
Bus6
Bus1
Bus5
Bus4
The common format data for this case is (save it as 6bus.cf):
Wood and Wollenberg test case
BUS DATA FOLLOWS
1 BUS1 1 1 3 1.0500 0.00 0.00 0.00 100.00 .00 100.00
2 BUS2 1 1 2 1.0500 0.00 0.00 0.00 50.00 .00 100.00
3 BUS3 1 1 2 1.0700 0.00 0.00 0.00 60.00 .00 100.00
4 BUS4 1 1 0 1.0000 0.00 70.00 70.00 .00
5 BUS5 1 1 0 1.0000 0.00 70.00 70.00 .00
6 BUS6 1 1 0 1.0000 0.00 70.00 70.00 .00
-999
BRANCH DATA FOLLOWS
1 2 1 1 1 0 .100000 .200000 .020000 100
1 4 1 1 1 0 .050000 .200000 .020000 100
1 5 1 1 1 0 .080000 .300000 .030000 100
2 3 1 1 1 0 .050000 .250000 .030000 100
2 4 1 1 1 0 .050000 .100000 .010000 100
2 5 1 1 1 0 .100000 .300000 .020000 100
2 6 1 1 1 0 .070000 .200000 .025000 100
3 5 1 1 1 0 .120000 .260000 .025000 100
3 6 1 1 1 0 .020000 .100000 .010000 100
4 5 1 1 1 0 .200000 .400000 .040000 100
5 6 1 1 1 0 .100000 .300000 .030000 100
-999
INTERCHANGE DATA FOLLOWS
-9
TIE LINE DATA FOLLOWS
-999
LOSS ZONE DATA FOLLOWS
-99
END OF DATA
Because of width restrictions, the “desired voltage” field generally supplied with PV type buses
has been excluded in the above data. However, the desired voltage magnitude for these buses is
The columns here correspond to: the terminal nodes, the active and reactive flows, the minimum
limit, the flow, and the maximum limit. There are no overloaded lines in this case.
And if, in addition, we execute the penalty.m script we obtain:
The first column entries are the inverses of the penalty factors for the active powers at every node
in the network. The second column entries are the corresponding factors for the reactive powers.
Exercises
1. Create a front end for the power flow that allows you to remove any line and re-run the power
flow conveniently, and determine any overloads in the new case.
2. Add code to the flows.m script to display the overloads as a sorted list, largest percentage
overload first. Use the absolute values of the flow currents at either end.
3. Modify the code to calculate the Q injections at PV nodes, and to change these nodes to PQ
type if a limit is encountered.
4. Assuming all generator costs are the same and that there are no limits to any generator (other
than perhaps a minimum of zero), use the penalty factors above to re-dispatch generation to
minimize operating costs by minimizing system losses. The voltage at the slack generator
The next portion of code is the code necessary to read a common format file into a structure:
function S=readcf(fname)
% readcf.m
% Read the common format file and create a data dictionary structure
if nargin<1, [fname,pname]=uigetfile('*.cf'); fname=[pname fname]; end
S.Misc.BaseMVA=100;
fcf=fopen(fname,'r'); % Open common format file
s=fgetl(fcf);
while strcmp(s(1:min(3,length(s))),'BUS')~=1, % Find the start of bus data
s=fgetl(fcf);
end
s=fgetl(fcf);
while s(1)=='%', s=fgetl(fcf); end;
nL=0; ng=0; n=0;
S.PQlist=[]; S.SlackList=[]; S.BlackList=[]; S.PVlist=[];
S.Bus.Voltages=sparse(n,1);
S.Interch.I=[];
S.Interch.areaCount=zeros(100,1);
while strcmp(s(1:4),'-999')~=1,
n=n+1;
Pg=scanreal(s,59,67);
Qg=scanreal(s,68,75);
Pd=scanreal(s,41,49);
Qd=scanreal(s,50,58);
S.Bus.busType(n,1)=sscanf(s(26),'%d');
if (s(26)=='1') | (s(26)=='2') | (s(26)=='3')
if s(26)=='3', S.SlackList=[S.SlackList n];
else, S.PVlist=[S.PVlist n];
end;
else
S.PQlist=[S.PQlist n];
end;
bus=scanint(s,1,5);
S.Bus.Number(n,1)=bus;
while ~strcmp(s(1:3),'INT'),
s=fgetl(fcf);
end
s=fgetl(fcf);
while s(1)=='%', s=fgetl(fcf); end;
nInterch=0;
while ~strcmp(s(1:2),'-9'),
nInterch=nInterch+1;
S.Interch.I(nInterch,1)=scanint(s,1,2);
S.Interch.ControlGenRef(nInterch,1)=scanint(s,3,7);
S.Interch.SchedNetMW(nInterch,1)=scanreal(s,21,29)/S.Misc.BaseMVA;
s=fgetl(fcf);
while s(1)=='%', s=fgetl(fcf); end;
end
fclose(fcf);
S.Machine.BusRef=S.newBus(S.Machine.BusRef)'; % Use internal bus numbers
S.Load.BusRef=S.newBus(S.Load.BusRef)'; % "
ky=find(S.Machine.ControlledBusRef); % "
kx=S.Machine.ControlledBusRef(ky);
S.Machine.ControlledBusRef(ky)=S.newBus(kx);
S.Bus.n=length(S.Bus.Voltages);
S.Branch.nn=length(S.Branch.From);
S.Bus.area=S.Bus.area+dArea;
Appendix B: Brief description of the common format for solved power flow
data interchange
Taken from “Common Data Format for the Exchange of Solved Load Flow Data,” Working
Group on a Common Format for the Exchange of Solved Load Flow Data, _IEEE Transactions
on Power Apparatus and Systems, Vol. PAS-92, No. 6, November/December 1973, pp. 1916-
1925. Only the “tape” format (with lines of up to 128 characters) is described here.
The data is organized into sections with section headers and terminated with numeric flags
(usually –9 or –999). Data items are entered in specific columns. Mandatory items are indicated.
No blank items are allowed for mandatory items (note: most program will, nevertheless, default
some blank items). Floating point items should have explicit decimal point. No implicit decimal
points are used.
Data type codes:
A - Alphanumeric (no special characters)
I – Integer
F - Floating point
* - Mandatory item
TAPE
First line is the title, it also contains the Base MVA, usually 100
BUS DATA FOLLOWS
Columns 1- 4 Bus number (I) *
Columns 7-17 Name (A) (left justified) *
Columns 19-20 Load flow area number (I) Don't use zero! *
Columns 21-23 Loss zone number (I)
Columns 25-26 Type (I) *
0 - Unregulated (load, PQ)
1 - Hold MVAR generation within voltage limits, (PQ)
2 - Hold voltage within VAR limits (gen, PV)
3 - Hold voltage and angle (swing, V-Theta)
Columns 28-33 Final voltage magnitude, p.u. (F) *
Columns 34-40 Final angle, degrees (F) *
Columns 41-49 Load MW (F) *
Columns 50-59 Load MVAR (F) *
Columns 60-67 Generation MW (F) *
Columns 68-75 Generation MVAR (F) *
Columns 77-83 Base KV (F)
Columns 85-90 Desired volts (pu) (F)
Columns 91-98 Maximum MVAR or voltage limit (F)
Columns 99-106 Minimum MVAR or voltage limit (F)
Columns 107-114 Shunt conductance G (per unit) (F) *
Columns 115-122 Shunt susceptance B (per unit) (F) *
Columns 124-127 Remote controlled bus number
–999
BRANCH DATA FOLLOWS
Columns 1- 4 Tap bus number (I) *
For transformers or phase shifters, the non-unity tap side
Columns 6- 9 Z bus number (I) *
For transformers and phase shifters, the device impedance side.
Columns 11-12 Load flow area (I)
Columns 13-14 Loss zone (I)
Column 17 Circuit (I) * (Use 1 for single lines)
Column 19 Type (I) *
0 - Transmission line
1 - Fixed tap
2 - Variable tap for voltage control (TCUL, LTC)
3 - Variable tap (turns ratio) for MVAR control
4 - Variable phase angle for MW control (phase shifter)
6 7 1 1 1 0 0.026700 0.082000 0.017000 85 90 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
6 8 1 1 1 0 0.012000 0.042000 0.009000 45 50 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
6 9 1 1 1 1 0.000000 0.208000 0.000000 65 70 0 0 0 0.9780 0.0 0.0000 0.0000 0.0000 0.0 0.0
6 10 1 1 1 0 0.000000 0.556000 0.000000 45 50 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
9 11 1 1 1 1 0.000000 0.208000 0.000000 0 0 0 0 0 1.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
9 10 1 1 1 1 0.000000 0.110000 0.000000 65 70 0 0 0 1.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
4 12 1 1 1 1 0.000000 0.256000 0.000000 65 70 0 0 0 0.9320 0.0 0.0000 0.0000 0.0000 0.0 0.0
12 13 1 1 1 1 0.000000 0.140000 0.000000 0 0 0 0 0 1.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
12 14 1 1 1 0 0.123100 0.255900 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
12 15 1 1 1 0 0.066200 0.130400 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
12 16 1 1 1 0 0.094500 0.198700 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
14 15 1 1 1 0 0.221000 0.199700 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
16 17 1 1 1 0 0.052400 0.192300 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
15 18 1 1 1 0 0.107300 0.218500 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
18 19 1 1 1 0 0.063900 0.129200 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
19 20 1 1 1 0 0.034000 0.068000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
10 20 1 1 1 0 0.093600 0.209000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
10 17 1 1 1 0 0.032400 0.084500 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
10 21 1 1 1 0 0.034800 0.074900 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
10 22 1 1 1 0 0.072700 0.149900 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
21 22 1 1 1 0 0.011600 0.023600 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
15 23 1 1 1 0 0.100000 0.202000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
22 24 1 1 1 0 0.115000 0.179000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
23 24 1 1 1 0 0.132000 0.270000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
24 25 1 1 1 0 0.188500 0.329200 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
25 26 1 1 1 0 0.254400 0.380000 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
25 27 1 1 1 0 0.109300 0.208700 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
28 27 1 1 1 1 0.000000 0.396000 0.000000 40 45 0 0 0 0.9680 0.0 0.0000 0.0000 0.0000 0.0 0.0
27 29 1 1 1 0 0.219800 0.415300 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
27 30 1 1 1 0 0.320200 0.602700 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
29 30 1 1 1 0 0.239900 0.453300 0.000000 30 33 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
8 28 1 1 1 0 0.063600 0.200000 0.042800 40 45 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
6 28 1 1 1 0 0.016900 0.059900 0.013000 40 45 0 0 0 0.0000 0.0 0.0000 0.0000 0.0000 0.0 0.0
-999
LOSS ZONES FOLLOWS 0 ITEMS
-99
INTERCHANGE DATA FOLLOWS 1 ITEMS
-999
TIE LINES FOLLOWS 0 ITEMS
-999
END OF DATA