• Tidak ada hasil yang ditemukan

H 4.0;

Wo 100 * pi;

Jm 2*H / wo;

B 0.0;

Tdopr Xffd/(Wo * Rfd) ;

% Transmission line parameters Rline 0.0;

0.4;

0.1 ; Xline

xcscO

Zline Rline + j*(Xline-XcscO);

Ra Xd Xq Xdpr

Ra + Rline;

Xd + Xline-XcscO;

Xq + Xline-XcscO;

Xdpr + Xline-XcscO;

%AVR and Exciter initialisation data Ka 100;

Ta 1.0;

Tb 10.0;

Tr 0.01;

% Variable impedance parameters Tcsc 0.01;

Kc 0.1;

Xcscv 0;

%---Simulation Time Settings---%

deltat 0.002;

TO 0.5;

Tfinal 6;

Tflt 0.1;

%---

disp('Calculations in progress ... ');

%--- -- ---

% Calculate the machine terminal current It = (Pb-j*Qb) / Vinf;

pfAng = -angle (It);

% Calculate the load angle Eq

=

Vinf+(Ra + j*Xq)*It;

Langle

=

angle(Eq);

Id abs(It)*sin(Langle+pfAng);

Iq abs(It)*cos(Langle+pfAng);

la Id + j*Iq;

vq Vinf * cos (Langle) ; vd = Vinf * sin (Langle) ; Eqpr = vq + Ra*Iq + Xdpr*Id;

Eo Eqpr + (Xd - Xdpr)*Id;

Fi sqrt(2)*Eo/Xad;

Te Eqpr*Iq + Id*Iq*(Xq - Xdpr);

Pm = Te;

Vto = abs(vd+j*vq+la*Zline);

Vtm Vto;

Vref = Vto + Eo/Ka;

Vy = Ka * (Vref - Vto);

% States initialisation t=O;

x(l) 0;

x(2) Langle;

x(3) Eqpr;

x(4) Vtm;

x (5) Vy;

x(6) Xcscv;

% Non-linear differential equations are in subroutine swiftplt.m

% Given the parameters and initial operating conditions the

% subroutine calculates and returns the state variables.

[xdot,Id,Iq,Ia,Vt,Te,Efd] =

swiftplt(x,Zline,Vinf,Ra,Xd,Xdpr,Xq,Jm,B,Pm,Tdopr,Ka,Ta,Tb,Tr,Vref,Kc ,Tcsc) ;

% Integration loop

for h = O:deltat: (Tfinal-deltat),

% Applying a 3-phase disturbance at the generator terminals.

i f (t>=TO), vinf = 0;

end

\ Clearing the fault. if (t>= TO+Tflt),

Vinf = 1.0;

end

%Integrate differential equations y = x+xdot*deltat;

[ydot,Id,Iq,Ia,Vt,Te,Efd] =

swiftplt(y,Zline,Vinf,Ra,Xd,Xdpr,Xq,Jm,B,Pm,Tdopr,Ka,Ta,Tb,Tr,Vref,Kc ,Tcsc);

x = x+deltat*(xdot+ydot)/2;

[xdot,Id,Iq,Ia,Vt,Te,Efd] =

swiftplt(x,Zline,Vinf,Ra,Xd,Xdpr,Xq,Jm,B,Pm,Tdopr,Ka,Ta,Tb,Tr,Vref,Kc ,Tcsc);

t = t+deltat;

%Field current

Fi = sqrt(2)/Xad*(x(3) + Id*(Xd-Xdpr-2*x(6)));

%Setting Xcscv limits i f (x(6) >= 0.1),

x(6)= 0.1;

end

if(x(6) <= -0.1), x(6) = -0.1;

end

z = [z;t];

xo = [xo; x(2) abs(Ia) abs(Vt) Te Efd x(6) Fi x(l)];

end;

Simplified SMIB System MA TLAB Code

% Subroutine swiftplt.m

% Solves the differential equations and returns the state variables function [xdot,Id,Iq,Ia,Vt,Te,Efd] =

swiftplt(x,Zline,Vinf,Ra,Xd,Xdpr,Xq,Jm,B,Pm,Tdopr,Ka,Ta,Tb,Tr,Vref,Kc ,Tcsc)

Vinfd Vinfq

(Vinf)*sin(x(2)) ; (Vinf)*cos(x(2));

Xq = Xq - x ( 6) ; Xd = Xd - x ( 6) ; Xdpr

=

Xdpr - x(6);

Id Iq Te EfdI

(x(3) - Vinfq - Ra*Vinfd/Xq) / (Vinfd + Id*Ra) / Xq;

x(3) * Iq + Id*Iq*(Xq - Xdpr);

=

x(3) + Id*(Xd - Xdpr);

la = Id + j*Iq;

(Xdpr + Ra*Ra/Xq) ;

Vt = abs(Vinfd+j*Vinfq+la*(Zline-j*x(6)));

Efd

=

Ta*Ka*(Vref - x(4))/Tb + (1 - Ta/Tb)*x(s);

% State xdot(l) xdot(2) xdot(3) xdot(4) xdot(s) xdot(6)

variables

(Pm - Te - B * x(l)) / Jm;

x(l) ;

(Efd - EfdI) / Tdopr;

(Vt - x(4)) / Tr;

(Ka* (Vref - x(4)) - x(s)) / (Kc*x(l) - x(6)) /Tcsc;

E.3 Linearised SMIB System Code

Tb;

% Linearisation of the single-machine infinite bus

% non-linear model with the AVR and high-gain exciter

% and idealised CSC and the damping controls.

% Generator damper windings and stator transients are

% not represented.

global Ra Xd Xdpr Xq Jm B Pm Tdopr Ka Ta Tb Tr Kc Tws Zline Vref

% Initial conditions at the generator terminals Pb = 0.8;

Vinf = 1. 0;

Qb = 0.03;

% Generator Parameters Xad 0.85;

Xaq 0.45;

Xl

=

0.15;

Xfd 1. 03 i

Xd Xad + Xli Xq Xaq + Xli Xffd

=

Xad + Xfdi

Xdpr

=

Xl + Xad* Xfd/(Xad + Xfd)i

Ra 0.005;

Rfd 0.00065;

H 4.0;

Wo 100 * pi;

Jm 2*H j Wo;

B 0.0;

Tdopr Xffdj (Wo * Rfd) ;

% Transmission line parameters Rline

Xline Zline Ra Xd Xq Xdpr

0;

0.6;

Rline + j*Xline;

Ra + Rline;

Xd + Xline;

Xq + Xline;

= Xdpr + Xline;

% Calculate the machine terminal current It

=

(Pb-j*Qb) j Vinf;

pfAng = -angle (It);

% Solving for the internal angle Eq = vinf+(Ra + j*Xq)*It;

Langle = angle (Eq) ;

Id abs(It)*sin(Langle+pfAng);

Iq abs(It)*cos(Langle+pfAng);

la Id + j*Iq;

vq Vinf * cos (Langle) ; vd Vinf * sin (Langle) ; Eqpr = vq + Ra*Iq + Xdpr*Id;

Eo Eqpr + (Xd - Xdpr)*Id;

Fi sqrt(2)*EojXad;

Te Eqpr*Iq + Id*Iq*(Xq - Xdpr);

Pm Te;

% AVR and Exciter initialisation data

Ka 200;

Ta Tb Tr Vto Vtm Vref Vy

1. 0;

10.0;

0.01;

abs(vd+j*vq+la*Zline) ; Vto;

Vto + EojKa;

Ka * (Vref - Vto);

% Variable impedance parameters

Kc 0.1;

Tcsc 0.01;

Xcscv I

% Input vector at the steady state operating point about

% which to linearise numerically u = [Vinf; Eo; Pm; Vto];

XXO

=

[0; Langle; Eqpr; Vtm; Vy; Xcscv];

% Test this steady-state vector for correctness if necessary

Simplified SMIB System MA TLAB Code

[xdots] = avrpltsmiblin(O,XXO,u,l);

% Form linearised state space matrices using function linmod

% non-linear model equations for the SMIB

% are in subroutine avrsmiblin.m; steady-state operating

% point in state vector XXO

[AA,BB,CC,DD] = linmod('avrsmiblinblk',XXO,u,le-8);

eval = eig(AA);

x real (eval) ; y imag (eval) ;

% Subroutine avrsmiblin.m

% Contains the non-linear, differential equations

% describing the SMIB

function [sys,xO,str,ts] = avrpltsmiblin(t,x,u,flag)

%AVRPLTSMIBLIN General M-file S-function template

global Ra Xd Xdpr Xq Jm B Pm Tdopr Ka Ta Tb Tr Kc Tcsc Zline Vref switch flag,

% Initialization % case 0,

[sys, xO, str, ts] mdlInitializeSizes;

% Derivatives % case 1,

sys=mdlDerivatives(t,x,u) ;

end

% Outputs % case 3,

sys=mdlOutputs(t,x,u) ;

% Unused Flags%

case { 2, 4, 9 } sys=[] ;

% Unexpected flags % otherwise

error(['Unhandled flag

% end avrpltsmiblin

',num2str(flag)]) ;

%====================================================================

% mdlInitializeSizes

% Return the sizes, initial conditions, and sample times for the

% S-function.

%====================================================================

function [sys,xO,str,ts] = mdllnitializeSizes sizes = simsizes;

sizes.NumContStates 6;

sizes.NumDiscStates 0;

sizes.NumOutputs 2;

sizes.NumInputs 4;

sizes.DirFeedthrough 0;

sizes.NumSampleTimes = 1; % at least one sample time is needed sys = simsizes(sizes);

% initialize the initial conditions xO zeros(6,1);

% str is always an empty matrix str = [);

% initialize the array of sample times ts [0 0];

% end mdlInitializeSizes

%====================================================================

% mdlDerivatives

% Return the derivatives for the continuous states.

%====================================================================

function sys = mdlDerivatives(t,x,u)

global Ra Xd Xdpr Xq Jm B Pm Tdopr Ka Ta Tb Tr Kc Tcsc Zline Vref Vinf

Eo Pm Vto Vinfd Vinfq

U(l, 1) ; u(2,1);

u(3,1);

u (4,1) ;

(Vinf)*sin(x(2» ; (Vinf)*cos(x(2» ;

% Equations to be linearised Xq

=

Xq - x(6);

Xd = Xd - x(6);

Xdpr = Xdpr - x(6);

Id Iq Te EfdI

(x(3) - Vinfq - Ra*Vinfd/Xq) / (Vinfd + Id*Ra) / Xq;

x(3) * Iq + Id*Iq*(Xq - Xdpr);

= x(3) + Id*(Xd - Xdpr);

(Xdpr + Ra*Ra/Xq) ;

la = Vt Efd =

Id + j*Iq;

abs(Vinfd+j*Vinfq+Ia*(Zline-j*x(6») ; Ta*Ka*(Vref - X(4»/Tb + (1 - Ta/Tb)*x(S);

sYS(l,l) sys(2,1) sys(3,1) sys(4,1) sys(S,l) sys(6,1)

(Pm - Te - B * x(l» / Jm;

x(l) ;

(Efd - EfdI) / Tdopr;

(Vt - x(4» / Tr;

(Ka* (Vref - x(4» - x(S» / Tb;

(Kc*l*x(l) - x(6» /Tcsc;

% end mdlDerivatives

%====================================================================

% mdlOutputs

% Return the block outputs.

%====================================================================

function sys=mdlOutputs(t,x,u) sys (1 , 1) = x ( 1 , 1) ;

Simplified SMIB System MA TLAB Code

sys(2,1)= x(2,1);

% end mdlOutputs

[Angquist]

[Breuer]

[Chenl]

[Chen2]

[Choi]

[Choncol]

Dokumen terkait