You are on page 1of 55

Small Signal Stabilty Analysis Functions

in

MATNETEIG

©Graham Rogers 2000-2008 All rights reserved 1


contents

Contents

1 INTRODUCTION ...................................................................................................................... 4
1.1 LINEARIZED DEVICE MODELS .......................................................................................................... 4
1.2 FORMULATION FUNCTIONS .............................................................................................................. 4
1.3 ANALYSIS FUNCTIONS ..................................................................................................................... 4
2 FUNCTION DESCRIPTIONS................................................................................................... 5
2.1 FORMGSS ......................................................................................................................................... 5
2.1.1 Syntax ..................................................................................................................................... 5
2.1.2 Purpose................................................................................................................................... 5
2.1.3 Inputs ...................................................................................................................................... 5
2.1.4 Outputs ................................................................................................................................... 5
2.1.5 Purpose................................................................................................................................... 6
2.1.6 Calls........................................................................................................................................ 6
2.1.7 Called by................................................................................................................................. 6
2.1.8 Example .................................................................................................................................. 6
2.2 FORMUSS ......................................................................................................................................... 7
2.2.1 Syntax ..................................................................................................................................... 7
2.2.2 Purpose................................................................................................................................... 7
2.2.3 Inputs ...................................................................................................................................... 8
2.2.4 Outputs ................................................................................................................................... 8
2.2.5 Example ................................................................................................................................ 10
2.3 FULLSSM ........................................................................................................................................ 14
2.3.1 Syntax ................................................................................................................................... 14
2.3.2 Purpose................................................................................................................................. 14
2.3.3 Inputs .................................................................................................................................... 14
2.3.4 Outputs ................................................................................................................................. 14
2.3.5 Example ................................................................................................................................ 15
2.4 FULLMA ......................................................................................................................................... 19
2.4.1 Syntax ................................................................................................................................... 19
2.4.2 Purpose................................................................................................................................. 19
2.4.3 Input...................................................................................................................................... 19
2.4.4 Output ................................................................................................................................... 19
2.4.5 Example ................................................................................................................................ 19
2.5 SETIB ............................................................................................................................................. 22
2.5.1 Syntax ................................................................................................................................... 22
2.5.2 Purpose................................................................................................................................. 22
2.5.3 Input...................................................................................................................................... 22
2.5.4 Output ................................................................................................................................... 22
2.5.5 Example ................................................................................................................................ 22
2.6 SPARSEMA ..................................................................................................................................... 24
2.6.1 Syntax ................................................................................................................................... 24
2.6.2 Purpose................................................................................................................................. 24
2.6.3 Inputs .................................................................................................................................... 24
2.6.4 Outputs ................................................................................................................................. 24
2.6.5 Example ................................................................................................................................ 25
2.7 SPARSEZEROS ................................................................................................................................ 27
2.7.1 Syntax ................................................................................................................................... 27
2.7.2 Purpose................................................................................................................................. 27
2.7.3 Inputs .................................................................................................................................... 27
2.7.4 Outputs ................................................................................................................................. 27
2.7.5 Example ................................................................................................................................ 29

©Graham Rogers 2000-2008 All rights reserved 2


contents

2.8 FULLZEROS .................................................................................................................................... 32


2.8.1 Syntax ................................................................................................................................... 32
2.8.2 Purpose................................................................................................................................. 32
2.8.3 Example ................................................................................................................................ 32
2.9 FR_SPARSE .................................................................................................................................... 34
2.9.1 Syntax ................................................................................................................................... 34
2.9.2 Purpose................................................................................................................................. 34
2.9.3 Inputs .................................................................................................................................... 34
2.9.4 Outputs ................................................................................................................................. 34
2.9.5 Example ................................................................................................................................ 34
2.10 FR_FULL ........................................................................................................................................ 35
2.10.1 Syntax ................................................................................................................................... 35
2.10.2 Purpose................................................................................................................................. 35
2.10.3 Inputs .................................................................................................................................... 35
2.10.4 Outputs ................................................................................................................................. 35
2.10.5 Example ................................................................................................................................ 35
2.11 MVFR_SPARSE ............................................................................................................................... 36
2.11.1 Syntax ................................................................................................................................... 36
2.11.2 Purpose................................................................................................................................. 36
2.11.3 Inputs .................................................................................................................................... 36
2.11.4 Outputs ................................................................................................................................. 36
2.11.5 Example ................................................................................................................................ 36
2.12 SR_SPARSE .................................................................................................................................... 37
2.12.1 Syntax ................................................................................................................................... 37
2.12.2 Purpose................................................................................................................................. 37
2.12.3 Inputs .................................................................................................................................... 37
2.12.4 Outputs ................................................................................................................................. 37
2.12.5 Example ................................................................................................................................ 37
2.13 SR_FULL ........................................................................................................................................ 38
2.13.1 Syntax ................................................................................................................................... 38
2.13.2 Purpose................................................................................................................................. 38
2.13.3 Inputs .................................................................................................................................... 38
2.13.4 Outputs ................................................................................................................................. 38
2.13.5 Example ................................................................................................................................ 38
2.14 LINEOUTF ...................................................................................................................................... 39
2.14.1 Syntax ................................................................................................................................... 39
2.14.2 Inputs .................................................................................................................................... 39
2.14.3 Outputs ................................................................................................................................. 39
2.14.4 Example ................................................................................................................................ 39
2.15 LINEOUTS ...................................................................................................................................... 40
2.15.1 Syntax ................................................................................................................................... 40
2.15.2 Inputs .................................................................................................................................... 40
2.15.3 Outputs ................................................................................................................................. 40
2.15.4 Example ................................................................................................................................ 41
2.16 SVM_SYS ....................................................................................................................................... 42
2.16.1 Syntax ................................................................................................................................... 42
2.16.2 Purpose................................................................................................................................. 42
2.16.3 Example ................................................................................................................................ 42
3 GRAPHICAL USER INTERFACE ......................................................................................... 47

©Graham Rogers 2000-2008 All rights reserved 3


formuss Function Decriptions

1 Introduction
MatNetEig is a MATLAB© based, object oriented program for small signal stability analysis of inter-
connected power systems. In this document, the functions, which comprise MatNetEig, are described in
detail.

1.1 Linearized device models


Linearized models, in state space form, are created for power system devices and their controls, i.e.,
generators, exciters, power system stabilizers and governors; static var compensators; thyristor controlled
series compensators; unified power system controls, HVDC links and induction machines. Each device is
defined as a MATLAB class. One of the functions in each class is stsp, which overloads the stsp function in
the @stsp directory, and which forms a linearized state space model of the class device.

1.2 Formulation functions


The device models are assembled by the following formulation functions into a linearized dynamic model
of the power system.

formgss - forms a sparse state space model for generators and their controls
formuss - forms a sparse set of linear differential/algebraic equations for the system
fullssm - forms the full state space equations with the network algebraic variables
eliminated
setib - produces a reduced sparse system model with selected generators set to infinite
buses behind their generators’ internal impedances

1.3 Analysis functions


The following functions may be used to perform linear analysis.

fullma - performs full modal analyis (using eig) on the model obtained from fullssm
sparsema - performs modal analysis (using eigs) on the model produced using formuss to
obtain a subset of the systems eigenvalues and eigenvectors
sparsezeros - calculates a few zeros of a specified single input/ single output system using the
sparse system model
svm_sys - driver function for full modal analysis
svm_sparse - driver function for sparse modal analysis
fr_sparse - calculates the frequency response of a sparse single input, single output
linearized power system model
fr_full - calculates the frequency response of a full single input, single output
linearized power system model
sr_sparse - calculates the step response of a sparse single input, multi-output
linearized power system model
sr_full - calculates the step response of a full single input, multi-output
linearized power system model
mvfr_sparse - calculates multivariable frequency response from a sparse linearized power
system model
Auxiliary functions

atu, atut - used in the determination of a few eigenvalues of a linearized differential -


algebraic power system model
lineoutf - calculates the line output matrices from the full system model

©Graham Rogers 2000-2008 All rights reserved 4


formuss Function Decriptions

lineouts - calculates the line output matrices from the sparse system model
magang - calculates the output matrices for voltage magnitude and angle using the sparse
system model

2 Function Descriptions

2.1 formgss
2.1.1 Syntax
[sgc,strgc,e_flag] = formgss(GenSys,n);

2.1.2 Purpose
Forms a sparse state space object for the system’s generators and their controls.

2.1.3 Inputs
GenSys.Gen - generator data structure
n - solved net_c class object

2.1.4 Outputs
sgc - sparse state space object of generators and their controls
strgc - a structure defining the states, inputs and outputs of the generator state space
system
mpss maximum number of pss states
n_tg number of thermal governors
n_hg number of hydraulic governors
GnexcIndex index of subtransient generators without exciters
GemIndex index of classical generator models
statemat the matrix columns indicate the state
numbers for each generator
inmat indicates the generator inputs
row 1 Vd
row 2 Vq
row 3 Pm
row 4 Vref generators with exciters;
Efd generators without exciters
row 5 Pref generators with governors only
outmat indicates the generator outputs
row 1 id
row 2 iq
row 3 ifd subtransient generators only
row 4 speed
row 5 Pe
row 6 Efd generators with exciters only
row 7 Pm generators with governors only
GenNum vector of generator numbers
BusIndex vector of generator bus indexes
BasRat vector of system base/generator ratings
bvd input matrix changes in Vd
bvq input matrix changes in Vq
cid output matrix changes in id

©Graham Rogers 2000-2008 All rights reserved 5


formuss Function Decriptions

ciq output matrix changes in iq

e_flag - 1 if error, 0 otherwise

2.1.5 Purpose
This function forms linearized models of generators and their controls. The models are constructed from
the data in the GenSys data input structure, and the solved net_c class object n. The generator objects are
separated into subtransient generator objects (formed using sub_gen), and classical generator objects
(formed using em_gen).

The state space models of the classical generators are formed using the stsp function overloaded for
em_gen objects.

The state space models of the subtransient generators are formed in conjunction with the state space models
of the exciters using the add2gen function which is overloaded for each exciter model type: state space
models of those subtransient generators with no exciters are formed, using stsp overloaded for sub_gen
objects. The generator state models are sorted in generator order, and governor and turbine state space
models are added. States, inputs and outputs are in generator order.

2.1.6 Calls
generator functions: sub_gen, em_gen and the corresponding stsp functions
automatic voltage regulator functions: dc12a, dc3a, ac1a, ac2a, ac3a, ac4a, ac5a, ac6a, ac7a, st1a, st2a,
st3a, st4a, st5a, and the corresponding add2gen and stsp functions
governor/turbine functions: hygov thgov and the corresponding stsp functions

2.1.7 Called by
formuss

2.1.8 Example

For the two-area system with exciters, governors and power system stabilizers (d2a_sbegp), the state space
model for the generators would be formed using the following MATLAB commands:

[S,GenSys,SVCD,TCSCD,geib_idx,gsib_idx,lmod_con,rlmod_con,load_con] = rdpstv2;
n=netflow(net_c(S));
[sgc,strgc,e_flag] = formgss(GenSys,n);

The outputs are


sgc =
a: [68x68 double]
b: [68x20 double]
c: [28x68 double]
d: [28x20 double]
NumStates: 68
NumInputs: 20
NumOutputs: 28
strgc =
mpss: 3
n_tg: 4
n_hg: 0
GnexcIndex: []
GemIndex: []
ExcType: [7 7 7 7]
GovType: [2 2 2 2]
statemat: [26x4 double]
inmat: [6x4 double]
outmat: [7x4 double]
GenNum: [1 2 3 4]
BusIndex: [1 2 6 7]

©Graham Rogers 2000-2008 All rights reserved 6


formuss Function Decriptions

BasRat: [4x1 double]


bvd: [68x13 double]
bvq: [68x13 double]
cid: [13x68 double]
ciq: [13x68 double]

2.2 formuss
2.2.1 Syntax
[suc,sys_state,StateName,DeviceName,strsuc,e_flag]=...
formuss(n,GenSys,lmod_con,rlmod_con,load_con,SVCD,TCSCD,UPFCD,HVDCCD);

2.2.2 Purpose
Forms a sparse differential algebraic linearized power system model as a set of state space equations
representing the dynamic devices, together with a set of algebraic equations representing the ac network.
The inputs to the state space equations are the network bus voltage changes, and the dynamic device
control inputs. The outputs are the changes in current injected into the network, and the dynamic device
outputs.

dx
= ax + b v Δv + b c uc
dt
Δi = c i x − Yd Δv + d n uc (2.1)
y = cx + d v Δv + d c u c
Δi = Yn Δv
where
x is a vector of system dynamic states
Δv is a vector of changes in network direct and quadrature axis voltages
Δi is a vector of d and q axis currents injected into the the network
uc is a vector of control inputs
a is a sparse state matrix
bv is the input matrix associated with the change in network direct and quarature bus voltage
bc is the input matric associated with the system’s controls
ci is the output matrix for the direct and quadrature currents injected into the network
Yn is the incremental admittance matrix of the nework
Yd is the incremental admittance matrix associated with the system’s dynamic devices
dn is the feedforward matrix for the change in currents injected into the network due to changes in
the system’s control inputs
y is a vector of control outputs
c is the output matrix for the controls
dv is the feed forward matrix for the change in the system’s control outputs to a change in the
network direct and quadrature voltages
dc is the feed forward matrix for the change in the control outputs to a change in the control inputs

Eliminating Δi
gives
dx
= ax + b v Δv + bc u c
dt
0 = c i x − ( Yn + Yd ) Δv + d n u c (2.2)
y = cx + d v Δv + d c u c

©Graham Rogers 2000-2008 All rights reserved 7


formuss Function Decriptions

The output suc is a stsp object with:

state matrix a
input matrix [b v bc ]
⎡c ⎤
output matrix ⎢ i ⎥
⎣c⎦
⎡ - ( Yn + Yc ) d n ⎤
feed forward matrix ⎢ ⎥.
⎣ dv dc ⎦

2.2.3 Inputs
n - solved network object
Note: the network object contains the dynamic data of any induction machines
GenSys - generator specification structure
lmod_con - active load modulation specification matrix
rlmod_con - reactive load modulation specification matrix
load_con - nonconforming load specification matrix
SVCD - svc specification structure
TCSCD - tcsc specification structure
UPFCD - upfc specifcation structure (includes STATCON and SECON)
HVDCCD - hvdc specifcation structure

2.2.4 Outputs
suc - unconnected sparse state space object
sys_state - matrix defining system states
StateName - cell array of dynamic state names
DeviceName - cell array of device names associated with the states
strsuc - structure describing suc
BasRat - Ratio of system MVA base to generator MVA base
NumGen - Number of Generators modelled dynamically
NumDGen - Number of detailed generators
NumCGen - Number of classical generators
NumSVC - Number of SVCs
NumTCSC - Number of TCSCs
NumUPFC - Number of UPFCs
NumStatcon - Number of Statcon’s
NumSecon - Number of Secons
NumDC - Number of HVDC links
NumIM - Number of induction machines
NumLMod - Number of active loads modulated
NumRLMod - Number of reactive loads modulated
c_idx - index of number of rows for c matrix entries
index no. of rows of
1 c_i change in current on system base
2 c_spd change in speed
3 c_p change in electrical power on generator base
4 c_Efd change in field voltage
5 c_ifd change in field current on reciprocal base
6 c_pm change in pm on generator base
7 c_bsvc
8 c_btcsc
9 c_upfcVdc

©Graham Rogers 2000-2008 All rights reserved 8


formuss Function Decriptions

10 c_upfcPshc
11 c_upfcQshc
12 c_upfcPc
13 c_upfcQc
14 c_statconVdc
15 c_statconPshc
16 c_statconQshc
17 c_seconVdc
18 c_seconPshc
19 c_seconPc
20 c_seconQc
21 c_dcliacrd
22 c_dcliacrq
23 c_dcliacid
24 c_dcliaciq
25 c_glmod
26 c_brlmod

b_idx - index of number of columns for b matrix entries


index no. of columns of
1 b_v
2 b_Efd
3 b_vr
4 b_pm change in pm on generator base
5 b_pr change in pr on governor base
6 b_vrsvc
7 b_vctcsc
8 b_upfcVfmref
9 b_upfcVdcref
10 b_upfcP2ref
11 b_upfcQ2ref
12 b_statconVfmref
13 b_statconVdcref
14 b_sseconVdcref
15 b_seconP2ref
16 b_seconQ2ref
17 b_hvdcVrref
18 b_hvdcViref
19 b_tim
20 b_vrlmod
21 b_vrrlmod
Id - index of direct axis current outputs
Iq - index of quadrature axis current outputs
speed - index of generator speed outputs
pe - index of generator active power outputs
Efd - index of Exciter field voltage outputs
Ifd - index of generator field current outputs
pm - index of turbine mechanical torque outputs
Bsvc - index of SVC susceptance
Btcsc - index of TCSC susceptance
UPFCVdc - UPFC Capacitor Voltage index
UPFCPshc - UPFC shunt control power output index
UPFCQshc - UPFC shunt control reactive power output index
UPFCPc - UPFC series control power index
UPFCQc - UPFC series control reactive power index
STATCONVdc - STATCON DC Voltage index

©Graham Rogers 2000-2008 All rights reserved 9


formuss Function Decriptions

STATCONPshc - STATCON shunt control active power index


STATCONQshc - STATCON shunt control reactive power index
SECONVdc - SECON Capacitor Voltage index
SECONPshc - SECON shunt control power output index
SECONPc - SECON series control power index
SECONQc - SECON series control reactive power index
iacrecd - index of d axis ac current injected at the rectifier bus
iacrecq - index of q axis ac current injected at the rectifier bus
iacinvd - index of d axis ac current injected at the inverter bus
iacinvq - index of q axis ac current injected at the inverter bus
Glmod - index of conductance of active load modulation
Brlmod - index of susceptance of reactive load modulation
Vd - index of direct axis voltage inputs
Vq - index of quadrature axis voltage inputs
Efdin - index of generator field voltage inputs
vref - index of exciter voltage reference inputs
pmin - index of generator mechanical torque inputs
pref - index of governor power reference inputs
svcref - index of SVC reference inputs
tcscref - index of TCSC control inputs
UPFCVfmref - index of UPFC shunt voltage reference inputs
UPFCVdcref - index of UPFC dc voltage reference inputs
UPFCP2ref - index of UPFC series power reference inputs
UPFCQ2ref - index of UPFC series reactive power reference inputs
STATCONVfmref - index of STATCON shunt voltage reference inputs
SECONVdcref - index of SECON dc voltage reference inputs
SECONP2ref - index of SECON power reference inputs
SECONQ2ref - index of SECON reactive power reference inputs
hvdcVrref - index of HVDC Rectifier voltage reference
hvdcViref - index of HVDC Inverter voltage reference
tlim - index of induction motor load torque inputs
lmodref - index of active load modulation inputs
rlmodref - index of reactive load modulation inputs
out_idx - index of outputs
in_idx - index of inputs
outmat - matrix of outputs
inmat - matrix of inputs

e_flag 1 if error, 0 otherwise

2.2.5 Example

In the following, formuss is used to determine the differential algebraic equations of the two area system
(d2a_sbegp). There are four detailed generators with static exciters, power system stabilizers, and thermal
turbines and governors.

[suc,sys_state,StateName,DeviceName,strsuc,e_flag]=...
formuss(n,GenSys,lmod_con,rlmod_con,load_con,SVCD,TCSCD,UPFCD,HVDCC);
suc =
ans =
a: [68x68 double]
b: [68x38 double]
c: [46x68 double]
d: [46x38 double]
NumStates: 68
NumInputs: 38
NumOutputs: 46

©Graham Rogers 2000-2008 All rights reserved 10


formuss Function Decriptions

full(sys_state)
ans =
1 18 35 52
2 19 36 53
3 20 37 54
4 21 38 55
5 22 39 56
6 23 40 57
7 24 41 58
8 25 42 59
9 26 43 60
10 27 44 61
0 0 0 0
11 28 45 62
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
12 29 46 63
13 30 47 64
14 31 48 65
15 32 49 66
16 33 50 67
17 34 51 68
The sparsity of the system’s state matrices is shown in the spy plots of Figure 1. For comparison, Figure 2
shows a spy plot of the state matrix with the algebraic equations eliminated. The sparse system stsp model
requires 8512 bytes of storage in MATLAB, while the number required for a full model of this system is
73852 bytes.

a b
0 0

20 20

40 40

60 60

0 20 40 60 0 20
nz = 232 nz = 60
c d
0 0

10 10

20 20

30 30
40 40
0 20 40 60
0 20
nz = 100
nz = 140

Figure 1 SPY plots of sparse state space matrices of 4 machine system

©Graham Rogers 2000-2008 All rights reserved 11


formuss Function Decriptions

a b
0 0

20 20

40 40

60 60

0 20 40 60 0 510
nz = 612 nz = 12
d
c
0
0

10 10

20 20

30 30
40 40

0 20 40 60
0 5 10
nz = 700
nz = 0

Figure 2 Spy plot of connected state space matrices calculated using fullssm
To identify the nature of the 44th state type

[[num2str(44) ' '] [StateName{44} ' '] DeviceName{44}]

ans =

44 Transducer gen3

State 44 is the transducer state (Tr) of generator 3 exciter.

A listing of all the states may be obtained using

spchr = char(32*ones(68,2));
[num2str((1:68)') spchr char(StateName) spchr char(DeviceName)]
ans =

1 angle gen1
2 speed gen1
3 psif gen1
4 psikdpp gen1
5 psikqp gen1
6 psikqpp gen1
7 pssst1 gen1
8 pssst2 gen1
9 pssst3 gen1
10 Transducer gen1
11 avr2 gen1
12 Ttd gen1
13 Tcs gen1
14 Thp gen1
15 Trh gen1
16 Tlp1 gen1
17 Tlp2 gen1
18 angle gen2
19 speed gen2
20 psif gen2
21 psikdpp gen2
22 psikqp gen2
23 psikqpp gen2

©Graham Rogers 2000-2008 All rights reserved 12


formuss Function Decriptions

24 pssst1 gen2
25 pssst2 gen2
26 pssst3 gen2
27 Transducer gen2
28 avr2 gen2
29 Ttd gen2
30 Tcs gen2
31 Thp gen2
32 Trh gen2
33 Tlp1 gen2
34 Tlp2 gen2
35 angle gen3
36 speed gen3
37 psif gen3
38 psikdpp gen3
39 psikqp gen3
40 psikqpp gen3
41 pssst1 gen3
42 pssst2 gen3
43 pssst3 gen3
44 Transducer gen3
45 avr2 gen3
46 Ttd gen3
47 Tcs gen3
48 Thp gen3
49 Trh gen3
50 Tlp1 gen3
51 Tlp2 gen3
52 angle gen4
53 speed gen4
54 psif gen4
55 psikdpp gen4
56 psikqp gen4
57 psikqpp gen4
58 pssst1 gen4
59 pssst2 gen4
60 pssst3 gen4
61 Transducer gen4
62 avr2 gen4
63 Ttd gen4
64 Tcs gen4
65 Thp gen4
66 Trh gen4
67 Tlp1 gen4
68 Tlp2 gen4

©Graham Rogers 2000-2008 All rights reserved 13


fullssm Function Decriptions

2.3 fullssm
2.3.1 Syntax
[sps,strsps] = fullssm(suc,strsuc,n);

2.3.2 Purpose
Forms a full interconnected state space model of the power system suitable for complete modal analysis
using eig. The network equations are eliminated from equation 2.1, i.e.,
dx
= ax + b v Δv + bc u c
dt
0 = c i x − ( Yn + Yd )Δv + d n u c (2.3)
y = cx + d v Δv + d c u c

Δv = ( Yn + Yd ) −1 ( c i x + d n u c )
dx
= ( a + b v ( Yn + Yd ) −1 c i ) x + ( b c + b v ( Yn + Yd ) −1 d n ) uc (2.4)
dt
y = ( c + d v ( Yn + Yd ) −1 c i ) x + ( d c + d v ( Yn + Yd ) −1 d n ) u c

The sparsity is lost from the interconnected model and, in MatNetEig, the state space matrices are stored as
full MATLAB matrices.

In addition to the control outputs (y), the full model has output and feed forward matrices for the changes in
the network bus voltage magnitudes and bus voltage angles.

Owing to storage limitations, systems modelled in this way should have less than 1000 states.

2.3.3 Inputs
suc - sparse state space model
strsuc - sparse state space model structure
n - solved network object

2.3.4 Outputs
sps - full state space model with network equations eliminated
strsps - structure containing indexes of the model’s states, inputs and outputs
Vmag - bus voltage magnitude output
Vang - bus voltage angle (radians) output
speed - generator speed
pe - generator electric power
Efd - generator field voltage
Ifd - generator field current
pm - generator mechanical power output
Bsvc - SVC susceptance
Btcsc - TCSC susceptance
Glmod - active load modulation conductance
Brlmod - reactive load modulation susceptance
UPFCVdc - UPFC capacitor voltage
UPFCPshc - UPFC shunt power control
UPFCQshc - UPFC shunt power control
UPFCPc - UPFC series power control
STATCONVdc - STATCON dc voltage

©Graham Rogers 2000-2008 All rights reserved 14


fullssm Function Decriptions

STATCONPshc - STATCON shunt power control


STATCONQshc - STATCON shunt reactive power control
SECONVdc - SECON dc voltage
SECONPshc - SECON shunt control power
SECONQshc - SECON shunt control reactive power
SECONPc - SECON series control power
SECONQc - SECON series control reactive power
iacrecd - d axis ac current injected at the rectifier bus
iacrecq - q axis ac current injected at the rectifier bus
iacinvd - d axis ac current injected at the inverter bus
iacinvq - q axis ac current injected at the inverter bus
Efdin - generator field voltage input
vref - exciter voltage reference input
pmin - generator mechanical power input
pref - governor power reference input
svcref - SVC reference input
tcscref - TCSC reference input
UPFCVmfref - UPFC from bus voltage reference
UPFCVdcref - UPFC DC voltage reference
UPFCP2ref - UPFC series control power reference
UPFCQ2ref - UPFC series control reactive power reference
STATCONVmfref - STATCON from bus voltage reference
SECONVdcref - SECON DC voltage reference
SECONP2ref - SECON series control power reference
SECONQ2ref - SECON series control reactive power reference
hvdcVrref - HVDC rectifier voltage reference
hvdcViref - HVDC inverter voltage reference
tlim - induction machine load torque input
lmodref - active load modulation reference input
rlmodref - reactive load modulation reference input
out_idx - index of outputs
in_idx - index of inputs

2.3.5 Example
The two-area system model is obtained from the output from formuss. For the same system as used in the
formuss example, fullssm gives

[sps,strsps] = fullssm(suc,strsuc,n)

sps =
a: [68x68 double]
b: [68x12 double]
c: [46x68 double]
d: [46x12 double]
NumStates: 68
NumInputs: 12
NumOutputs: 46

strsps =
Vmag: [1 2 3 4 5 6 7 8 9 10 11 12 13]
Vang: [14 15 16 17 18 19 20 21 22 23 24 25 26]
speed: [27 28 29 30]
pe: [31 32 33 34]
Efd: [35 36 37 38]
Ifd: [39 40 41 42]
pm: [43 44 45 46]
Bsvc: []
Btcsc: []
Glmod: []
BRlmod: []

©Graham Rogers 2000-2008 All rights reserved 15


fullssm Function Decriptions

UPFCVdc: []
UPFCPshc: []
UPFCQshc: []
UPFCPc: []
UPFCQc: []
STATCONVdc: []
STATCONPshc: []
STATCONQshc: []
SECONVdc: []
SECONPshc: []
SECONPc: []
SECONQc: []
iacrecd: []
iacrecq: []
iacinvd: []
iacinvq: []
Brlmod: []
Efdin: []
vref: [1 2 3 4]
pmin: [5 6 7 8]
pref: [9 10 11 12]
svcref: []
tcscref: []
UPFCVfmref: []
UPFCVdcref: []
UPFCP2ref: []
UPFCQ2ref: []
STATCONVfmref: []
STATCONVdcref: []
SECONVdcref: []
SECONP2ref: []
SECONQ2ref: []
hvdcVrref: []
hvdcViref: []
tlim: []
lmodref: []
rlmodref: []
out_idx: [27x1 double]
in_idx: [22x1 double]

Since the state matrix is full in this model, the eigenvalues may be found using the MATLAB eig function.

l =

-1.0192e-006
-0.075952
-0.1009
-0.10107
-0.10112
-0.22952
-0.23425
-0.2343
-0.50366 - 0.47594i
-0.50366 + 0.47594i
-1.5881 - 0.0029079i
-1.5881 + 0.0029079i
-1.765 - 0.098322i
-1.765 + 0.098322i
-1.788
-1.829
-1.6722 - 1.0486i
-1.6722 + 1.0486i
-3.4264
-3.5414 - 0.15193i
-3.5414 + 0.15193i
-3.6529
-0.48997 - 3.8527i
-0.48997 + 3.8527i
-4.9499
-4.9662

©Graham Rogers 2000-2008 All rights reserved 16


fullssm Function Decriptions

-5.5279
-5.8115
-3.195 - 8.1463i
-3.195 + 8.1463i
-3.1793 - 8.4218i
-3.1793 + 8.4218i
-9.9159 - 0.15079i
-9.9159 + 0.15079i
-9.9292 - 0.14112i
-9.9292 + 0.14112i
-9.9549 - 0.11649i
-9.9549 + 0.11649i
-9.9555 - 0.11578i
-9.9555 + 0.11578i
-6.3114 - 9.1576i
-6.3114 + 9.1576i
-6.2607 - 9.529i
-6.2607 + 9.529i
-5.9131 - 15.337i
-5.9131 + 15.337i
-4.4318 - 17.796i
-4.4318 + 17.796i
-31.297
-31.626
-34.86
-34.989
-40.728 - 0.70461i
-40.728 + 0.70461i
-40.767 - 0.47653i
-40.767 + 0.47653i
-52.836 - 0.21831i
-52.836 + 0.21831i
-53.712
-53.777
-66.667
-66.667
-66.667
-66.667
-100.64
-100.65
-101.07
-101.3

The frequency response between the voltage reference of the exciter on generator 3 and the generators
terminal voltage (Bus 11, Index 6) may be calculated using the stsp function fr_stsp.

Form a stsp object with the required input and output.


svrvmg3 = stsp(sps.a,sps.b(:,3),sps.c(6,:),0);
Calculate the frequency response, on a logarithmic frequency from 0.01 to 100 in multiples of 1.1
[f,ymvrvm3,yavrvm3]=fr_stsp(svrvmg3,'log',0.01,1.1,100);
Plot a bode diagram
plot_bode(f,ymvrvm3,yavrvm3)

©Graham Rogers 2000-2008 All rights reserved 17


fullssm Function Decriptions

Frequency response of generator 3 bus voltage magnitude to Vref


20

-20

gain db
-40

-60

-80
-2 -1 0 1 2
10 10 10 10 10

-50
phase degrees

-100

-150

-200
-2 -1 0 1 2
10 10 10 10 10
frequency Hz

Figure 3 Frequency response of terminal voltage to exciter voltage reference


The time response to a step input of magnitude 0.01, from 0 to 10 s may be calculated using
[res,t] = stepres(svrvmg3,0.01,10,0.01);

Figure 4 Response of the terminal voltage of generator 3 to a step change in exciter


voltage reference

©Graham Rogers 2000-2008 All rights reserved 18


fullma Function Decriptions

2.4 fullma

2.4.1 Syntax
[l,ld,damp,freq,u,v,p,p_norm,us_idx,ud_idx,usd_idx] = fullma(sps);

2.4.2 Purpose
Performs modal analysis on the full linearized power system model defined by the state space object sps.

2.4.3 Input
sps - state space object of linearized power system, output from fullssm

2.4.4 Output
l - vector of system eigenvalues sorted by magnitude
ld - Jordan canonical form for systems with non-linear divisors, otherwise equal to l
damp - vector of damping ratios
freq - vector of frequencies
u - matrix of right eigenvectors
v - matrix of left eigenvectors
p - matrix of participation factors
p_norm - matrix of participation factors normalized so their maximum value is unity
us_idx - index of unstable eigenvalues
ud_idx - index of stable eigenvalues with damping ratios less than 0.05
usd_idx - index of eigenvalues with a damping ration less that 0.05

This function uses the stsp object’s eig to determine the eigenvalues and eigenvectors of sps.a. If the
eigenvectors are not distinct, the eigenvectors are modified to reduce the state matrix to Jordan canonical
form, i.e.,
v*sps.a*u gives a matrix of eigenvalues in Jordan Canonical form.

2.4.5 Example
With the two area system modelled with classical generators, and with the network load flow solved with
an error tolerance of 1e-8, there are two zero eigenvalues which are non-linear divisors. The state matrix
cannot be diagonalized. In this case ld is a sparse matrix, with the eigenvalues on the diagonal, and ones in
the upper diagonal elements assosiated with the equal eigenvalues.

ld =

(1,2) 1
(3,3) 0 - 3.4904i
(4,4) 0 + 3.4904i
(5,5) 0 - 7.4342i
(6,6) 0 + 7.4342i
(7,7) 0 - 7.508i
(8,8) 0 + 7.508i

All off diagonal entries are zero with the exception of the second element in the first row, which is unity.

©Graham Rogers 2000-2008 All rights reserved 19


fullma Function Decriptions

The matrix diagonals are the eigenvalues of the system.


l =
0
0
0 - 3.4904i
0 + 3.4904i
0 - 7.4342i
0 + 7.4342i
0 - 7.508i
0 + 7.508i

The ud_idx indicates that all modes have damping ratios less than 0.05. There are no modes with negative
real parts and us_idx is empty.

A bar chart of the real part of the speed participation factor, Figure 3, shows that mode 3 is an interarea
mode ( all generators have significant speed participation factors in the mode).

barh(real(p([2 4 6 8],3)))
real(p([2 4 6 8],8))

ans =

0.098255
0.062157
0.19855
0.14104

The mode shape for the generators’ speed, i.e., the speed components of the right eigenvector, is obtained
using

compass(u([2 4 6 8],3))

u([2 4 6 8],3)

ans =

0.53382 +7.0446e-022i
0.44551 +1.0069e-021i
-0.54959 - 3.293e-021i
-0.46357 +5.7795e-021i

It can be seen that mode 3 is an inter-area mode with generators 1 and 2 oscillating against generators 3 and
4.

©Graham Rogers 2000-2008 All rights reserved 20


fullma Function Decriptions

Figure 5 Real Part of speed participation factors for mode 3

Figure 6 Speed components of right eigenvector for mode 3

©Graham Rogers 2000-2008 All rights reserved 21


setib Function Decriptions

2.5 setib

2.5.1 Syntax

[sucr,sys_stater,StateNamer,DeviceNamer,strsucr,error_flag]=...
setib(suc,sys_state,StateName,DeviceName,strsuc,ibg_idx);

2.5.2 Purpose
Forms a reduced sparse power system model with the dynamics of selected generators eliminated and
infinite buses inserted behind the generators’ source impedances.

2.5.3 Input
suc - sparse system linearized system state space object
sys_state - state definition matrix
StateName - cell of state names
DeviceName - cell of device names
strsuc - system specification structure
ibg_idx - index of generators to be set to infinite buses

2.5.4 Output

sucr - sparse system linearized system state space object


sys_stater - state definition matrix
StateNamer - cell of state names
DeviceNamer - cell of device names
strsucr - system specification structure
error_flag - 1 if error, 0 otherwise

2.5.5 Example

The following sets generators 3 and 4 to infinite buses, for the two-area system 2dasbegp.

[sucr,sys_stater,StateNamer,DeviceNamer,strsucr,error_flag]=...
setib(suc,sys_state,StateName,DeviceName,strsuc,[3 4]’);
[spsr,strspsr] = fullssm(sucr,strsucr,n);
[lr,ldr,dampr,freqr,ur,vr,pr,p_normr,usr_idx,udr_idx,usdr_idx] = fullma(spsr);

lr =
-0.10121
-0.10142
-0.22022
-0.2343
-1.5831
-1.6929 - 0.35079i
-1.6929 + 0.35079i
-1.8384
-0.30531 - 2.6048i
-0.30531 + 2.6048i
-3.4587 - 0.18116i
-3.4587 + 0.18116i
-4.9697
-5.6848
-3.1254 - 8.306i

©Graham Rogers 2000-2008 All rights reserved 22


setib Function Decriptions

-3.1254 + 8.306i
-9.9222 - 0.14644i
-9.9222 + 0.14644i
-9.9552 - 0.11613i
-9.9552 + 0.11613i
-6.3041 - 9.3499i
-6.3041 + 9.3499i
-5.5105 - 16.254i
-5.5105 + 16.254i
-30.961
-34.855
-40.879 - 0.67299i
-40.879 + 0.67299i
-52.681
-53.71
-66.667
-66.667
-100.64
-101.16

Note that the introduction of the infinite buses have eliminated the zero eigenvalue.

A comparison of the full model and the infinite bus model modes is shown in Figure 7.

Figure 7 Comparison of the modes of the full two-area system model, and that with
infinite buses replacing generators 3 and 4

©Graham Rogers 2000-2008 All rights reserved 23


sparsema Function Decriptions

2.6 sparsema
2.6.1 Syntax
[l,damp,freq,u,v,p,p_norm,us_idx,ud_idx,usd_idx]= sparsema(suc,strsuc);

2.6.2 Purpose
Calculates, using the MATAB function eigs, a few eigenvalues and eigenvectors directly from the sparse
differential-algebraic equations of the system contained in the sparse state matrix suc. The left and right
eigenvectors are obtained using separate applications of eigs, for the right eigenvector the state space
system as defined in suc, and for the left eigenvector its transpose.

2.6.3 Inputs
suc - sparse linearized power system model obtained from formuss
strsuc - corresponding system structure

2.6.4 Outputs
l - vector of found system eigenvalues
damp - vector of damping ratios
freq - vector of frequencies
u - matrix of right eigenvectors
v - matrix of left eigenvectors
p - matrix of participation factors
p_norm - matrix of participation factors normalized so their maximum value is unity
us_idx - index of unstable eigenvalues
ud_idx - index of stable eigenvalues with damping ratios less than 0.05
usd_idx - index of all eigenvalues with a damping ratios less that 0.05

For partial modal analysis, the system model is left in its unconnected sparse form, and eigs is used to find
a few system eigenvalues and eigenvectors. This method is best suited for very large power system models.
It may also be used with smaller models, but much information about the system's small signal stability is
lost, and the time for computation may be more than that for full eigenvalue analysis.

The MATLAB function eigs uses an Implicitly Restarted Arnoldi method 1 to determine a few eigenvalues
and vectors close to a user supplied starting point. The method requires the multiplication of the
interconnected state matrix (A) by a vector. A sparse state matrix A may be supplied to eigs explicitly, or
the multiplication may be performed in a user written function. The second option is used in sparsema.

In sparsema the eigenvalues of the inverse of (A-λoI) are found, where λo is a bias value input by the user.
The system's eigenvalues are then obtained by inverting the eigenvalues of the inverse matrix found using
eigs, and adding the starting point eigenvalue.
[u1,l1,flag]=eigs('atu',size(a,1),'LM',options);
A second run of eigs with the transpose of the inverse of (A-λoI), using the function atut, obtains the same
eigenvalues. However, the eigenvectors in this case are the transpose of the left eigenvectors. Thus the
participation factors for the found eigenvalues may be determined.
The multiplication is performed in atu.m.
function y = atu(u);
% multiplier function for use with eigs
global am amibyc
amu = am\u;
y = amu -amibyc*amu;

1
D.C. Sorensen,'Implicitly Restarted Arnoldi/Lanczos Methods for Large-Scale Eigenvalue Problems',
Dept. of Computational and Applied Math., Rice University, Houston, Texas. 1995.

©Graham Rogers 2000-2008 All rights reserved 24


sparsema Function Decriptions

The output from atu (y), is effectively (A-λoI)-1u. However, A is not formed explicitly to maintain sparsity.
For the transpose the multiplication is formed by atut.m
function y = atut(u);
% multiplier function for use with eigs
global am amticyb
amiut = (am.')\u;
y = amiut - amticyb*amiut;
In the above functions

am = suc.a − λI
ys = ci *(am / b v )
yi = −suc.d(1: 2 * NumBus,1: 2 * NumBus)
y = yi + ys
amibyc = am \ (b v *(y / ci ))
amticyb = (am.') \ (ci .'*(y.'/ b v .'))

These are calculated within sparsema.

2.6.5 Example
For the two area system with controls (d2asbegp), the sequence for using sparsema is as follows

[S,GenSys,SVCD,TCSCD,geib_idx,gsib_idx,lmod_con,rlmod_con,load_con] = rdpstv2;
n=netflow(net_c(S),’noprint’,1);
[suc,sys_state,StateName,DeviceName,strsuc,e_flag]...
=formuss(n,GenSys,lmod_con,rlmod_con,load_con,SVCD,TCSCD);
[l,damp,freq,u,v,p,p_norm,us_idx,ud_idx,usd_idx] = sparsema(suc,strsuc);

The following dialog box is displayed, for the user to assign the value, which the routine uses to find the
closest eigenvalues. If the user clicks OK, the routine calculates the eigenvalues and displays them on an
argand diagram, shown in Figure 8. A second dialog box is displayed, which asks the user whether
additional eigenvalues are required. If the user selects yes, the first dialog box is redisplayed so that a value
for the next search may be entered. The process continues until the user selects the no button on the second
dialog box.

In this example, four passes were used with the starting values pi*i, 2*pi*i, 3*pi*i and 4*pi*i.

©Graham Rogers 2000-2008 All rights reserved 25


sparsema Function Decriptions

Figure 8 Displayed found eigenvalues after 4 passes with starting points iπ, 2iπ, 3iπ
and 4iπ
The found eigenvalues, their damping ratios and frequencies are
[l damp freq]
ans =
-0.48683 + 3.8895i 0.1242 0.61903
-1.6706 + 1.0604i 0.84429 0.16877
-0.50791 + 0.47553i 0.72999 0.075682
-1.0192e-006 +1.0747e-013i 1 1.7104e-014
-0.075929 -5.5067e-014i 1 8.7642e-015
-2.594 + 8.4778i 0.29258 1.3493
-2.5143 + 8.645i 0.27926 1.3759
-7.028 + 8.7987i 0.6241 1.4004
-7.1478 + 8.529i 0.64232 1.3574
-4.5401 + 17.604i 0.24974 2.8017
-6.011 + 15.108i 0.36968 2.4046
The eigenvalues found by full and sparse analysis are compared in Figure 9, and the subset of eigenvalues
found using sparse analysis can be seen to correspond to a subset of those found from full analysis.

Figure 9 Comparison of eigenvalues found by full modal analysis and sparse modal
analysis

©Graham Rogers 2000-2008 All rights reserved 26


sparsezeros Function Decriptions

2.7 sparsezeros
2.7.1 Syntax
[lz,uz,vz] = sparsezeros(suc,strsuc,n,varargin)

2.7.2 Purpose
Calculates, using the MATAB function eigs, a few zeros and their left and right eigenvectors directly from
the sparse differential-algebraic equations of the system contained in the sparse state matrix suc. The left
and right eigenvectors are obtained using separate applications of eigs, for the right eigenvector the state
space system as defined in suc, and for the left eigenvector its transpose.

2.7.3 Inputs
suc - sparse linearized power system model obtained from formuss
strsuc - corresponding system structure
n - corresponding net_c class network object
varargin - input and output specification, see Table 1 and Table 2

2.7.4 Outputs
lz - vector of found system zeros
uz - matrix of right eigenvectors
vz - matrix of left eigenvectors
Table 1 Input Variable Options

Name Input Value


vref exciter voltage reference generator number
efdin field voltage input generator number
pmin mechanical torque input generator number
pref governor power reference generator number
vrefsvc SVC reference voltage SVC number
vreftcsc TCSC control input TCSC number
vdcrefupfc Control input to UPFC dc UPFC number
voltage controller
vfmrefupfc UPFC from bus Vmag ref UPFC number
p2refupfc UPFC series power control UPFC number
reference
q2refupfc UPFC series reactive power UPFC number
control reference
vfmrefstatcon STATCON bus voltage STATCON number
magnitude control reference
vdcrefsecon SECON dc voltage reference SECON number
p2refsecon SECON series power reference SECON number
q2refsecon UPFC series reactive power SECON number
reference
vrefrec HVDC rectifier reference HVDC number
vrefinv HVDC inverter reference HVDC number
tim induction machine torque induction machine number
vreflm active load modulation input active load modulation number
vrefrlm reactive load modulation input reactive load modulation number

©Graham Rogers 2000-2008 All rights reserved 27


sparsezeros Function Decriptions

Table 2 Output Variable Options

Name Output Value


vmag bus voltage magnitude output bus number
vang bus voltage angle (radians) bus number
output
busf bus frequency (Hz) bus number
speed generator speed output generator number
pelec generator electrical power generator number
output
efd exciter output voltage output generator number
ifd generator field current output generator number
pm turbine torque output generator number
bsvc SVC susceptance output SVC number
btcsc TCSC susceptance output TCSC number
upfcVdc UPFC dc voltage UPFC number
upfcPshc UPFC shunt power control UPFC number
upfcQshc UPFC shunt reactive power UPFC number
control
upfcPc UPFC series power control UPFC number
upfcQc UPFC series reactive power UPFC number
control
statconQshc STATCON shunt reactive STATCON number
power control
seconVdc SECON dc voltage SECON number
seconPshc SECON shunt power control SECON number
seconPc SECON series power control SECON number
seconQc SECON series reactive power SECON number
control
iacrecq HVDC q axis current injected HVDC Number
at rectifier ac bus
iacrinvd HVDC d axis current injected HVDC Number
at inverter ac bus
iacinvq HVDC q axis current injected HVDC Number
at inverter ac bus
glmod active power modulation active load modulation number
conductance output
brlmod reactive load susceptance reactive load modulation number
modulation output
pf active power flow into the from line number
bus of a line
qf reactive power flow into the line number
from bus of a line
pt active power flow into the to line number
bus of a line
qt reactive power flow into the to line number
bus of a line
ctm magnitude of current into the line number
from bus
cfm magnitude of current into the to line number
bus

©Graham Rogers 2000-2008 All rights reserved 28


sparsezeros Function Decriptions

For partial modal analysis, the system model is left in its unconnected sparse form, and eigs is used to find
a few system zeros and their eigenvectors. This method is best suited for very large power system models.
It may also be used with smaller models, but information about the system's small signal stability may be
lost, and the time for computation is generally more than that for full modal analysis.

The MATLAB function eigs uses an Implicitly Restarted Arnoldi method 2 to determine a few eigenvalues
and vectors close to a user supplied starting point. The method requires the multiplication of the
interconnected state matrix (A) by a vector. A sparse state matrix A may be supplied to eigs explicitly, or
the multiplication may be performed in a user written function. The second option is used in sparsezeros.

The function sparsezeros calculates the eigenvalues of the inverse of

⎡a − λ o I b v bc ⎤
A = ⎢⎢ ci − yi d ic ⎥⎥
⎢⎣ cc d cv d cc ⎥⎦

Where λo is a bias value input by the user, a, bv, ci and yi define the sparse unconnected system, and bc, cc,
dic, dcv and dcc are network and control constraints. If dcc is zero it is set to 1e-5. The system's zeros are then
obtained by inverting the eigenvalues of the inverse matrix found using eigs, and adding the starting point
eigenvalue.

[u1,l1,flag]=eigs('atu',size(a,1),'LM',options);

A second run of eigs using the function atut, obtains the same eigenvalues. However, the eigenvectors in
this case correspond to the transpose of the left eigenvectors.

2.7.5 Example
For the two area system with controls(d2a_sbegp), the sequence for using sparsezeros to determine the
zeros associated with the transfer function between the voltage reference of the exciter at generator 1 and
the field current of generator 1 is as follows
[lz,uz,vz] = sparsezeros(suc,strsuc,n,'vref',1,'ifd',1);

2
D.C. Sorensen,'Implicitly Restarted Arnoldi/Lanczos Methods for Large-Scale Eigenvalue Problems',
Dept. of Computational and Applied Math., Rice University, Houston, Texas. 1995.

©Graham Rogers 2000-2008 All rights reserved 29


sparsezeros Function Decriptions

Figure 10 Found zeros after four passes

After passes with πi, 2πi, 3πi, 4πi the found zeros are shown in Figure 10, and are listed below

lz =
-0.3951 + 3.417i
-2.2117 + 5.2976i
-1.6797 + 0.99272i
-0.4832 + 0.4752i
-1.8583e-007 +7.9936e-014i
-3.5067 + 8.282i
-5.6335 + 13.907i
-6.2738 + 9.2945i
-4.4105 + 17.44i

The poles may be calculated using sparsema, see previous section

l =
-0.51301 + 3.9728i
-1.6989 + 0.99668i
-0.49791 + 0.44809i
-2.0744e-007 +6.5281e-014i
-0.073922 +2.1316e-014i
-3.3573 + 8.1412i
-3.3891 + 8.5291i
-6.3618 + 9.5123i
-6.3957 + 9.0107i
-4.4225 + 17.86i
-6.0304 + 15.263i

©Graham Rogers 2000-2008 All rights reserved 30


sparsezeros Function Decriptions

Poles and zeros of Two Area System


18

16

14

12
imaginary
10

0
-7 -6 -5 -4 -3 -2 -1 0
real

Figure 11 Poles and zeros for two-area system: input Vref, output ifd generator 1

©Graham Rogers 2000-2008 All rights reserved 31


fullzeros Function Decriptions

2.8 fullzeros

2.8.1 Syntax
[lz,uz,vz] = fullzeros(sps,strsps,n,varargin);

2.8.2 Purpose
Finds the transmission zeros associated with a single input and output. The available inputs and outputs are
specified in Tables 1 and 2.

In fullzeros the eigenvalues of a = [sps.a b;c d] are found, where b is the input matrix, c is the output
matrix and d is the feed forward matrix associated with the chosen input/output pair.
This is performed using the stsp function zeros, which calls the MATLAB eig function in the form
[uz,lz] = eig(A,B);

where
B = [eye(NumStates) zeros(NumStates,NumInputs);...
zeros(NumOutputs,NumStates) zeros(NumOutputs,NumInputs)];

2.8.3 Example
For the two area system with controls(d2asbegp), the zeros associated with the transfer function between
the voltage reference of the exciter at generator 1 and the field current of generator 1 are calculated using
[lz,uz,vz] = fullzeros(sps,strsps,n,'vref',1,'ifd',1);
lz =
-2.1178e-007
-0.076898
-0.1
-0.10061
-0.10071
-0.22849
-0.23348
-0.23483
-0.4968 - 0.488i
-0.4968 + 0.488i
-1.5109
-1.5443
-1.7453 - 0.12182i
-1.7453 + 0.12182i
-1.666 - 1.0435i
-1.666 + 1.0435i
-2.0149
-2.0693
-0.21565 - 3.5693i
-0.21565 + 3.5693i
-4.6034
-4.7728
-5.0064 - 0.7374i
-5.0064 + 0.7374i
-5.3218 - 0.53782i
-5.3218 + 0.53782i
-1.3603 - 5.3916i
-1.3603 + 5.3916i
-5.624
-5.8192
-3.3122 - 7.0427i
-3.3122 + 7.0427i
-9.9009 - 0.15634i
-9.9009 + 0.15634i
-9.916 - 0.1507i
-9.916 + 0.1507i

©Graham Rogers 2000-2008 All rights reserved 32


fullzeros Function Decriptions

-9.9333 - 0.13758i
-9.9333 + 0.13758i
-9.9564 - 0.1145i
-9.9564 + 0.1145i
-4.9607 - 10.629i
-4.9607 + 10.629i
-12.911
-4.7934 - 14.489i
-4.7934 + 14.489i
-3.4043 - 17.353i
-3.4043 + 17.353i
-20
-20
-32.703
-34.08
-38.015 - 2.6474i
-38.015 + 2.6474i
-38.341 - 2.0506i
-38.341 + 2.0506i
-38.784
-50
-52.401
-53.579
-54.268
-66.667
-66.667
-66.667
-66.667
-100
-100.59
-100.86
-101.13
Inf
Inf
Inf
The zeros calculated using sparsezeros forms a subset of those calculated by fullzeros for the same
system. There are three zeros at infinity, which implies that the locus of the eigenvalues with feedback gain
between these two inputs would tend to infinity as the gain tended to infinity.

Figure 12 Dominant Poles and Zeros d2asbegp

©Graham Rogers 2000-2008 All rights reserved 33


fr_sparse Function Decriptions

2.9 fr_sparse
2.9.1 Syntax
[ym,ya] = fr_sparse(suc,strsuc,n,f,varargin);

2.9.2 Purpose
Calculates the frequency response between a single input and a single output of a power system using a
sparse linearized model constructed using formuss. Generally, for large system models, it takes less
computer time to calculate the frequency response from the sparse system model than from the full system
model.

2.9.3 Inputs
suc - sparse state space object of power system
strsuc - specification structure
n - solved net_c class object
f - a vector of frequencies
varargin - specifies the required input and output for the response
varargin takes the form of two pairs of inputs in the form ‘name1’, value1,’name2’,value 2.
One input pair must define a system input and the other a system output, the names are given in Tables 1
and 2.

2.9.4 Outputs
ym - vector of output magnitude with frequency
ya - vector of output phase in degrees with frequency

2.9.5 Example
For the two area system with controls (d2a_sbegp), the frequency response of the terminal voltage
magnitude at generator 1 to the exciter voltage reference is calculated using
f=logspace(-2,2,100);
[yms,yas] = fr_sparse(suc,strsuc,n,f,'vref',1,'vmag',1);
plot_bode(f,yms,yas,'b');
The bode plot is shown in Figure 13.
20

-20
gain db

-40

-60

-80
-2 -1 0 1 2
10 10 10 10 10

-50
phase degrees

-100

-150

-200
-2 -1 0 1 2
10 10 10 10 10
frequency Hz

Figure 13 Frequency Response of bus voltage magnitude to Vref generator 1

©Graham Rogers 2000-2008 All rights reserved 34


fr_full Function Decriptions

2.10 fr_full
2.10.1 Syntax
[ym,ya] = fr_full(sps,strsps,n,f,varargin);

2.10.2 Purpose
Calculates the frequency response between a single input and a single output of a power system using a full
linearized model constructed using fullssm. Generally, for large system models, it takes less computer time
to calculate the frequency response from the sparse system model than from the full system model.

2.10.3 Inputs
sps - full state space object of power system
strsps - specification structure
n - solved net_c class object
f - a vector of frequencies
varargin - specifies the required input and output for the response
varargin takes the form of two pairs of inputs in the form ‘name1’, value1,’name2’,value 2.
One input pair must define a system input and the other a system output, the names are given in Tables 1
and 2.

2.10.4 Outputs
ym - vector of output magnitude with frequency
ya - vector of output phase in degrees with frequency

2.10.5 Example
For the two area system with controls (d2a_sbegp), the frequency response of the terminal voltage
magnitude at generator 1 to the exciter voltage reference is calculated using
f=logspace(-2,2,100);
[ym,ya] = fr_full(sps,strsps,n,f,'vref',1,'vmag',1);
plot_bode(f,ym,ya,'b')
The response is shown in Figure 14. It is identical to that calculated using fr_sparse shown in Figure 12.
20

-20
gain db

-40

-60

-80
-2 -1 0 1 2
10 10 10 10 10

-50
phase degrees

-100

-150

-200
-2 -1 0 1 2
10 10 10 10 10
frequency Hz

Figure 14 Frequency response calculated using fr_full

©Graham Rogers 2000-2008 All rights reserved 35


mvfr_sparse Function Decriptions

2.11 mvfr_sparse
2.11.1 Syntax
[smx,smn,cv,y] = mvfr_sparse(suc,strsuc,n,f,scalein,scaleout,varargin);

2.11.2 Purpose
Calculates the frequency response between multiple inputs and multiple outputs using a sparse linearized
model constructed using formuss.

2.11.3 Inputs
suc - sparse state space object of power system
strsuc - specification structure
n - solved net_c class object
f - a vector of frequencies
scalein - scaling factor for inputs
scaleout - scaling factors for outputs
varargin - specifies the required input and output for the response
varargin takes the form of two pairs of inputs in the form ‘name1’, value1,’name2’,value 2.
One input pair must define a system input and the other a system output, the names are given in Tables 1
and 2.

2.11.4 Outputs
smx - vector of maximum singular value of outputs with frequency
smn - vector of minimum singular value of outputs with frequency
smn - vector of condition numbers of outputs with frequency
y - cell array of frequency responses between each input and each output

2.11.5 Example
For the two area system with controls (d2a_sbegp), the response of the terminal voltage magnitude at buses
3 and 13, to a change in active load at buses 4 and 14 is claculated as follows:
f=logspace(-2,2,100);
[smx,smn,cv] =mvfr_sparse(suc,strsuc,n,f,0.05*[1 1]',20*[1 1]','vreflm',[1 2]','vmag',[3
13]');
semilogx(f,[smx;smn])
The response plot is shown in Figure 15.

Figure 15 Maximum and minimum singular values voltage magnitude at buses 3


and 13 to active load modulation

©Graham Rogers 2000-2008 All rights reserved 36


sr_sparse Function Decriptions

2.12 sr_sparse
2.12.1 Syntax
[r,t] = sr_sparse(suc,strsuc,n,vin,tfin,tstep,varargin);

2.12.2 Purpose
Calculates the response of one system output to one system input using the sparse unconnected system
model obtained from formuss. The full set of state equations is not formed in the calculation. For large
system models, it generally takes less computer time to calculate step responses using the sparse system
model than using the full system model.

2.12.3 Inputs
suc - sparse unconnected linear power system model
strsuc - the model structure
n - network object
vin - the magnitude of the input disturbance
tfin - the period of the response in s
tstep - the time step s
varargin - input and output specifications, see Table 1 and Table 2

2.12.4 Outputs
r - the time response of the specified output to a change in the specified input
t - the time vector

2.12.5 Example
For the two-area system with controls (d2a_sbegp) the response of the terminal voltage at bus 1 to a step
change in the exciter reference of generator 1 is calculated using
[rms,tms] = sr_sparse(suc,strsuc,n,.01,10,.01,'vref',1,'vmag',1);
plot(tms,rms)
title('response of terminal voltage at bus 1 to a step change in Vref generator 1')
ylabel('change in voltage PU')
xlabel('time s')
The response plot is shown in Figure 16.

Figure 16 Response of terminal voltage at bus 1 to change in Vref generator 1:


computed using a sparse linearized model

©Graham Rogers 2000-2008 All rights reserved 37


sr_full Function Decriptions

2.13 sr_full
2.13.1 Syntax
[r,t] = sr_full(sps,strsps,n,vin,tfin,tstep,varargin);

2.13.2 Purpose
Calculates the response of one system output to one system input using the full system model obtained
from fullssm. A stsp object is formed with the selected input and output, and the response is determined by
the stsp function stepres.

2.13.3 Inputs
sps - full linear power system model
strsps - the model structure
n - network object
vin - the magnitude of the input disturbance
tfin - the period of the response in seconds
tstep - integration time step s
varargin - input and output specifications, see Table 1 and Table 2

2.13.4 Outputs
r - the time response of the specified output to a change in the specified input
t - the time vector

2.13.5 Example
For the two-area system with controls (d2a_sbegp) the response of the terminal voltage at bus 1 to a step
change in the exciter reference of generator 1 is calculated using
[rmf,tmf] = sr_full(sps,strsps,n,.01,10,0.01,'vref',1,'vmag',1);
plot(tmf,rmf)
title('response of terminal voltage at bus 1 to a step change in Vref generator 1')
ylabel('change in voltage PU')
xlabel('time s')
The response plot is shown in Figure 17, and it can be seen to be identical to Figure 16.

Figure 17 Response of terminal voltage at bus 1 to change in Vref generator 1:


computed using a full linearized model

©Graham Rogers 2000-2008 All rights reserved 38


lineoutf Function Decriptions

2.14 lineoutf
2.14.1 Syntax
[clo,dlo] = lineoutf(sps,strsps,n,l_idx);

2.14.2 Inputs
sps - full linearized power system model stsp object
strsps - system specification structure
n - solved net_c class object
l_idx - optional index of lines for which the line quantities output matrices will be calculated
if l_idx is not supplied the output matrices are calculated for all lines

2.14.3 Outputs
clo = [c_pf;c_pt;c_qf;c_tf;c_ifm;c_itm]
c_pf - output matrix for active power flow at from buses
c_pt - output matrix for active power flow at the to buses
c_qf - output matrix for reactive power flow at from buses
c_qt - output matrix for reactive power flow at the to buses
c_ifm - output matrix for current magnitude at the from buses
c_itm - output matrix for current magnitude at the to buses
dlo = [d_pf;d_pt;d_qf;d_tf;d_ifm;d_itm]
d_pf - feedforward matrix for active power flow at from buses with the system inputs
d_pt - feedforward output matrix for active power flow at the to buses with the system inputs
d_qf - feedforward output matrix for reactive power flow at from buses with the system inputs
d_qt - feedforward output matrix for reactive power flow at the to buses with the system inputs
d_ifm - feedforward output matrix for current magnitude at the from buses with the system inputs
d_itm - feedforward output matrix for current magnitude at the to buses with the system inputs

2.14.4 Example
For the two area system (d2a_sbegp), the output matrices for line 5 may be calculated using

[clo,dlo] = lineoutf(sps,strsps,n,5);
c_lo =
Columns 1 through 9
2.8408 0 1.2336 1.3159 0.12395 1.253 0 0 0
1.2148 0 0.36543 0.38979 0.072786 0.73577 0 0 0
0.1726 0 -0.37344 -0.39833 0.062257 0.62934 0 0 0
1.693 0 -0.53858 -0.57448 0.22934 2.3183 0 0 0
0.94227 0 0.3788 0.40406 0.044822 0.45309 0 0 0
0.95989 0 0.41548 0.44318 0.042048 0.42505 0 0 0
Columns 10 through 18
0 0 0 0 0 0 0 0 4.7333
0 0 0 0 0 0 0 0 1.8721
0 0 0 0 0 0 0 0 -0.13256
0 0 0 0 0 0 0 0 1.6273
0 0 0 0 0 0 0 0 1.5415
0 0 0 0 0 0 0 0 1.5981
Columns 19 through 27
0 1.7543 1.8712 0.31115 2.4351 0 0 0 0
0 0.46711 0.49825 0.16004 1.2525 0 0 0 0
0 -0.6764 -0.72149 0.093568 0.73227 0 0 0 0
0 -1.1788 -1.2574 0.39754 3.1112 0 0 0 0
0 0.52883 0.56408 0.10827 0.84729 0 0 0 0

©Graham Rogers 2000-2008 All rights reserved 39


lineoutf Function Decriptions

0 0.59039 0.62975 0.10536 0.82456 0 0 0 0


Columns 28 through 36
0 0 0 0 0 0 0 -3.3823 0
0 0 0 0 0 0 0 -1.0275 0
0 0 0 0 0 0 0 0.79536 0
0 0 0 0 0 0 0 0.67909 0
0 0 0 0 0 0 0 -1.0541 0
0 0 0 0 0 0 0 -1.0672 0
Columns 37 through 45
-0.43595 -0.46501 -0.27511 -2.781 0 0 0 0 0
0.057621 0.061463 -0.10677 -1.0794 0 0 0 0 0
0.70644 0.75354 -0.009025 -0.091235 0 0 0 0 0
1.6657 1.7767 -0.1374 -1.389 0 0 0 0 0
-0.094944 -0.10127 -0.090731 -0.91717 0 0 0 0 0
-0.14619 -0.15594 -0.085752 -0.86684 0 0 0 0 0
Columns 46 through 54
0 0 0 0 0 0 -4.7009 0 -0.35794
0 0 0 0 0 0 -1.2642 0 0.21827
0 0 0 0 0 0 1.6262 0 1.1233
0 0 0 0 0 0 2.3047 0 2.7872
0 0 0 0 0 0 -1.4297 0 -0.041151
0 0 0 0 0 0 -1.4907 0 -0.1278
Columns 55 through 63
-0.38181 -0.54324 -4.2514 0 0 0 0 0 0
0.23282 -0.19924 -1.5593 0 0 0 0 0 0
1.1981 0.019031 0.14894 0 0 0 0 0 0
2.973 -0.17501 -1.3697 0 0 0 0 0 0
0.043895 -0.17666 -1.3826 0 0 0 0 0 0
-0.13632 -0.16985 -1.3293 0 0 0 0 0 0
Columns 64 through 72
0 0 0 0 0 0.27689 -0.13216 0.23974 0.21981
0 0 0 0 0 0.089826 -0.004643 0.056411 0.054897
0 0 0 0 0 -0.062222 0.1439 -0.10855 -0.0948
0 0 0 0 0 -0.059535 0.32136 -0.18447 -0.17625
0 0 0 0 0 0.086485 -0.033543 0.071179 0.065581
0 0 0 0 0 0.093319 -0.043315 0.076392 0.073945

dlo = zeros(6,16)

2.15 lineouts
2.15.1 Syntax
[clo,dlo] = lineouts(suc,strsuc,n,l_idx);

2.15.2 Inputs
suc - sparse linearized power system model stsp object
strsuc - system specification structure
n - solved net_c class object
l_idx - optional index of lines for which the line quantities output matrices will be calculated
if l_idx is not supplied the output matrices are calculated for all lines

2.15.3 Outputs
clo = [c_pf;c_pt;c_qf;c_tf;c_ifm;c_itm]
c_pf - output matrix for active power flow at from buses
c_pt - output matrix for active power flow at the to buses
c_qf - output matrix for reactive power flow at from buses
c_qt - output matrix for reactive power flow at the to buses
c_ifm - output matrix for current magnitude at the from buses
c_itm - output matrix for current magnitude at the to buses
dlo = [d_pf;d_pt;d_qf;d_tf;d_ifm;d_itm]
d_pf - feedforward matrix for active power flow at from buses with the system inputs
d_pt - feedforward output matrix for active power flow at the to buses with the system inputs

©Graham Rogers 2000-2008 All rights reserved 40


Graphical User Interface Function Decriptions

d_qf - feedforward output matrix for reactive power flow at from buses with the system inputs
d_qt - feedforward output matrix for reactive power flow at the to buses with the system inputs
d_ifm - feedforward output matrix for current magnitude at the from buses with the system inputs
d_itm - feedforward output matrix for current magnitude at the to buses with the system inputs

2.15.4 Example
For the two area system (d2a_sbegp), the output matrices for line 5 may be calculated using

[clo,dlo] = lineouts(suc,strsuc,n,5);

The output matrices are sparse versions of those obtained from lineoutf.

©Graham Rogers 2000-2008 All rights reserved 41


Graphical User Interface

2.16 svm_sys
2.16.1 Syntax
svm_sys

2.16.2 Purpose
The script file svm_sys performs the tasks necessary for small signal stability of power systems. The data
must be in the form of MATLAB files in the format required for MatNetEig.

2.16.3 Example

The routine asks if you wish to load a solved network object, through a question box.

If yes is clicked, a file box is displayed to enable the network file to be loaded.

If no is clicked, the network object will be formed from a data file which is asked for as below.

©Graham Rogers 2000-2008 All rights reserved 42


Graphical User Interface

Following the network solution, the type of analysis must be specified

2.16.3.1 Full modal analysis


When the analysis is complete, the workspace is saved (as a MATLAB binary (*.mat) file chosen by the
user.

The workspace contains the small system stability model, and network objects, and the modal analysis
results.

©Graham Rogers 2000-2008 All rights reserved 43


Graphical User Interface

A frequency against damping ratio plot is generated.

©Graham Rogers 2000-2008 All rights reserved 44


Graphical User Interface

2.16.3.2 Sparse modal analysis


If the option for sparse modal analysis is chosen, the initial bias point is requested.

The five eigenvalues closest to the bias point are calculated and displayed on an argand diagram.

An additional bias point is requested, if no is clicked the eigenvalue calculation finishes, if yes, the bias
point screen reappears

The eigenvalues found in the second pass are displayed in red

©Graham Rogers 2000-2008 All rights reserved 45


Graphical User Interface

After 5 passes with bias points iπ, i2π, i3π, and i4π, the found eigenvalues are

The damping ratio/ frequency plot is displayed for the found modes.

©Graham Rogers 2000-2008 All rights reserved 46


Graphical User Interface

3 Graphical User Interface


A simple Graphical User Interface is provided. It is invoked by typing SSView at the MATLAB command
line.

The menu items are as follows:

File
open
network - opens a solved net_c class object from file
dynamic case - opens a solved dynamic data case from file
import imports data from a PSS1 data file and initializes models
save saves solved case as a MATLAB mat file
close closes the graphical user interface
View Network opens the network GUI, netview
View Modes opens a GUI which displys the modes
Response opens a GUI which acts as a driver for frequency and step response

A solved network or a dynamic case may be imported using the File - open option.
A network and small signal model may be constructed from data in PSSV1 form (as in the MatNetEig data
file) using the File - import option
A solved dynamic case may be saved as a MATLAB mat-file by using the File - save option
The graphical user interface is closed using the File - close option

©Graham Rogers 2000-2008 All rights reserved 47


Graphical User Interface

Figure 18 SSView Screen, the two-area system (d2asbegp) has been loaded from file
Using the import option and choosing d2asbegp from the MatNetEig data file, brings up the screen shown
in Figure 18. A loadflow is automatically performed using the network object obtained from the data file.
The solved network may be viewed by clicking the viewnetwork menu item.

Either full or sparse modal analysis may be performed by clicking the respective control button. In this case
full modal anaysis is performed.

The modal analysis results may be displayed by choosing the View Modes menu item, which brings up the
View Modes screen shown in Figure 19.

The eigenvalues may be displayed as real and imaginary parts or damping ratios and frequencies by
clicking the change view button. The initail display is set to real and imaginary parts. Either all eigenvalues
may be displayed or only those with damping less than a user specified damping ratio. The eigenvectors
and participation vectors associated with the selected mode are displayed, and the state variable associated
with a selected eigenvector or participation vector is identiified by name and number.

In this example, there are no modes with damping ratio less than 0.05. All modes are avaible in the intitial
View Modes screen shown in Figure 19. Those with a damping ratio less than 0.2 are shown in Figure 20.
The state having the highest participation in the 3.917 Hz mode is the angle of generator 3.

©Graham Rogers 2000-2008 All rights reserved 48


Graphical User Interface

Figure 19 The View Modes Screen

Figure 20 The View Modes Screen with those modes with damping ratios less than
0.2 chosen and the maximum participation displayed

©Graham Rogers 2000-2008 All rights reserved 49


Graphical User Interface

Frequency or step response may be performed by selecting the Response menu item. This brings up the
screen shown in Figure 21, which is used to select the response inputs and outputs and the type of response
calculation.

Figure 21 The InputOutput Screen

Frequency response may be calculated for either, single input sysems, in which case the magnitude and
phase are plotted against frequency, or multi-input systems multi-output systems, in which case the
maximum singlar value of the response is plotted. Step response may be calculated for single input,
multiple output systems. Response calculations are performed using sparse system models.

The response of the bus 1 voltage magnitude to a change in generator 1 exciter voltage reference would be
obtained by making the choices shown in Figure 21. In Figure 22, the response of the frequency at bus 4 to
the exciter voltage reference of bus 1 is selected. The frequency response selection screen, Figure 23, is
displayed, and either a logarithmic or linear scale may be chosen. The response is calculated and displayed
as a MATLAB figure following selection of the Continue button. The result is the bode diagram shown in
Figure 24.

The multivariable response of bus frequency to active load modulation is initiated by the choices shown in
Figure 25 and 26, and is shown in Figure 27.

The response of the bus frequencies to a step change in the active load load at bus 4 is obtained using the
choices shown in Figure 28, selecting the Step Response option, and taking the choices shown in Figure 29.
The response is shown in Figure 30.

©Graham Rogers 2000-2008 All rights reserved 50


Graphical User Interface

Figure 22 InputOutput screen set up for response calculation

Figure 23 Frequency selection screen

©Graham Rogers 2000-2008 All rights reserved 51


Graphical User Interface

Figure 24 Bode diagram of the response of the frequency at bus 4 to active load
modulation at that bus

Figure 25 InputOutput screen set up for multivariable frequency response

©Graham Rogers 2000-2008 All rights reserved 52


Graphical User Interface

Figure 26 Frequency response parameter selection screen

Figure 27 Maximum singular value of bus frequency at all buses to active load
modulation

©Graham Rogers 2000-2008 All rights reserved 53


Graphical User Interface

Figure 28 InputOutput screen set up for step response

Figure 29 Step Response Parameter Screen

©Graham Rogers 2000-2008 All rights reserved 54


Graphical User Interface

Figure 30 Response of bus frequency to a step change of 0.1 in Vref Generator 1

©Graham Rogers 2000-2008 All rights reserved 55

You might also like