ABCD Parameter MATLAB Code

len=300; res=0.016; ind=0.97e-03; cap=0.0115e-06;f=60.0;

kvll=500; mva3=1000;pf=0.8; flag=2;

% flag =1 for leading, flag=2 for lagging

clc;

mat=[]; re=[];

% line model lm=1 for short, 2 for medium -pi, 3 for medium-T

lm=input(‘Enter line model, 1 for short, 2 for medium pi, 3 for medium T :’);

l=ind*len;

c=cap*len;

r=res*len;

xl=2*pi*f*l;

z=complex(r,xl);

y=complex(0.0,(2*pi*f*c));

if lm==1

mat=[1.0 z;

0.0 1.0];

elseif lm==2

mat=[(1+(y*z/2)) z;

(y*(1+y*z/4)) (1+(y*z/2))];

else

mat=[(1+(y*z/2)) z*(1+y*z/4);

y (1+(y*z/2))];

end

xx=mat(1,1)*mat(2,2)-mat(1,2)*mat(2,1);

disp(‘ABCD CONSTANTS’);

disp(‘ ‘);

disp(‘ ‘);

disp(mat);

disp(‘ ‘);

disp(‘ ‘);

disp(‘AD-BC = ‘);

disp(xx);

vrm=1000*kvll/sqrt(3);

vr=complex(vrm,0.0);

irm=1000*mva3/(sqrt(3)*kvll);

sinpi=sin(acos(pf));

if(flag==1)

ir=irm*complex(pf,sinpi);

else

ir=irm*complex(pf,-sinpi);

end

re=[vr;ir];

se=mat*re;

vskv=sqrt(3)*abs(se(1))/1000;

iska=abs(se(2))/1000;

pr=3*real(re(1)*conj(re(2)))*1e-06;

ps=3*real(se(1)*conj(se(2)))*1e-06;

th1=angle(se(1));

th2=angle(se(2));

pfs=cos(th1-th2);

effn=100*pr/ps;

vr0=abs(se(1))/abs(mat(1,1));

reg=100*(vr0-vrm)/vrm;

cal=[vskv iska pr ps pfs effn reg];

disp(‘ ‘);

disp(‘ ‘);

disp(‘ Vs(L-L KV) Is(KA) Pr(MW)Ps(MW) PF(Send)%Effn %Reg ‘);

disp(‘ ‘);

disp(‘ ‘);

disp(cal);

**Output**:

Enter line model, 1 for short, 2 for medium pi, 3 for medium T :1

ABCD CONSTANTS

1.0e+02 *

0.0100 + 0.0000i 0.0480 + 1.0970i

0.0000 + 0.0000i 0.0100 + 0.0000i

AD-BC =

1

Vs(L-L KV) Is(KA) Pr(MW) Ps(MW) PF(Send) %Effn %Reg

661.4814 1.1547 800.0000 819.2000 0.6192 97.6563 32.2963