You are on page 1of 17

246

APPENDIX 1
SWING EQUATION

The tendency of a power system to develop restoring forces equal


to or greater than the disturbing forces to maintain the state of equilibrium is
known as STABILITY. Steady State stability of the power system is
analyzed by the swing equation of a synchronous machine. It represents the
swings in the rotor angle

during disturbances. The change in the rotor angle

results in change in real power, which ultimately affects the frequency.


Hence swing equation forms the basis for modeling of load frequency control
(LFC) loop of the power system. Swing equation is a rotational inertia
equation describing the effect of unbalance between the electromagnetic
torque and the mechanical torque of the individual machines.
Under normal operating conditions, the relative position of the
rotor axis and the resultant magnetic field axis is fixed. The angle between the
two axis is known as the power angle or torque angle. During any
disturbance, rotor will decelerate or accelerate with respect to the
synchronously rotating air gap mmf and thereby developing relative motion.
The equation describing this relative motion is known as swing equation.
After this oscillatory period, the rotor locks back into synchronous speed, the
generator will maintain its stability. If the disturbance does not involve any
net change in power, the rotor returns to its original position. If the
disturbance is created by a change in generation, load, or in network
conditions, the rotor comes to a new operating power angle relative to the
synchronously revolving field. In this section the equation describing the

247

relative motion called swing equation is derived for easy modeling of power
system components.
The power angle

is the angle between the rotor mmf Fr and the

resultant air gap mmf Fsr, both rotating at synchronous speed. The angle
between the no-load generated emf E and the resultant stator voltage Esr is
also called as power angle. If the generator armature resistance and leakage
flux are neglected, the angle between E and terminal voltage V, denoted by ,
is considered as the power angle.
Consider a synchronous generator developing an electromagnetic
torque Te and running at the synchronous speed

sm.

If Tm is the driving

mechanical torque, then under steady state operation with losses neglected,
equation (1) is obtained.
Tm=Te

(A1.1)

A departure from steady state due to a disturbance results in an


accelerating (Tm<Te) torque Ta on the rotor
Ta=Tm-Te

(A1.2)

If J is the combined moment of inertia of the prime mover and


generator, neglecting frictional and damping torques, from laws of rotation,
Equation (A1.3) is obtained

d2 m
J 2
dt
where

Ta

Tm

Te

(A1.3)

is the angular displacement of the rotor with respect to the

stationary reference axis on the stator. Since the rotor speed is important, the

248

angular reference is chosen relative to a synchronously rotating reference


frame moving with constant angular velocity
m

where

sm

t+

sm,

that is
(A1.4)

is the rotor position before disturbance at time t=0, measured from

the synchronously rotating reference frame. Derivative of Equation (A1.4)


gives the rotor angular velocity

d m
dt

d m
dt

ms

(A1.5)

And the rotor acceleration is

d2 m
dt 2

d2 m
dt 2

(A1.6)

Substituting (A1.6) into (A1.3), Equation (A1.7) is obtained

d2 m
dt 2

Tm

Te

(A1.7)

Multiplying (A1.7) by

d2 m
dt 2

Tm

m, results

in

Te

(A1.8)

Since angular velocity times torque is equal to power, writing the


Equation (A1.8) in terms of power results in Equation (A1.9).

d2 m
dt 2

Pm

Pe

(A1.9)

249

The quantity J

is called the inertia constant and it is related to

kinetic energy of rotating masses, Wk. as in equation (10).

1
J
2

Wk

2
m

1
M
2

(A1.10)

or

2 Wk

(A1.11)

Although M is called inertia constant, it is not really constant when


the rotor speed deviates from the synchronous speed. However, since

does

not change by a large amount before stability is lost, m is evaluated at the


synchronous speed and is considered to remain constant, i.e.,

2 Wk

(A1.12)

sm

The swing equation in terms of the inertia constant becomes

d2 m
M 2
dt

Pm

Pe

(A1.13)

It is more convenient to write the swing equation in terms of the


electrical power angle

. If p is the number of poles of a synchronous

generator, the electrical power angle


angle

as in Equations (A1.14) and (A1.15),

p
2
and

is related to the mechanical power

(A1.14)

250

p
2

(A1.15)

Swing equation in terms of electrical power angle is

p d2 m
M 2
2
dt

Pm

Pe

(A1.16)

Since power analysis is done in per unit system, the swing equation
is usually expressed in per unit. Dividing Equation (A1.16) by the base power
SB, and substituting for M from Equation (A1.12) results in

2 2 Wk d 2
p sm S B dt 2

Pm
SB

Pe
SB

(A1.17)

Equation (A1.18) represents Per unit inertia constant or H constant

Wk
SB

kinetic energy in MJ at rated speed


machine rating in MVA

(A1.18)

The value of H ranges from 1 to 20 seconds, depending on the size


and type of machine. Substituting in Equation (A1.17), Equation (A1.19) is
obtained.

2 2H d 2
p sm dt 2
where Pm

(pu)

and Pe

Pm ( pu )

(pu)

(A1.19)

Pe ( pu )

are the per unit mechanical power and electrical

power, respectively. The electrical angular velocity is related to the


mechanical angular velocity by

sm

= (2/P)

s.

Hence, Equation (A1.19) is

expressed in terms of electrical angular velocity as

251

2H d 2
2
s dt

Pm ( pu )

(A1.20)

Pe ( pu )

The Equation (A1.20) is often expressed in terms of frequency f0,


and to simplify the notation, the subscript pu is omitted and the powers are
understood to be in per unit.

2H d 2
f 0 dt 2
where,

Pm

(A1.21)

Pe

is in electrical radian. If

is expressed in electrical degrees, the

swing equation becomes

2H d 2
180f 0 dt 2

Pm

Pe

Equation (A1.21) represents the swing in rotor angle

(A1.22)

during

disturbances. Modeling of the generator in LFC is based on Equation (A1.21).


Random changes in load are taking place at all times, with subsequent
adjustments of generation. Synchronism frequently may be lost in that
transition period, or growing oscillations may occur over a transmission line,
eventually leading to its tripping. The LFC and AVR models are developed in
MATLAB simulink for the steady state and transient state stability analysis.

252

APPENDIX 2
MATLAB FUNCTIONS-AN OVERVIEW

MATLAB is a high-performance language for technical computing.


It integrates computation, visualization, and programming in an easy-to-use
environment where problem and solution are expressed in familiar
mathematical notation. MATLAB is an interactive system whose basic data
element is an array that does not require dimensioning. The name MATLAB
stands for matrix laboratory. The combination of analysis capabilities,
flexibility and power graphics make MATLAB the premier software package
for electrical engineers. It is mainstay of mathematical department software
lineup and also available for PCs and Macintoshes. MATLAB was originally
written to provide easy access to matrix software developed by the LINPACK
and EISPACK projects. Today MATLAB engines incorporate the LINPACK
and Basic Linear Algebra Subprograms (BLAS) libraries, embedding the state
of the art software for matrix computation.
It is extremely powerful, simple to use, and can be found in most
research and engineering environments. It gets more powerful and specialized
with the addition of toolboxes, additional functions added to the MATLAB
environment by various developers for specific tasks or fields. In this section,
the MATLAB functions used in Fuzzy, GA, PSO, ACO and HGA algorithms
are listed and their definitions are provided.
fuzzy

Basic FIS Editor.

mfedit

Membership Function Editor.

253

ruleedit

Rule Editor and parser.

ruleview

Rule Viewer and fuzzy inference diagram.

Dsigmf

Difference of two sigmoid membership functions.

trapmf

Trapezoidal membership function.

trimf

Triangular membership function.

zmfZ

shaped curve membership function.

addmf

Add a membership function to an FIS.

addrule

Add rule to FIS.

addvar

Add variable to FIS.

defuzz

Defuzzify membership function.

newfis

Create new FIS.

rmmf

Remove membership function from FIS.

rmvar

Remove variable from FIS.

setfis

Set fuzzy system properties

showrule

Display FIS rules.

writefis

Save FIS to disk.

fuzblock

Simulink fuzzy logic library.

sffis

Fuzzy inference S-function for Simulink

ga

implements the genetic algorithm at the command


line to minimize an objective function.

gaoptimget -

Get values of a genetic algorithm options structure

gaoptimset -

Create a genetic algorithm options structure

gatool

Open the Genetic Algorithm Tool

254

population type (Population Type) specifies the data type of the input to the
fitness function. Population type can be set to any one of the following:
Double Vector ('double Vector') -- Use this option if the individuals in the
population have type double.
Bit string ('bitstring') -- Use this option if the individuals in the population are
bit strings.
Custom ('custom') -- Use this option to create a population whose data type is
neither of the preceding.
Creation function (CreationFcn) -- Specifies the function that creates the
initial population for GA
Mutation function (MutationFcn) --This option is used to specify Mutation
function
Crossover function (CrossoverFcn) -- Specifies the function that performs
the crossover
Set options = gaoptimset('CreationFcn', @myfun); -- Get values of a genetic
algorithm options structure function
Population = myfun(GenomeLength, FitnessFcn, options) The input
arguments to the function are
Genomelength Number of independent variables for the fitness function
FitnessFcn -- Fitness function
options -- Options structure
The function returns Population, the initial population for the
genetic algorithm
Genomelength -- Number of independent variables for the fitness function

255

FitnessFcn -- Fitness function options


Options structure Off ('off') -- Only the final answer is displayed.
Iterative ('iter') -- Information is displayed at each iteration.
Diagnose ('diagnose') -- Information is displayed at each iteration. In
addition, options that are changed from the defaults are listed.
Final ('final') -- The outcome of the genetic algorithm (successful or
unsuccessful) the reason for stopping and the final point.
Hybrid Function Option -- A hybrid function is another minimization
function that runs after the genetic algorithm terminates. Hybrid function is
specified in Hybrid function (HybridFcn) options.
fminsearch (@fminsearch) -- Uses the MATLAB function fminsearch
patternsearch (@patternsearch) To find the minimum of a function using a
pattern search.
fminunc (@fminunc) -- Uses the Optimization Toolbox function fminunc
Generations (Generations) -- Specifies the maximum number of iterations
the genetic algorithm will perform. The default is 100.
Time limit (TimeLimit) -- Specifies the maximum time in seconds the
genetic algorithm runs before stopping.
Fitness limit (FitnessLimit) -- The algorithm stops if the best fitness value is
less than or equal to the value of Fitness limit.
Stall generations (StallGenLimit) -- The algorithm stops if there is no
improvement in the best fitness value for the number of generations specified
by Stall generations.
Stall time (StallTimeLimit) -- The algorithm stops if there is no improvement
in the best fitness value for an interval of time in seconds specified by Stall
time

256

PSOparams -

PSO parameters

P(1)

Epochs between updating display, default = 100.

if 0, no display
P(2)

Maximum number of iterations (epochs) to train, default= 2000.

P(3)

population size, default = 24

P(4)

acceleration const 1 (local best influence), default = 2

P(5)

acceleration const 2 (global best influence), default = 2

P(6)

Initial inertia weight, default = 0.9

P(7)

Final inertia weight, default = 0.4

P(8)

Epoch when inertial weight at final value, default = 1500

P(9)

minimum global error gradient, if abs(Gbest(i+1)-Gbest(i))


< gradient over

certain length of epochs, terminate run,

default = 1e-25
P(10)

epochs before error gradient criterion terminates run,


default = 150, if the SSE does not change over 250 epochs
then exit

P(11)

error goal, if NaN then unconstrained min or max, default


=NaN

P(12)

type flag (which kind of PSO to use)

0 = Common PSO

w/intertia (default) 1, 2 = Trelea types 1,2


Constricted PSO, Type 1"
P(13)

PSOseed, default=0
= 0 for initial random positions
= 1 for initial particles as user input

= Clerc's

257

MATLAB COMMANDS
matlab\general

general purpose commands.

matlab\ops

Operators and special characters.

matlab\lang

Language constructs and debugging.

matlab\elmat

Elementary matrices and matrix manipulation.

matlab\specmat

Specialized matrices.

matlab\elfun

Elementary math functions.

matlab\specfun

Specialized math functions.

matlab\matfun

matrix function-numerical linear algebra.

matlab\datafun

data analysis and Fourier transform functions.

matlab\polyfun

polynomial and interpolation functions.

matlab\graphics

general purpose graphics functions.

matlab\color

color control and lighting model functions.

matlab\sounds

sound processing functions.

matlab\strfun

character string functions.

matlab\iofun

low-level file I/O functions.

matlab\demos

the MATLAB Expo and other demonstrations.

SIMULINK
SIMULINK is an interactive environment for modeling, analyzing
and simulating a wide variety of dynamic systems. It supports linear and
nonlinear systems, modeled in continuous time, sampled time, or a hybrid of
the two. SIMULINK provides a graphical user interface for constructing
block diagram models using drag and drop operations. A system configured
in terms of block diagram representation from library of standard

258

components. A system block diagram representation is built easily and the


simulation results are displayed quickly.
Simulation algorithms and parameters can be changed in the middle
of a simulation with intuitive results, thus providing the user with a real
world. SIMULINK is particularly useful for studying the effects of nonlinearities on the behavior of the system, and as such it is also an ideal
research tool. The key features of Simulink are
1.

Interactive simulations with live display.

2.

A comprehensive block library for creating linear, nonlinear,


discrete or hybrid multi-input/output systems.

3.

Seven integration methods for fixed steps and variable step


systems.

4.

Unlimited hierarchical model structure.

5.

Scalar and vector connections.

6.

Mask facility for creating cust om blocks and block libraries.

SIMULINK provides an open architecture that allows extension of


the simulation environment:
1.

The model parameters can be changed either interactively or


in batch mode while simulation is running.

2.

Custom blocks and block libraries can be created with own


icons and user interface from MATLAB, FORTRAN, or C
code.

3.

C code from SIMULINK models can be generated for


embedded applications and rapid prototyping of control
systems.

259

4.

Hierarchical models can be created by grouping blocks into


systems.

5.

SIMULINK provides immediate access to the mathematical,


graphical and programming capabilities of MATLAB,

6.

Analysis of data, automation procedures and optimization of


parameters can be done directly in SIMULINK.

7.

The advanced design and analysis capabilities of the tool


boxes can be executed from within a simulation using the
mask facility in SIMULINK.

8.

The SIMULINK block library can be executed with special


purpose block sets.

SIMULATION PARAMETERS AND SOLVER


Parameters from the simulation menu are used for setting the
simulation parameters and selecting the solver. SIMULINK displays the
simulation parameters dialog box, which uses three pages namely solver,
work space I/O and diagnostics to manage simulation parameters.
i) Solver page
When the solver tab is selected the solver page is displayed and it
allows the following operations:
1.

Set the start and stop times-the start time and stop time for the
simulation can be changed by entering new values in the start
time and stop time fields. The default start time is 0.0 seconds
and the default stop time is 10.0 seconds.

260

2.

Choose the solver and specify solver parameters-the default


solver provides accurate and efficient results for most of the
problems. There are two types of solvers namely variable-step
solver and fixed-step solver. Variable solvers can modify their
step sizes during simulation. These are ode45, ode23, ode113,
ode15s, ode23s, discrete and the default is ode45. For variable
step solvers, the maximum and initial step size parameters can
be varied. For fixed-step solvers, ode5, ode4, ode3, ode2, ode1
and discrete can be chosen.

3.

The output options area of the dialog box enables the control
of the output generated by simulation.

ii) Workspace I/O page


The workspace I/O page manages the input from the MATLAB
workspace and the output to the MATLAB workspace. The functions of
workspace includes the following:
1.

Loading of input from the workspace can be specified either


as MATLAB command or as matrix for the import blocks.

2.

Saving the output to the workspace-return variables can be


specified by selecting the time, state, and/or output check
boxes in the save to workspace area.

iii) Diagnostic page


The diagnostic page allows selection of level of warming messages
displayed during a simulation.

261

SIMULATION PARAMETERS DIALOG BOX


The following table summarizes the actions performed by the
dialog box buttons, which appear on the bottom of each dialog box page.
BUTTON
Apply

ACTION
Applies the current parameter values and keeps the dialog box
open, during a simulation, the parameter values are applied
immediately.

Revert

Changes the parameter values back to the values they had


when the dialog box was most recently opened and applies the
parameter

Help

Displays help text for the dialog box page

Close

Applies the parameter values and closes the dialog box.


During a simulation, the parameter values are applied
immediately.

To stop the simulation, choose stop from the simulation menu. The
keyboard shortcut for stopping a simulation is CTRL T. We can suspend the
running simulation by choosing pause from the simulation menu, when we
select pause, the menu item changes to continue. We can proceed with a
suspended simulation by choosing continue.
BLOCK DIAGRAM CONSTRUCTION
The easy-to-use pull down menus allows us to create a SIMULINK
block diagram, or open an existing file, perform the simulation, and make any
modifications. Basically one has to specify the model of the system (state
space, discrete, transfer functions, non-linear codes etc) the input (source) to
the system, and where the output (sink) of the simulation of the system will

262

go. When start putting blocks together into a model, add the blocks to the
model window before adding the lines that connect them.
Block diagram is constructed to represent the digital simulator of
the single and two area interconnected power system. It is clear from the
block diagram that each area has its own control on its operation. There are
three main blocks, namely, speed governor, turbine and power system. An
intelligent controller is incorporated in each block for obtaining zero steadystate error for the deviations of both the system frequency and tie-line power.
The block diagrams can be simulated for different load and regulation values
during the course of simulation.

You might also like