TRANSIENT STABILITY ANALYSIS OF A SAMPLE
FOUR MACHINE SYSTEM USING MATLAB
A PROJECT REPORT
Submitted by
Members of Group 5
Fei Gao
Supriya Chathadi
Changxu Chen
Habibou Maiga
Submitted to
Dr. Vijay Vittal
In partial fulfillment for completion of the course
EEE598: POWER SYSTEM STABILITY
at
ARIZONA STATE UNIVERSITY, TEMPE
EEE598-Group 5
Arizona State University 2
Table of Contents
1. Introduction ............................................................................................................................. 3 2. Machine Modelling ................................................................................................................... 3
2.1. Two-Axis Model ...................................................................................................................3 2.1.1. Initial Conditions ..................................................................................................... 3
2.2. E’’ Model ..............................................................................................................................4 2.2.1. Initial Conditions ..................................................................................................... 5
2.3. Classical Model .....................................................................................................................5 2.3.1. Initial Conditions ..................................................................................................... 6
3. Network Parameters ................................................................................................................ 6 4. Simulation using MATLAB ...................................................................................................... 7 5. Results ..................................................................................................................................... 7
5.1. Without Damping..................................................................................................................7
5.2. With Damping .......................................................................................................................9 6. Conclusion ............................................................................................................................. 10 7. References ............................................................................................................................. 10
APPENDIX: MATLAB CODES .................................................................................................... i
EEE598-Group 5
Arizona State University 3
1. Introduction
The sample four-machine two-area system [1] was analyzed in project 1, and the critical
clearing time was determined, for a three-phase fault at bus 5. The same system is now taken
into account for transient stability analysis using Matlab.
Many simplified models such as E’’, two-axis and classical models are used for the purpose
of study. In this specific case, the machines are modelled as shown below.
Machine 1 – Two-axis model
Machines 2 and 3 – E’’ model
Machine 4 – Classical model
The machine parameters are taken from the dynamic file of project 1. And the missing
parameters are assumed from example 12.6 of reference [1].
2. Machine Modelling
Different machines are modelled differently as specified in the previous section. The
differential equations and the initial conditions which define every model are explained
below.
2.1. Two-Axis Model
The two-axis model is a simplified way to model a synchronous machine, in which only the
transient effects are taken into account and the sub-transient effects are neglected. The
machine is represented by an equivalent circuit which has transient emf and reactance.
2.1.1. Initial Conditions
Before doing the initial condition calculations, all the generator parameters are converted into
a common system base, i.e., basesys gen
base
SX X
G , base
sys gen
base
GH H
S .
The initial conditions of the two-axis model are calculated from the equations shown below.
Currents, voltages along with their angles from the q-axis are calculated.
,
EEE598-Group 5
Arizona State University 4
sin,cos axar IIII
1tanq r x
a r q x
x I rI
V rI x I
cosq aI I
sind aI I
cos( )q tV V
sin( )d tV V
The field current is calculated, from which all the flux linkages are obtained.
q Q d d FDE V rI x I E
3F
AD
d d d AD F
Ei
L
L i L i
q q qL i
D AD d AD FL i L i
Q AQ qL i
/ 3D D
/ 3Q Q
The two-axis model is represented by the following equations.
' '
d d d dL i
' '
q q q qL i
' '
q de
' '
d qe
1Rw
' ' / 3d dE e
' ' / 3q qE e
2.2. E’’ Model
Both transient and sub-transient effects are accounted for in this case. The machine is
modeled by neglecting the transformer voltage terms compared to the speed voltage terms in
the stator voltage equations. The E” model is relatively a detailed model among the various
simplified models, where a machine is represented by the sub-transient emf and reactance.
EEE598-Group 5
Arizona State University 5
Where:
2.2.1. Initial Conditions
The initial condition calculations are quite similar to the procedure followed for two-axis
model. Currents, voltages and flux linkages are obtained from the same equations, as
mentioned earlier and E” model is represented by the following.
'' ''
d d d dL i '' ''
q q q qL i
'' ''
q de
'' ''
d qe
'' '' / 3d dE e
'' '' / 3q qE e
2.3. Classical Model
EEE598-Group 5
Arizona State University 6
Classical model is the simplest way of modeling a machine, which assumes that the
mechanical power input remains constant during the period of transient and the damping
power is neglected. Thus, the machine is modeled as constant voltage behind transient
reactance, with network parameters in steady state.
2.3.1. Initial Conditions
For classical model, the initial value for power angle is obtained from internal voltage
gen gen
t
t
P jQE V
V
, ( )angle E , the direction of E is set as q axis. The values for the Vt,
Pgen and Qgen are obtained from the power flow data. The angle between current and q axis
is ( )tangle V , and then
cos ,q aI I
sin ,d aI I
3. Network Parameters
Step 1: Calculate Zeq for all the generators, based on the model used.
1
'
d
eq
q
r xZ T T
x r
cos sin
sin cosT
The sub-transient reactances are used in the above equation if it is an E” model.
Step 2: As the values of Eq and Ed are known, the current equations can be written as
follows. 1
1
'
d
eq
q
r xY T T
x r
1'
' '
dQ Qq
eq
qD Dd
r xI VET Y
x rI VE
Step 3: From the values of passive network parameters, the equations can be further modified
as shown.
Q Q
D D
I VG B
I VB G
EEE598-Group 5
Arizona State University 7
Q Q DI GV BV
D Q DI BV GV
Step 4: Thus the voltages can be calculated from the below equation.
1
0
Q eq
augument
D
V IY
V
4. Simulation using MATLAB
Step 1: Read the data from the dynamic data file and the power-flow data file.
Step 2: Generate Y-bus for pre-fault, faulted and post-fault conditions.
Step 3: Model the generators using the appropriate differential equations and initial values,
corresponding to the model used.
Step 4: Integrate the differential equations to calculate the values of angle δ and angular
speeds, and use Euler’s method to find their values at various time steps.
Step 5: Plot the relative rotor angles, which would give a measure of the stability of the
system.
Step 6: By trial and error method, find out the critical clearing time for a 3-phase fault at bus
5 of the system.
The Mat lab codes are shown in Appendix
5. Results
From the simulation, it is seen that the clearing time for a 3-phase fault is dependent on the
damping co-efficient used. When there is no damping (as specified in [1]), the critical
clearing time for a 3-phase fault at bus 5 is approximately 9 cycles. If damping is included
(say, D=2 p.u. from Appendix D of reference [2]), the critical clearing time appears to be
10.6 cycles. The relative power angle plots for stable, critically stable and unstable cases;
with and without damping are shown below.
5.1. Without Damping
EEE598-Group 5
Arizona State University 8
Fig. 1: Stable System (4 cycles)
Fig. 2: Marginally Stable System (9 cycles)
0 0.5 1 1.5 2 2.5 3 3.5 4-80
-60
-40
-20
0
20
40
60
80Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
0 0.5 1 1.5 2 2.5 3 3.5 4-100
-50
0
50
100
150Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
EEE598-Group 5
Arizona State University 9
Fig. 3: Unstable System (9.1 cycles)
5.2. With Damping
Fig. 4: Stable System (8 cycles)
0 0.5 1 1.5 2 2.5 3 3.5 4-100
-50
0
50
100
150
200Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
0 0.5 1 1.5 2 2.5 3 3.5 4-80
-60
-40
-20
0
20
40
60
80
100
120Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
EEE598-Group 5
Arizona State University 10
Fig. 5: Marginally Stable System (10.6 cycles)
Fig. 6: Unstable System (10.7 cycles)
6. Conclusion
To conclude, it is seen that a three phase fault applied at bus 5 of the sample four-machine,
two area system has a critical clearing time of about 9 cycles without damping and 10.6
cycles, when damping is included. This is also dependant on the type of model used for
modeling each machine.
7. References
[1] P. Kundur, “Power System Stability and Control”, McGraw-Hill, Inc., Publications, 1994
0 0.5 1 1.5 2 2.5 3 3.5 4-100
-50
0
50
100
150Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
0 0.5 1 1.5 2 2.5 3 3.5 4-100
-50
0
50
100
150
200
250
300
350
400Relative Power Angles
Time, seconds
Delta,
degre
es
Gen1
Gen2
Gen3
Gen4
EEE598-Group 5
Arizona State University 11
[2] P.M. Anderson and A.A. Fouad, “Power System Control and Stability”, A John Wiley
and Sons, Inc., Publications, 2003.
EEE598-Group 5
Arizona State University i
APPENDIX: MATLAB CODES
MAIN.M
%********* Transient simulation Controls and options***************** %******************************************************************** %System base Sbn=100; w=1; %initial angluar speed and frequency omega = [1,1,1,1]; f=60; %faulted bus bfault=5; %simualation duration in seconds tsend=5; % Time when fault is applied in seconds tfault=0.1; %Duration of the fault in cycles tclear=9; %Time when fault is cleared in Cyles tfclear = tfault + tclear/60; %simulation steps dtime = 0.001;
%************************Initial condition calculations***************** %***********************************************************************
% Machine dynamic data [r,xd,xdtr,xdstr,xq,xqstr,xqtr,xl,H,D,td0tr,td0str,tq0tr,tq0str,x,Ldstr,Ldt
r,Ld,Lqstr,Lqtr,Lq,ld,lq,LAD,LF,LD,LAQ,LG,LQ,lF,lD,lG,lQ,K1,K2,K3,K4,Kd,Kq,
xxd,xxq,tj] = inputdyn(Sbn);
% Y matrice and power flow input data [nbus,ngen,Y,B,G,v,vang,Pg,Qg] = inputpf(Sbn);
% Initial conditon values of Machines [Vt,It,Ia,E,PF,Ir,Ix,deltabeta,gamma,delta,Id,Iq,Vq,Vd,Efd,iq,id,vq,vd,iF,L
amd,LamF,LamD,LamAD,Lamq,LamG,LamQ,LamAQ,Tm,Eq,Ed,Edtr,Eqtr,Edstr,Eqstr] =
inicond(w,ngen,v,vang,Pg,Qg,xqtr,xdtr,Lqstr,Ldstr,xq,xd,r,LAD,Ld,LAQ,Lq,LF)
;
%Ieq calculations and injected current vector. initial injected currents. Ii=zeros(2*nbus,1); [Ii] =
ieqcalc(Ii,ngen,delta,xqtr,xdtr,xqstr,xdstr,Ed,E,Edtr,Eqtr,Edstr,Eqstr);
%Y augmented matrix [Yeq,Y1,Y2] = yaugmented(nbus,ngen,B,G,bfault,x);
%********************Fault Simulation************************************* %*************************************************************************
Vexy=eye(12)/(Y1)*(Ii);
EEE598-Group 5
Arizona State University ii
for k=1:nbus Ve(k)=Vexy(2*k-1)+1i*Vexy(2*k); end
%*********** start itegrations******************************
%pointer recording data cur = 1;
for t = 0:dtime:tsend
for k = 4; % gen4, Classical model
Te(k) =abs(E(k))*Iq(k); Ve(k) = abs(E(k));
end for k=2 % gen2 and 3, E" model
dLamD = (-LamD(k) + Eqtr(k) + (xdtr - xl)*Id(k))/td0str; dEqtr = (-Eqtr(k) + Efd(k) -Kd*Eqtr(k) + Kd*LamD(k) +
xxd*Id(k))/td0tr; LamD(k) = LamD(k) + dLamD*dtime; Eqtr(k) = Eqtr(k) + dEqtr*dtime; Eqstr(k) = K1*Eqtr(k) + K2*LamD(k); dLamQ = (-LamQ(k) - Edtr(k) + (xqtr - xl)*Iq(k))/tq0str; dEdtr = (-Edtr(k) - Kq*Edtr(k) - Kq*LamQ(k) - xxq*Iq(k))/tq0tr; LamQ(k) = LamQ(k) + dLamQ*dtime; Edtr(k) = Edtr(k) + dEdtr*dtime; Edstr(k) = K3*Edtr(k) - K4*LamQ(k); Te(k) = (Eqstr(k)*Iq(k) + Edstr(k)*Id(k)); t; dEdtr; end for k=3 dLamD = (-LamD(k) + Eqtr(k) + (xdtr - xl)*Id(k))/td0str; dEqtr = (-Eqtr(k) + Efd(k) -Kd*Eqtr(k) + Kd*LamD(k) +
xxd*Id(k))/td0tr; LamD(k) = LamD(k) + dLamD*dtime; Eqtr(k) = Eqtr(k) + dEqtr*dtime; Eqstr(k) = K1*Eqtr(k) + K2*LamD(k); dLamQ = (-LamQ(k) - Edtr(k) + (xqtr - xl)*Iq(k))/tq0str; dEdtr = (-Edtr(k) - Kq*Edtr(k) - Kq*LamQ(k) - xxq*Iq(k))/tq0tr; LamQ(k) = LamQ(k) + dLamQ*dtime; Edtr(k) = Edtr(k) + dEdtr*dtime; Edstr(k) = K3*Edtr(k) - K4*LamQ(k); Te(k) = (Eqstr(k)*Iq(k) + Edstr(k)*Id(k)); end for k = 1;% gen1, two axis model dEdtr(k) = (-Edtr(k) - (xq-xqtr)*Iq(k))/tq0tr; dEqtr(k) = (Efd(k) - Eqtr(k) + (xd-xdtr)*Id(k))/td0tr; Edtr(k) = Edtr(k) + dEdtr(k)*dtime; Eqtr(k) = Eqtr(k) + dEqtr(k)*dtime;
EEE598-Group 5
Arizona State University iii
Te(k) = Edtr(k)*Id(k) + Eqtr(k)*Iq(k); end
dLamD = (-LamD(k) + Eqtr(k) + (xdtr - xl)*Id(k))/td0str; dEqtr = (-Eqtr(k) + Efd(k) -Kd*Eqtr(k) + Kd*LamD(k) +
xxd*Id(k))/td0tr; LamD(k) = LamD(k) + dLamD*dtime; Eqtr(k) = Eqtr(k) + dEqtr*dtime; Eqstr(k) = K1*Eqtr(k) + K2*LamD(k); dLamQ = (-LamQ(k) - Edtr(k) + (xqtr - xl)*Iq(k))/tq0str; dEdtr = (-Edtr(k) - Kq*Edtr(k) - Kq*LamQ(k) - xxq*Iq(k))/tq0tr; LamQ(k) = LamQ(k) + dLamQ*dtime; Edtr(k) = Edtr(k) + dEdtr*dtime; Edstr(k) = K3*Edtr(k) - K4*LamQ(k); Te(k) = (Eqstr(k)*Iq(k) + Edstr(k)*Id(k)); Ve(k) = Eqii(k) + j*Edii(k); %*****************************************************************
% torque equations and delta is updated domega = (Tm - D*(omega-1) - Te)/tj; omega = omega + domega*dtime; ddelta = omega - 1; delta = delta + ddelta*dtime*2*pi*f;
IDQ = Ii(1:2*ngen) - Yeq*Vexy(1:2*ngen); if(t >= tfault && t <= tfclear) Vexy = eye(2*nbus)/(Y2)*Ii; else Vexy = eye(2*nbus)/(Y1)*Ii; end
%update values with new delta for next iteration
for k=1:ngen if k == 4 %gen4, Classical model gx(k) = cos(delta(k))/xqtr; bx(k) = sin(delta(k))/xdtr; by(k) = sin(delta(k))/xqtr; gy(k) = -cos(delta(k))/xdtr; Ixi(k) = gx(k)*Ed(k) + bx(k)*abs(E(k)); Iyi(k) = by(k)*Ed(k) + gy(k)*abs(E(k)); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); elseif k == 1 %gen1, Two axis model gx(k) = cos(delta(k))/xqtr; bx(k) = sin(delta(k))/xdtr; by(k) = sin(delta(k))/xqtr; gy(k) = -cos(delta(k))/xdtr; Ixi(k) = gx(k)*Edtr(k)+bx(k)*Eqtr(k); Iyi(k) = by(k)*Edtr(k)+gy(k)*Eqtr(k); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); else % gen2 and 3, E" model gx(k) = cos(delta(k))/xqstr; bx(k) = sin(delta(k))/xdstr; by(k) = sin(delta(k))/xqstr; gy(k) = -cos(delta(k))/xdstr;
EEE598-Group 5
Arizona State University iv
Ixi(k) = gx(k)*Edstr(k)+bx(k)*Eqstr(k); Iyi(k) = by(k)*Edstr(k)+gy(k)*Eqstr(k); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); end end
for k=1:ngen Iq(k) = cos(delta(k))*IDQ(2*k-1) + sin(delta(k))*IDQ(2*k); Id(k) = -sin(delta(k))*IDQ(2*k-1) + cos(delta(k))*IDQ(2*k); end % record resultomegas resultomega(1,cur) = t; resultomega(2:5,cur) = omega; resultdelta(1,cur) = t; resultdelta(2:5,cur) = delta*180/pi; % conversion to degree cur = cur + 1; end
%******************* plot the curves************************** %*************************************************************
close all
figure('name', 'relative power angles'); for k = 1:4 subplot(2,2,k); plot(resultomega(1,:),resultdelta(k+1,:)-resultdelta(4,:),'LineWidth',1.5); title(strcat('gen #',int2str(k))); xlabel('time (second)'); ylabel('\delta (degree)'); grid end figure('name', 'relative power angles'); plot(resultomega(1,:),resultdelta(1+1,:)-
resultdelta(4,:),':',resultomega(1,:),resultdelta(2+1,:)-
resultdelta(4,:),'--',resultomega(1,:),resultdelta(3+1,:)-
resultdelta(4,:),resultomega(1,:),resultdelta(4+1,:)-resultdelta(4,:),'-
.'); legend('Gen1','Gen2','Gen3','Gen4') grid
INPUTDYN.M
function
[r,xd,xdtr,xdstr,xq,xqstr,xqtr,xl,H,D,td0tr,td0str,tq0tr,tq0str,x,Ldstr,Ldt
r,Ld,Lqstr,Lqtr,Lq,ld,lq,LAD,LF,LD,LAQ,LG,LQ,lF,lD,lG,lQ,K1,K2,K3,K4,Kd,Kq,
xxd,xxq,tj] = inputdyn(Sbn)
Sbold= 900;
% Machine dynamic data from kundur book example 12.6 r=0; xd=1.8; xdtr=0.3; xdstr=0.25; xq=1.7; xqtr=0.55;
EEE598-Group 5
Arizona State University v
xqstr=0.25; xl=0.2; H=6.5; D=0; td0tr=8; td0str=0.03; tq0tr = 0.4; tq0str = 0.05;
% conversion to new base
r=r*Sbn/Sbold; xd=xd*Sbn/Sbold; xdtr=xdtr*Sbn/Sbold; xdstr=xdstr*Sbn/Sbold; xq=xq*Sbn/Sbold; xqtr=xqtr*Sbn/Sbold; xqstr=xqstr*Sbn/Sbold; xl=xl*(Sbn/Sbold); H=H/(Sbn/Sbold); D=D/(Sbn/Sbold);
% vector that stores all the reactances
x=[xdtr;xdstr;xdstr;xdtr];%Two-axis,E",E",Classical
% Machine inductances calculations in per unit
Ldstr = xdstr; Ldtr = xdtr; Ld = xd; Lqstr = xqstr; Lqtr = xqtr; Lq = xq; ld = xl; lq = ld; LAD = Ld - ld; LF = LAD^2/(Ld - Ldtr); LD = LAD^2/LF + (Ldtr - ld)^2/(Ldtr - Ldstr); LAQ = Lq - lq; LG = LAQ^2/(Lq - Lqtr); LQ = LAQ^2/LG + (Lqtr - lq)^2/(Lqtr - Lqstr); lF = LF - LAD; lD = LD - LAD; lG = LG - LAQ; lQ = LQ - LAQ;
%Constantes described in AA found book on page 137
K1 = (xdstr - xl)/(xdtr - xl); K2 = 1 - K1; K3 = (xqstr - xl)/(xqtr - xl); K4 = 1 - K3; Kd = (xd - xdtr)*(xdtr - xdstr)/(xdtr - xl)^2; Kq = (xq - xqtr)*(xqtr - xqstr)/(xqtr - xl)^2; xxd = (xd - xdtr)*(xdstr - xl)/(xdtr - xl); xxq = (xq - xqtr)*(xqstr - xl)/(xqtr - xl); tj = 2*H;
EEE598-Group 5
Arizona State University vi
end
INPUTPF.M
function [nbus,ngen,Y,B,G,v,vang,Pg,Qg] = inputpf(Sbn)
% *********************Power data**********************
% data are taken from the 4mflow file
% number of bus and generators nbus=6; ngen=4;
v=[1.03,1.01,1.03,1.01,0.9773,0.9898]; vang=[-44.25,-55.09,0,-9.85,-64.04,-18.08]; Pga=[790,790,719.19,740,0,0]; Qga=[77.59,363.59,71.85,212.38,0,0]; Pload=[0,0,0,0,1241,1699]; Qload=[0,0,0,0,100,100];
Pg=Pga/Sbn; Qg=Qga/Sbn; Pl=Pload/Sbn; Ql=Qload/Sbn;
vang=vang*pi/180; % convert angles from degrees to radians
% shunt impedances
yc=[0,0,0,0,1i*2.235,1i*2.58];
% line impedances
z12=2.5E-3+1i*2.5E-2; z25=1E-3+1i*1E-2; z34=2.5E-3+1i*2.5E-2; z46=1E-3+1i*1E-2; z56=2.2E-3+1i*2.2E-2;
%***** original Y matrix************* for k = 1:nbus
Yl(k) = (Pl(k) - 1i*Ql(k))/v(k)^2 - yc(k);
end
Y=zeros(nbus,nbus);
% off diagonal elements Y(1,2)=-1/z12; Y(2,1)=Y(1,2); Y(2,5)=-1/z25; Y(5,2)=Y(2,5);
EEE598-Group 5
Arizona State University vii
Y(5,6)=-1/z56; Y(6,5)=Y(5,6); Y(6,4)=-1/z46; Y(4,6)=Y(6,4); Y(4,3)=-1/z34; Y(3,4)=Y(4,3);
%**********diagonal elements
for m=1:nbus
for n=1:nbus Y(m,m) = (Y(m,m)-Y(m,n)); end
Y(m,m) = Y(m,m) + Yl(m); end
for m=1:nbus for n=1:nbus G(m,n)=real(Y(m,n)); B(m,n)=imag(Y(m,n)); end end end
INICOND.M function
[Vt,It,Ia,E,PF,Ir,Ix,deltabeta,gamma,delta,Id,Iq,Vq,Vd,Efd,iq,id,vq,vd,iF,L
amd,LamF,LamD,LamAD,Lamq,LamG,LamQ,LamAQ,Tm,Eq,Ed,Edtr,Eqtr,Edstr,Eqstr] =
inicond(w,ngen,v,vang,Pg,Qg,xqtr,xdtr,Lqstr,Ldstr,xq,xd,r,LAD,Ld,LAQ,Lq,LF)
% Initial conditon values of Machines
for j=1:ngen Vt(j) = v(j)*(cos(vang(j)) + 1i*sin(vang(j))); It(j) = (Pg(j) - 1i*Qg(j))/conj(Vt(j)); Ia(j)=abs(It(j)); E(j) = Vt(j) + It(j)*1i*xdtr; %internal voltage PF(j) = atan(Qg(j)/Pg(j)); Ir(j) = Ia(j)*cos(PF(j)); Ix(j) = -Ia(j)*sin(PF(j)); deltabeta(j) = atan((xq*Ir(j) + r*Ix(j))/(v(j) + r*Ir(j) - xq*Ix(j))); gamma(j) = deltabeta(j) + PF(j); delta(j) = deltabeta(j) + vang(j); Id(j)=-Ia(j)*sin(gamma(j)); Iq(j)=Ia(j)*cos(gamma(j)); Vq(j) = v(j)*cos(deltabeta(j)); Vd(j) = -v(j)*sin(deltabeta(j)); Efd(j)= Vq(j) - xd*Id(j); end
iq = sqrt(3)*Iq; id = sqrt(3)*Id; vq = sqrt(3)*Vq; vd = sqrt(3)*Vd;
EEE598-Group 5
Arizona State University viii
iF = sqrt(3)*Efd/LAD;
%****** FLux linkages*********************
Lamd = (Ld*id + LAD*iF)/sqrt(3); LamF = (LAD*id + LF*iF)/sqrt(3); LamD = (LAD*id + LAD*iF)/sqrt(3); LamAD = (LAD*(id + iF))/sqrt(3); Lamq = (Lq*iq)/sqrt(3); LamG = (LAQ*iq)/sqrt(3); LamQ = (LAQ*iq)/sqrt(3); LamAQ = (LAQ*iq)/sqrt(3);
Tm=zeros(ngen,1); Tm = (iq.*Lamd - id.*Lamq)/sqrt(3); % mechanical torque is equal to the
steady state electrical torque
% initial conditions % CASE : gen2 classical, gen 1 and 3 are E", gen 4 is two axis
% gen 2, classical model E1 = abs(E(2)); delta(2) = angle(E(2)); gamma(2) = delta(2) - vang(2) + PF(2); Iq(2) = Ia(2)*cos(gamma(2)); Id(2) = -Ia(2)*sin(gamma(2)); delta(1) = deltabeta(1) + vang(1); delta(3) = deltabeta(3) + vang(3); delta(4) = deltabeta(4) + vang(4); % ***************************************************************
% Ed and Eq initial conditions chap 4 page 132, 138,
for k=1:ngen if k == 4 % gen 4, classical model % we need t0 check this statement Eq(k) = E(k); Ed(k) = 0; elseif k == 1 % gen 1, two axis model Edtr(k)= Vd(k) + xqtr*Iq(k); Eqtr(k)= Vq(k) - xdtr*Id(k); else % gen 2 and 3, E” model Edtr(k)= Vd(k) + xqtr*Iq(k); Eqtr(k)= Vq(k) - xdtr*Id(k); Edstr(k) = -w*(Lamq(k) - Lqstr*Iq(k)); Eqstr(k) = w*(Lamd(k) - Ldstr*Id(k)); end end end
IEQCALC.M
function[Ii] =
ieqcalc(Ii,ngen,delta,xqtr,xdtr,xqstr,xdstr,Ed,E,Edtr,Eqtr,Edstr,Eqstr)
%Ieq calculations and injected current vector
for k=1:ngen
EEE598-Group 5
Arizona State University ix
% used to calculate Ieq %***** used to also build yeq*** if k == 4 % gen 4, classical model gx(k) = cos(delta(k))/xqtr; bx(k) = sin(delta(k))/xdtr; by(k) = sin(delta(k))/xqtr; gy(k) = -cos(delta(k))/xdtr; Ixi(k) = gx(k)*Ed(k) + bx(k)*abs(E(k)); Iyi(k) = by(k)*Ed(k) + gy(k)*abs(E(k)); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); %storing all the currents to
one vector Ii elseif k == 1 % gen 1, two axis model gx(k) = cos(delta(k))/xqtr; bx(k) = sin(delta(k))/xdtr; by(k) = sin(delta(k))/xqtr; gy(k) = -cos(delta(k))/xdtr; Ixi(k) = gx(k)*Edtr(k)+bx(k)*Eqtr(k); Iyi(k) = by(k)*Edtr(k)+gy(k)*Eqtr(k); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); else % gen 2 and 3, E” model gx(k) = cos(delta(k))/xqstr; bx(k) = sin(delta(k))/xdstr; by(k) = sin(delta(k))/xqstr; gy(k) = -cos(delta(k))/xdstr; Ixi(k) = gx(k)*Edstr(k)+bx(k)*Eqstr(k); Iyi(k) = by(k)*Edstr(k)+gy(k)*Eqstr(k); Ii(2*k-1) = Ixi(k); Ii(2*k) = Iyi(k); end end end
YAUGMENTED.M
function [Yeq,Y1,Y2] = yaugmented(nbus,ngen,B,G,bfault,x)
%Y augmented matrix
Y1=zeros(2*nbus,2*nbus); Y2=zeros(2*nbus,2*nbus);
for m=1:nbus
for n=1:nbus if(m==n && n<=ngen) Y1(2*m-1,2*n)=-B(m,n)+1/x(m); Y1(2*m,2*n-1)=B(m,n)-1/x(m);
Yeq(2*m-1,2*n)=+1/x(m); Yeq(2*m,2*n-1)=-1/x(m); else Y1(2*m-1,2*n)=-B(m,n); Y1(2*m,2*n-1)=B(m,n); end
Y1(2*m-1,2*n-1)=G(m,n); Y1(2*m,2*n)=G(m,n); end
%Y augmented matrix during the three phase fault at bus bfault
EEE598-Group 5
Arizona State University x
for m=1:2*nbus for n=1:2*nbus if( m~=n && (m==(2*bfault)|| n==(2*bfault)|| m==(2*bfault-1) ||
n==(2*bfault-1))) Y2(m,n)=0; elseif ((m==n && m==(2*bfault))|| (m==n && m==(2*bfault-1))) Y2(m,n)=99999999999; else Y2(m,n)=Y1(m,n); end end end end
Top Related