World's Largest Science, Technology & Medicine Open Access Book Publisher
World's Largest Science, Technology & Medicine Open Access Book Publisher
World's Largest Science, Technology & Medicine Open Access Book Publisher
2800+
BOOKS
DELIVERED TO
151 COUNTRIES
97,000+
INTERNATIONAL
AUTHORS AND EDITORS
AUTHORS AMONG
TOP 1%
90+ MILLION
DOWNLOADS
12.2%
Chapter from the book MATLAB for Engineers - Applications in Control, Electrical
Engineering, IT and Robotics
Downloaded from: http://www.intechopen.com/books/matlab-for-engineersapplications-in-control-electrical-engineering-it-and-robotics
11
PV Curves for Steady-State Security
Assessment with MATLAB
Ricardo Vargas, M.A Arjona and Manuel Carrillo
Instituto Tecnolgico de la Laguna
Divisin de Estudios de Posgrado e Investigacin
Mxico
1. Introduction
Most of the problem solutions oriented to the analysis of power systems require the
implementation of sophisticated algorithms which need a considerable amount of
calculations that must be carried out with a digital computer. Advances in software and
hardware engineering have led to the development of specialized computing tools in the
area of electrical power systems which allows its efficient analysis. Most of the
computational programs, if not all of them, are developed under proprietary code, in other
words, the users does not have access to the source code, which limits its usage scope. These
programs are considered as black boxes that users only need to feed the required input data
to obtain the results without knowing anything about the details of the inner program
structure. In the academic or research areas this kind of programs does not fulfill all needs
that are required hence it is common the usage of programming tools oriented to the
scientific computing. These tools facilitate the development of solution algorithms for any
engineering problem, by taking into account the mathematical formulations which define
the solution of the proposed problem. Besides, it is also common that most of these
programs are known as script or interpreted languages, such as MATLAB, Python and Perl.
They all have the common feature of being high level programming languages that usually
make use of available efficient libraries in a straightforward way. MATLAB is considered as
a programming language that has become a good option for many researchers in different
science and engineering areas because of it can allow the creation, manipulation and
operation of sparse or full matrices; it also allows to the user the programming of any
mathematical algorithm by means of an ordered sequence of commands (code) written into
an ascii file known as script files. These files are portable, i.e. they can be executed in most of
software versions in any processor under the operating systems Linux or windows.
The main objective of this chapter consists in presenting an efficient alternative of
developing a script program in the MATLAB environment; the program can generate
characteristic curves power vs. voltage (PV curves) of each node in a power system. The
curves are used to analyze and evaluate the stability voltage limits in steady state, and they
are calculated by employing an algorithm known as continuous load flows, which are a
variation of the Newton-Raphson formulation for load flows but it avoids any possibility of
singularity during the solution process under a scenario of continuous load variation. To
illustrate the application of this analysis tool, the 14-node IEEE test system is used to
www.intechopen.com
268
generate the PV curves. The code presented allows any modification throughout its script
file and therefore it can be used for future power system studies and research.
The formulation of the load flow problem is firstly presented to obtain the PV curves, there are
some issues that need to be taken into account in the algorithm oriented to the solution of load
flows such as: mathematical formulation of the load flow, its adaptation to the NewtonRhapson method and the implementation of the continuation theory to the analysis of load
flows. It is also presented the necessary programming issues to the development of the script
that plots the PV curves, the recommendations that are needed in the creation, manipulation
and operation of sparse matrices, the use of vector operations, triangular decompositions
techniques (that used in the solution of the set on linear equations) and finally the reading of
ascii files and Graphical User Interface (GUI) development are also given.
1.1 Antecedents
Nowadays there are commercial programs which have been approved and used for the
electric utilities in the analysis of electric power systems. Simulation programs as the Power
World Simulator (PWS) (PowerWorld Corporation, 2010) and PSS (Siemens, 2005) are some
of the most popular in the control and planning of a power system, and some of them are
adopted by universities, e.g. PWS, because of its elegant interface and easy usage. Most of
them have friendly user interfaces. On the other hand, a bachelor or graduate student, who
want to reproduce or test new problem formulations to the solution of power system
problems, need a simulation tool suitable for the generation of prototype programs. The
code reutilization is important for integrating in a modular form, new functions required for
the power system analysis (Milano, 2010). Commercial programs does not fulfill these
requirements and therefore a search for alternatives is usually carry out, such as a new
programming language or for the scientific language MATLAB. It is possible to find open
source projects in several websites, which are usually named as Toolbox by their authors,
and they cover a vast diversity of topics as: load flows, transient stability analysis, nodal
analysis, and electromagnetic transients. Some of most relevant projects and its authors are:
PSAT by Federico Milano (Milano, 2006), MatPower by Zimmerman, Carlos E. MurilloSnchez and Deqiang Gan (Zimmerman et al., 2011), PST by Graham Rogers, Joe H. Chow
and Luigi Vanfretti (Graham et al., 2009) and MatEMTP by Mahseredjian, J. Alvarado and
Fernando L. (Mahseredjian et al., 1997).
Similar projects have been developed at the Instituto Tecnolgico de la Laguna (ITL) and
they have been the basis for several MSc theses which have been integrated into the power
system program PTL (figure 1). These projects have made possible the incorporation of new
applications making a more flexible and robust program for the steady-state analysis of an
electric power system.
www.intechopen.com
269
www.intechopen.com
270
Structure
Dat_Vn
Dat_Gen
Field
Description
Amp
Voltage magnitude
Ang
NumNG
Nslack
Slack node
V_Rem_bus
Voltage information
Pgen
Qgen
Pmin
Pmax
Qmin
Qmax
3. Load flows
In a practical problem, the knowledge of the operating conditions of an electric power
system is always needed; that is, the knowledge of the nodal voltage levels in steady-state
under loaded and generating conditions and the availability of its transmission elements are
required to evaluate the system reliability. Many studies focused to the electric power
systems start from the load flow solution which is known as base case, and in some cases,
these studies are used to initialize the state variables of dynamic elements of a network
(generators, motors, SVC, etc) to carry out dynamic and transient stability studies. Another
study of interest, that it also requires starting from a base case, is the analysis of the power
system security that will be discussed in next sections.
The mathematical equations used to solve this problem are known as power flow equations,
or network equations. In its more basic form, these equations are derived considering the
transmission network with lumped parameters under lineal and balanced conditions,
similarly as the known operating conditions in all nodes of the system (Arrillaga, 2001).
www.intechopen.com
271
(1)
where IBUS is a n1 vector whose components are the electrical net current injections in the n
network nodes, VBUS is a n1 vector with the nodal voltages measured with respect to the
referenced node and YBUS is the n n nodal admittance matrix of the electrical network; it has
the properties of being symmetric and squared, and it describes the network topology.
In a real power system, the injected currents to the network nodes are unknown; what it is
commonly known is the net injected power Sk. Conceptually, Sk is the net complex power
injected to the k-th node of the electrical network, and it is determined by the product of
voltage (Vk) and the current conjugate (Ik*), where Vk and Ik are the voltages and nodal
currents at the node k, that is, the k-th elements of vectors VBUS y I BUS in (1). Once the Ik is
calculated using (1), the net complex power Sk can be expressed as:
n
Sk = Vk I k = Vk Yk ,m Vm , for k= 1,2,..n
m=1
(2)
where Yk ,m is the element (k,m) of YBUS matrix in (1). Sk can also be represented for its real
and imaginary components such as it is shown in the following expression:
Sk = Pk + jQk , for k= 1,2,..n
(3)
where Pk and Qk are the net active and reactive power injected at node k of the system,
respectively. They are defined as:
Pk = PkGen PkLoad
(4)
Qk = QkGen QkLoad
(5)
where the variables PkGen and QkGen represent the active and reactive powers respectively.
They are injected at node k for a generator and the variables PkLoad and QkLoad represent the
active and reactive Powers, respectively of a load connected to the same node.
By representing the nodal voltages in polar form, we have:
Vk = Vk e jk = Vk ( cos k + j sin k )
(6)
www.intechopen.com
(7)
272
m=1
(8)
for k= 1,2,..n
*
Vm ( GkmCos( k m ) + BkmSin( k m ))
n
Pk = Vk2Gkk + Vk
for k= 1,2,..n
(9)
m=1
mn
Qk = Vk2 Bkm + Vk
(10)
m=1
mn
The equations (9) and (10) are commonly known as Power flow equations and they are needed
for solving the load flow problem (Arrillaga, 2001). By analyzing these equations it can be
clearly seen that each system node k is characterized for four variables: active power, reactive
power, voltage magnitude and angle. Hence it is necessary to specify two of them and
consider the remaining two as state variables to find with the solution of both equations.
3.2 Bus types in load flow studies
In an electrical power network, by considering its load flow equations, four variables are
defined at each node, the active and reactive powers injected at node Pk and Qk , and the
magnitude and phase voltage at the node Vk y k . The latter two variables determine the
total electrical state of the network, then, the objective of the load flow problem consists in
determining these variables at each node. The variables can be classified in controlled
variables, that is, its values can be specified and state variables to be calculated with the
solution of the load flow problem. The controlled or specified variables are determined by
taking into account the node nature, i.e. in a generator node, the active power can be
controlled by the turbine speed governor, and the voltage magnitude of the generator node
can be controlled by the automatic voltage regulator (AVR). In a load node, the active and
reactive power can be specified because its values can be obtained from load demand
studies. Therefore, the system nodes can be classified as follows:
Generator node PV: It is any node where a generator is connected; the magnitude voltage
and generated active power can be controlled or specified, while the voltage phase
angle and the reactive power are the unknown state variables (Arrillaga, 2001).
Load node PQ: It is any node where a system load is connected; the active and reactive
consumed powers are known or specified, while the voltage magnitude and its phase
angle are the unknown state variables to be calculated (Arrillaga, 2001).
Slack node (Compensator): In a power system at least one of the nodes has to be selected
and labeled with this node type. It is a generating node where it cannot be specified the
generated active power as in the PV node, because the transmission losses are not known
beforehand and thus it cannot be established the balance of active power of the loads and
www.intechopen.com
273
generators. Therefore this node compensates the unbalance between the active power
between loads and generating units as specified in the PQ and PV nodes (Arrillaga, 2001).
3.3 Solution of the nonlinear equations by the Newton-Rhapson method
The nature of the load flow problem formulation requires the simultaneous solution of a set
of nonlinear equations; therefore it is necessary to apply a numerical method that
guarantees a unique solution. There are methods as the Gauss-Seidel and Newton-Rhapson,
in the work presented here, the load flow problem is solved with the Newton-Raphson (NR)
(Arrillga, 2001).
The NR method is robust and has a fast convergence to the solution. The method has been
applied to the solution of nonlinear equations that can be defined as,
f (x) = 0
(11)
f(x ) = [ f 1 ( x ), f 2 ( x ), , f n ( x )]
(12)
x = [ x1 , x2 , , xn ]
(13)
The numerical methods used to solve (11) are focused to determine a recursive
formula x k + 1 = x k + x . The solution algorithm is based in the iterative application of the
above formula starting from an initial estimate x 0 , until a convergence criterion is achieved
max ( x ) < , where is a small numerical value, and the vector x k is an approximation to
k
the solution x of (11).
The Newton-Raphson method can be easily explained when it is applied to an equation of a
single state variable (Arrillaga, 2001). A geometrical illustration of this problem is shown in
figure 2.
www.intechopen.com
274
f (x)
f (x)
= k
dx x k
x
(14)
where,
1
x k = ( f '( x k ) ) f ( xk )
(15)
(16)
where
f 1 ( x )
x
1
f 2 ( x )
f( x k )
= x1
J( x k ) =
x
f n ( x )
x
1
f 1 ( x )
f 1 ( x )
x2
xn
f 2 ( x )
f 2 ( x )
x2
xn
f n ( x )
f n ( x )
x2
xn
(17)
(18)
mn
Qkesp
n
2
mn
for k= 1,2,..n
www.intechopen.com
(4)
(5)
275
The 2n equations to be solved are represented by (4) and (5). However, for all generator
nodes, equation (5) can be omitted and for the slack node the equations (4) and (5)
(Arrillaga, 2001). The resulting set of equations is consistent because for the neglected
equations, its corresponding state variables P esp , Q esp are also omitted from them. All this
operation gives as a result a set of equations to solve, where its state variables x only
contain magnitudes of nodal voltages and its corresponding phase angles which are
denoted by V y , which simplifies considerably a guaranteed convergence of the numerical
method. Therefore, the set of equation can be represented in vector form as,
P( x )
f (x) =
=0
Q( x )
(19)
where P( x ) represents the equation (4) for PV and PQ nodes, Q( x ) represents the
equation (5) for PQ nodes and x denotes the state variables V and , which are represented
in vector notation as:
x=
V
(20)
where:
V = ncx1 vector.
= nc+n-1 vector.
nc = Number of PQ nodes.
n = Total number of nodes.
Considering equation (16), its matrix equation is obtained and it defines the solution of the
load flow problem:
P P
V
V = Q Q
V
xk
P
Q
(21)
f(xk )
J( x )
By applying the recursive equation (18), the state variables (V y ) are updated every
iteration until the convergence criterion is achieved max( P( x ) ) or max( Q( x ) ) for
a small or until the iteration number exceeds the maximum number previously defined
which in this indicates convergence problems.
The Jacobian elements in (21) are,
P
(22)
They are calculated using (19), however, by taking into account that the specified powers
Pkesp are constants, we obtain,
P
P
=
www.intechopen.com
(23)
276
P
V
Q V
V
(24)
where the Jacobian elements are calculated using equations (9) and (10), provided equation
(21) is normalized.
To simplify the calculation of the Jacobian elements of (24), it can be reformulated as:
P H N
V
Q J L
V
(25)
where the quotient of each element with its corresponding element V allows that some
elements of the Jacobian matrix can be expressed similarly (Arrillaga, 2001). The Jacobian
can be formed by defining four submatrixes denoted as H, N, J and L which are defined as,
If km (off diagonal elements):
H km =
Pk
= VkVm ( Gkmsin km Bkm cos km )
m
N km = Vk
J km =
Pk
= VkVm ( Gkm cos km + Bkm sin km )
Vm
Qk
= VkVm ( Gkm cos km + Bkm sin km )
m
Lkm = Vk
Pk
= VkVm ( Gkm sin km Bkm cos km )
Vm
(26)
(27)
(28)
(29)
H kk =
Pk
= Qk BkkVk2
k
(30)
Pk
= Pk + GkkVk2
Vk
(31)
N kk = Vk
J kk =
Qk
= Pk GkkVk2
m
Lkk = Vk
www.intechopen.com
Pk
= Qk BkkVk2
Vm
(32)
(33)
277
0 0
0 Y11 Y12
0 Y21 Y22
Vn Yn 1 Yn 1
Y1n V1 0
Y2 n 0 V1
Ynn 0 0
Vn
(34)
By simple inspection of (34), we can see that the operation for N km and J km results to be
the real part of (34), while H km and Lkm are the imaginary component of it. The variant
consists that all elements of the principal diagonal are calculated after (34) has been solved
by subtracting or adding the corresponding Pk or Qk as it can be seen in (30)-(33).
The Jacobian matrix has the characteristic of being sparse and squared with an order of the
length of vector X, where its sub-matrixes have the following dimensions:
H: n-1 x n-1 matrix.
N: n-1 x nc matrix.
J: nc x n-1 matrix.
L: nc x nc matrix.
www.intechopen.com
278
Load increment.
www.intechopen.com
279
stability voltage limits. However, the Jacobian used in the load flows, when the NewtonRaphson is employed, becomes singular at the critical point, besides the load flow solutions
at the points near to the critical region tend to diverge (Kundur, 1994). These disadvantages
are avoided by using the method of continuation load flows (Venkataramana et al, 1992).
Fig. 3. PV curve
4.5 Application of the continuation method to the power flow problem
The continuous load flow procedure is based in a reformulation of the equations of the load
flow problem and the application of the continuation technique with a local
parameterization which has shown to be efficient in the trajectory plotting of PV curves.
The purpose of continuous load flows is to find a set of load flow solutions in a scenario
where the load is continuously changing, starting from a base case until the critical point.
Thereafter, the continuous load flows had been applied to understand and evaluate the
problem of voltage stability and those areas that are likely to the voltage collapse. Besides,
they have also been applied in other related problems like the evaluation of power transfer
limits between regions.
The general principle of continuous load flows employs a predictor-corrector scheme to find
a trajectory of solutions for the set of load flow equations (4) and (5) which are reformulated
to include the load parameter .
www.intechopen.com
(35)
(36)
1 crtic
(37)
280
The process is started from a known solution and a predictor vector which is tangent to the
corrected solutions is used to estimate the future solutions with different values of the load
parameter. The estimation is corrected using the same technique of the Newton-Rhapson
employed in the conventional load flow with a new added parameter:
f ( , V, ) = 0
(38)
The parameterization plays an important role in the elimination of the Jacobian nonsingularity.
4.5.1 Prediction of the new solution
Once the base solution has been found for =0, it is required to predict the next solution
taking into consideration the appropriate step size and the direction of the tangent to the
trajectory solution. The first task in this process consists in calculating the tangent vector,
which is determined taking the first derivative of the reformulated flow equations (38).
df( , V , ) = f d + fV dV + f d = 0
(39)
where F is the vector [P, Q, 0] that is augmented in one row; in a factorized form, the
equation is expressed as,
[ f
fF
d
f ] dV = 0
d
(40)
The left hand side of the equation is a matrix of partial derivatives that multiplies the
tangent vector form with differential elements. The matrix of partial derivatives is known as
the Jacobian of the conventional load flow problem that is augmented by the column F,
which can be obtained by taking the partial derivatives with respect to (35) and (36), which
gives:
d
esp
P H N P dV
=
esp
Q J L Q V
d
(41)
Due to the nature of (41) which is a set of nc+n-1 equations with nc+n unknowns and by
adding to the load flow equations, it is not possible to find a unique and nontrivial
solution of the tangent vector; consequently an additional equation is needed.
This problem is solved by selecting a magnitude different from zero for one of the
components of the tangent vector. In other words, if the tangent vector is denoted by:
d
t = dV = 0, t k = 1
d
www.intechopen.com
(42)
H N P esp
0
J L Q esp t =
1
ek
281
(43)
where ek is a vector of dimension m+1 with all elements equal to zero but the k-th one,
which is equal to 1. If the index k is correctly selected, tk = 1 impose a none zero norm to
the tangent vector and it guarantees that the augmented Jacobian will be nonsingular at the
critical point (Eheinboldt et al, 1986). The usage of +1 or -1 depends on how the k-th state
variable is changing during the trajectory solution which is being plotted. In a next section
of this chapter, a method to select k will be presented. Once the tangent vector has found the
solution of (43), the prediction is carried out as follows:
d
V = V + dV
d
(44)
where * denotes the prediction for a future value of (the load parameter) and is a
scalar that defines the step size. One inconvenient in the control of the step size consists in
its dependence of the normalized tangent vector (Alves et al, 2000),
0
t
(45)
where |tk| is the Euclidian norm of the tangent vector and 0 is a predefined scalar. The
process efficiency depends on making a good selection of 0, which its value is system
dependant.
4.5.2 Parameterization and corrector
After the prediction has been made, it is necessary to correct the approximate solution.
Every continuation technique has a particular parameterization that gives a way to identify
the solution along the plotting trajectory. The scheme here presented is referred as a local
parameterization. In this scheme, the original set of equations is augmented with one extra
equation, which has a meaning of specifying the value of a single state variable. In the case
of the reformulated equations, this has a meaning of giving a unity magnitude to each nodal
voltage, the phase angle of the nodal voltage or the load parameter . The new set of
equations involves the new definition of state variables as:
x = V
(46)
where,
xk =
www.intechopen.com
(47)
282
where x k x and represent the appropriate k-th element of x. Therefore, the new set of
equations that substitute (38) is given by,
F( x )
x = 0
k
(48)
After an appropriate index k has been selected and its corresponding value of , the load
flow is solved with the slightly modified Newton Raphson method (48). In other words, the
k index used in the corrector is the same as that used in the predictor and is equal to the
obtained xk from the corrector (44), thus the variable xk is the continuation parameter.
The application of the Newton-Raphson to (38) results in,
H N P esp P
M L Q esp V = Q
0
ek
(49)
where ek is the same vector used in (43), and the elements P and Q are calculated from
(35) and (36). Once the xk is specified in (48), the values of the other variables are dependant
on it and they are solved by the iterative application of (49).
4.5.3 Selection of the continuation parameter
The most appropriate selection corresponds to that state variable with the component of the
tangent vector with the largest rate of change relative to the given solution. Typically, the
load parameter is the best starting selection, i.e. =1. This is true if the starting base case is
characterized for a light or normal load; in such conditions, the magnitudes of the nodal
voltages and angles keep almost constants with load changes. On the other hand, when the
load parameter has been increased for a given number of continuation steps, the solution
trajectory is approximated to the critical point, and the voltage magnitudes and angles
probably will have more significant changes. At this point, has had a poor selection as
compared with other state variables. Then, once the first step selection has been made, the
following verification must be made:
t
x k max 1
x1
t2
x2
tm 1
xm 1
tm
xm
(50)
where m is equal to the state variables; including the load parameter and k corresponding to
the maximum t/x component. When the continuation parameter is selected, the sign of the
corresponding component of the tangent vector must be taken into account to assign +1 or 1 to tk in (42) for the subsequent calculation of the tangent vector.
www.intechopen.com
283
possible to point it out several advantages considered as key points for the development of a
script program, which are discussed below.
5.1 Sparse matrix manipulation
The electrical networks are studied using nodal analysis, as it was presented in section 3.1.
In this frame of reference, the network matrixes as Ybus or Jacobian (1) and (21) have a
sparse structure, considering that a node in an electrical network is connected to about 2.4
nodes in average. To illustrate this issue, if we consider the creation of a squared matrix
with order 20, i.e. the matrix has 200 elements which 256 are zeros and the remaining are
different from zero that are denoted as nz, as it is shown in figure 4. The sparsity pattern is
displayed by using the MATLAB function spy.
www.intechopen.com
284
MATLAB has a function called spdiags that is intended for the direct operation on any
diagonal of the matrix, e.g. to make uniform changes on the elements of the diagonal d of
matrix A:
>> A = spdiags(B, d, A)
A mechanism frequently used to form matrixes from other defined ones is called the
concatenation. Even more, to form sparse matrixes by using other arrays of the same type
but with specified dimensions in such a way that there is a consistency to gather into a
single one, i.e. the concatenating is horizontal, the matrix rows must be equal to those of B
matrix, e.g. C = [A B]. On the other hand, if the concatenating is vertical, then the columns
of both matrices must be equal, e.g. C = [A; B].
5.2 The LU factorization for solving a set of equations
In electrical network applications, to find a solution of the algebraic system Ax = b in an
efficient way, one option is to use the triangular decomposition as the LU factorization
technique.
The triangular factorization LU consists in decomposing a matrix (A) such that it can be
represented as the product of two matrixes, one of them is a lower triangular (L) while the
other is an upper triangular (U), A = L U . This representation is commonly named explicit
factorization LU; even though it is very related to the Gaussian elimination, the elements of
L and U are directly calculated from the A elements, the principal advantage with respect to
the Gaussian elimination (Gill et al., 1991) consists in obtaining the solution of an algebraic
system for any b vector, if and only if the A matrix is not modified.
5.3 Sparse matrix ordering using AMD
The Approximate minimum degree permutation (AMD) is a set of subroutines for row and
column permutation of a sparse matrix before executing the Cholesky factorization or for the
LU factorization with a diagonal pivoting (Tim, 2004). The employment of this subroutine is
made by using the function amd to the matrix to be permuted, e.g. P = amd(A).
5.4 Sparse matrix operations
Care must be taken with a several rules in MATLAB when operations are carried out that
include full and sparse matrixes, for example, the operation eye(22) + speye(22) gives a full
matrix.
5.5 Vector operations
An approach to develop the script programs in MATLAB to be executed faster consists in
coding the algorithms with the use of vectors within the programs and avoiding the use of
loops such as for, while and do-while. The vector operations are made by writing the symbol
. before the operation to be made, e.g. .+, .-, .*, ./. This discussion is illustrated by
comparing two MATLAB script programs to solve the following operation:
C 1 A1 B1
C A B
2 = 1 2
C n An Bn
www.intechopen.com
285
**************
www.intechopen.com
286
www.intechopen.com
********************
www.intechopen.com
287
288
******
www.intechopen.com
www.intechopen.com
289
290
end
%% ** GRAPHICAL INTERFACE FOR DISPLAYING THE PV CURVES **
PV_PRINT( Carga, Vpredict, Vexact );
%% *********************** Nested functions ***********************
function [P Q] = scmplx()
Vfasor = Vabs.*exp(1j*Tetan);
% Complex form of nodal voltage using Euler.
Scal = Vfasor.*conj(Ynodo*Vfasor); % Calculation of complex power as in (8).
P = real(Scal); % Net active power injected to each node as in (9).
Q = imag(Scal); % Net reactive power injected to each node as in (10).
end
function Jac = Jacob()
www.intechopen.com
291
www.intechopen.com
292
standardized format with the extension cdf (Common Data Format) (University of
Washington electrical engineering, 1999). The reading of the complete information is
achieved by using the MATLAB function textread. The reading includes the use of a
standard uicontrol of MATLAB to locate the file path. This information is stored in a data
matrix of string type, and it can be interpreted by using functions that operate on the
variables of string type. There is basic information that is used in the developed program;
the variables can be divided into two categories:
Nodal information:
Sbase : Base power of the system.
Nnod : Number of system nodes.
No_B : nx1 vector with the numbering of each system bus.
Name_B : nx1 vector with the name of each bus system.
Tipo : nx1 vector with the node type of the system.
Nslack : The number of the slack node.
Vn : nx1 vector with voltage magnitudes at each system node.
Vbase : nx1 vector with base values of voltages at each system bus.
Tetan : nx1 vector with phase angles at each nodal voltage.
PLoad and QLoad : nx1 vector with the active and reactive load powers, respectively.
Pgen and Qgen : (n-nc)x1 vector with the active and reactive power of generators,
respectively.
Gc and Bc : nx1 vector with conductance and susceptance of each compensating element,
respectively.
Branch information (transmission lines and transformers), where l denotes the total number
of transmission lines and t is the number of transformers in the electrical network:
PLi and PTr : Vectors with dimensions lx1 y tx1, that indicate one side of transmission lines
and transformers connected to the P node, respectively.
QLr and QTr : They are similar as PL and PT with the difference that indicates the opposite
side of the connected branch to the Q node.
RbrL and RbrX : They are similar as the above two variables with the difference that
indicate the resistance of each transmission line and transformer.
XbrL and XbrX : They are similar as the above with the difference that indicate the
reactance of each transmission line and transformer.
Blin : lx1 vector with the half susceptance of a transmission line.
TAP : tx1 vector with the current position of the TAP changer of the transformer.
After reading the input data, the admittance matrix Ynode, and a series of useful pointers
are created to extract particular data from the nodal and branch data:
NumCG: An array that points to all nodes but the slack node.
Tol_NR the maximum deviations in power are lower to this value in case of convergence - and
Max_Iter is the maximum number of iterations these variables are used to control the
convergence and a value is assigned to them by default after reading of input data.
The program does not consider the checking of limits of reactive power in generator
nodes neither the effect of the automatic tap changer in transformers, nor the inter-area
www.intechopen.com
293
power transfer, etc. Therefore the input data related to these controllers is not used in the
program.
6.2 Graphical interface for editing the display of PV curves
In the last part of the program, a graphical user interface (GUI) is generated for the plotting
of PV curves from the points previously calculated in the continuous load flows program.
Even though the main objective of this interface is oriented to the plotting of PV curves, its
design allows the illustration continuation method process, i.e. it has the option of
displaying the calculated points with the predictor, corrector or both of them, for example, it
can be seen in figure 5 the set of points obtained with the predictor-corrector for the nodes
10,12,13, and 14 of the 14-node IEEE test power system. This is possible by integrating the
MATLAB controls called uicontrols into the GUI design, the resultant GUI makes more
intuitive and flexible its use.
The numbers 1-12, that are indicated in red color in figure 5, make reference to each
uicontrol or graphical object that integrates the GUI. The graphical objects with its uicontrol
number, its handle and its description are given in table 1.
www.intechopen.com
294
Uicontrol number
handle
Description
hPV
hPanel_print
hAxes_Curve
hPanel_control
hPanel
hlb_log
hlb_txt
hChoice_PV
opt0
10
opt1
11
opt2
12
- without handle-
Table 1. Description of each graphical object used in the GUI shown in figure 5.
The complete code of the function that generates the GUI is presented below, where the
code lines for creating each graphical object mentioned in table 1 are fully described.
function PV_PRINT(lambda, predictor, corrector )
[Nodos columnas] = size(predictor);
clear columnas;
etiqueta = {};
% Variable for registering the elements of listbox that relates the system nodes, which can
have plotted its PV curve
for ii = 1:Nodos
etiqueta{ii, 1} = ['Node ' num2str(ii)];
end
% Variables for configuring the graphical object, color and screen size.
BckgrClr = get(0, 'defaultUicontrolbackgroundColor');
Sc_Sz = get(0, 'ScreenSize');
wF = 0.85;
hF = 0.85;
wF_Pix = wF*Sc_Sz(3);
hF_Pix = hF*Sc_Sz(4);
% Creation of the object type figure: main window.
hPV = figure(...
'Name', 'Graphic tool', ...
'units', 'normalized', 'Color', BckgrClr,...
www.intechopen.com
295
www.intechopen.com
296
www.intechopen.com
297
www.intechopen.com
298
axis(hAxes_Curve, 'auto');
% Labeling of X and Y axes.
xlabel(hAxes_Curve, 'Load increment (% PU)', 'FontSize', 10);
ylabel(hAxes_Curve, 'Nodal voltage (PU)', 'FontSize', 10);
% The object becomes visible with the handle hAxes_Curve.
set(hAxes_Curve, 'Visible', 'on');
end
Since the function PV_PRINT is external to the function main, the created variables within
main cannot be read directly for the function PV_PRINT, hence it is required to declare
arguments as inputs for making reference to any variable in main. The main advantage of
using external functions consists in the ability to call them in any application just by giving
the required arguments for its correct performance. In order to reproduce this application, it
is necessary to copy the code in an m-file which is different from the main.
7. Conclusion
An electrical engineering problem involves the solution of a series of formulations and
mathematical algorithm definitions that describe the problem physics. The problems related
to the control, operation and diagnostic of power systems as the steady-state security
evaluation for the example the PV curves, are formulated in matrix form, which involves
manipulation techniques and matrix operations; however the necessity of operating on
matrixes with large dimensions takes us to look for computational tools for handling
efficiently these large matrixes. The use of script programming which is oriented to
scientific computing is currently widely used in the academic and research areas. By taking
advantage of its mathematical features which are normally found in many science or
engineering problems allows us solving any numerical problem. It can be adapted for the
development of simulation programs and for illustrating the whole process in finding a
solution to a defined problem, and thus makes easier to grasp the solution method, such as
the conventional load flow problem solved with the Newton-Raphson method.
MATLAB has demonstrated to be a good tool for the numerical experimentation and for the
study of engineering problems; it provides a set of functions that make simple and
straightforward the programming. It also offers mechanisms that allow dealing with
mathematic abstractions such as matrixes in such a way that is possible to develop
prototype programs which are oriented to the solution methods by matrix computations.
The development of scripts or tools can be considered to be a priority in the academic area
such that they allow achieving a valid solution. It is also advisable to take advantage of the
MATLAB resources such as: vector operations, functions and mechanisms for operating on
each matrix element without using any flow control for the program, i.e. for loop; this offers
the advantage of decreasing the number of code lines of the script program. These
recommendations reduce the computation time and allow its easy usage and modification
by any user. Finally, MATLAB offers powerful graphical tools which are extremely useful
for displaying the output information and to aid interpreting the simulation results. In this
chapter, the plotting of the corrector points (PV curve) has been presented for a given load
www.intechopen.com
299
that can be considered as critical point or voltage collapse of the power system. The
technique for continuous load flow has been applied to determine the PV curves of the 14node IEEE test system, and it has been shown that a 4.062% load increment can lead to the
instability of the system, and it also has been determined that the node 14 is the weaker
node of the system.
8. References
Arrillaga, J. & Walsion,N. (2001). Computer Modeling of electrical Power Systems (2th), Whyley,
ISBN 0-471-87249-0.
D. A. Alves, L. C. P. Da Silva, C. A. Castro, V. F. da Costa, Continuation Load Flor Method
Parametrized by Transmissin Line Powers, Paper 0-7801-6338-8/00 IEEE 2000
Garcia, J., Rodriguez, J.& Vidal, J. (2005). Aprenda Matlab 7.0 como si estuviera en primero,
Universidad Politcnica de Madrid, Retrieved from
http://mat21.etsii.upm.es/ayudainf/aprendainf/Matlab70/ matlab70primero.pdf
Gill, P., Murray, W. & Wrigth M., (1991). Nuemric linear Algebra and optimization vol 1 (ed),
Addison-wesley, ISBN 0-201-12647-4, Redwood City, US
Graham, R., Chow, J., &, Vanfretti, L. (2009). Power System Toolbox, In: Power System
Toolbox Webpage, 15.03.20011, Available from: http://www.ecse.rpi.edu/pst/
Kundur, P. (1994). Voltage Stability, Power System stability and control, pp. 959-1024, Mc Graw
Hill, ISBN 0-07-035959-X, Palo Alto, California
Mahseredjian, J., & Alvarado, F. (1997). MatEMTP, In: Creating an electromagnetic
transients program in MATLAB, Available: 15.013.2011,
http://minds.wisconsin.edu/handle/1793/9012
M. G. Ogrady, M. A. Pai, Analysis of Voltage Collapse in Power Systems, Proceedings of
21st Annual North American Power Symposium, Rolla, Missouiri, October 1999ric
Manufacturers Association, Washington, D.C.
Milano, F. (2010). Power system modelling and scripting (1th), Springer, ISBN 9-783-642-136696, London, ___
Milano, F. (2006). PSAT, In: Dr. Federico Milano Website, 15.03.2011,
http://www.power.uwaterloo.ca/~fmilano/psat.htm
PowerWorld Corporation (2010). http://www.powerworld.com
Siemens, PTI. (2005).
http://www.energy.siemens.com/us/en/services/powertransmissiondistribution/power-technologies-international/softwaresolutions/pss-e.htm
Tim, D. (2004), Research and software development in sparse matrix algorithms, In: AMD,
12.03.2011, Available from http://www.cise.ufl.edu/research/sparse/amd/
Venkataramana, A. (2007). Power Computational Techniques for Voltage Stability Assessment and
Control (1th), Springer, ISBN 978-0-387-26080-8.
Venkataramana Ajjarapu, Colin Christy, The Continuation Power flor: A Tool for Steady
State Voltaje Stability Analysis, Transactions on Power Systems, Vol. 7, No. 1,
Fabruary 1992
W. C. Eheinboldt, J. B. Burkhardt, A Locally Parametrized Continuation Process, ACM
Transactions on Mathematical Software, Vol. 9 No. 2, June 1986, pp. 215-235.
University of Washington electrical engineering. (1999). 14 Bus, In: Power Systems Test Case
Archive, 25.01.2011, Available from
http://www.ee.washington.edu/research/pstca/.
www.intechopen.com
300
www.intechopen.com
ISBN 978-953-307-914-1
Hard cover, 512 pages
Publisher InTech
How to reference
In order to correctly reference this scholarly work, feel free to copy and paste the following:
Ricardo Vargas, M.A Arjona and Manuel Carrillo (2011). PV Curves for Steady-State Security Assessment with
MATLAB, MATLAB for Engineers - Applications in Control, Electrical Engineering, IT and Robotics, Dr. Karel
Perutka (Ed.), ISBN: 978-953-307-914-1, InTech, Available from: http://www.intechopen.com/books/matlabfor-engineers-applications-in-control-electrical-engineering-it-and-robotics/pv-curves-for-steady-state-securityassessment-with-matlab
InTech Europe
InTech China