Multiline Outage

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

clc

clear all
%% Bus data Bus type 1(slack Bus),type2(PV_Bus Bus), type3(PQ_Bus Bus)
tic
% Bus Bus Vol Vol Generating Load Reactive Power
limit
% no type Mag angle Pg QG Pl Ql Qmax Qmin
busdata=[ 1 1 1.060 0 232.4 -16.9 0 0 -16.9 10;
2 2 1.045 0 40 42.4 21.7 12.7 -40 50;
3 2 1.010 0 0 23.4 94.2 19.0 0 40;
4 3 1.019 0 0 0 47.8 3.9 0 0;
5 3 1.020 0 0 0 7.6 1.6 0 0;
6 2 1.070 0 0 12.2 11.2 7.5 -6 24;
7 3 1.062 0 0 0 0.0 0.0 0 0;
8 2 1.090 0 0 17.4 0.0 0.0 -6 24;
9 3 1.056 0 0 0 29.5 16.6 0 0;
10 3 1.051 0 0 0 9.0 5.8 0 0;
11 3 1.057 0 0 0 3.5 1.8 0 0;
12 3 1.055 0 0 0 6.1 1.6 0 0;
13 3 1.050 0 0 0 13.5 5.8 0 0;
14 3 1.036 0 0 0 14.9 5.0 0 0];

% From To R X B Tap
% Bus Bus (pu) (pu) (pu) Ratio
linedata=[ 1 2 0.01938 0.05917 0.0264 1;
1 5 0.05403 0.22304 0.0246 1;
2 3 0.04699 0.19797 0.0219 1;
2 4 0.05811 0.17632 0.0170 1;
2 5 0.05695 0.17388 0.0173 1;
3 4 0.06701 0.17103 0.0064 1;
4 5 0.01335 0.04211 0.0 1;
4 7 0.0 0.20912 0.0 0.978;
4 9 0.0 0.55618 0.0 0.969;
5 6 0.0 0.25202 0.0 0.932;
6 11 0.09498 0.19890 0.0 1;
6 12 0.12291 0.25581 0.0 1;
6 13 0.06615 0.13027 0.0 1;
7 8 0.0 0.17615 0.0 1;
7 9 0.0 0.11001 0.0 1;
9 10 0.03181 0.08450 0.0 1;
9 14 0.12711 0.27038 0.0 1;
10 11 0.08205 0.19207 0.0 1;
12 13 0.22092 0.19988 0.0 1;
13 14 0.17093 0.34802 0.0 1];

%% Data arranged for Linedata in the different vector


fb=linedata(:,1);tb=linedata(:,2);
r=linedata(:,3);x=linedata(:,4);
b=linedata(:,5);a=linedata(:,6);
z=r+1i*x; % Impedance of branch
y=1./(z); % admittance of branch
b=1i*b;
nl=length(fb); % No of branch
nbus=max(max(fb),max(tb)); % No of Bus
BMva=100;
nl=input('Enter the number of lines : \n ');
Y=zeros(nbus,nbus);
for k=1:nl
Y(fb(k),tb(k))=Y(fb(k),tb(k))-y(k)/a(k);
Y(tb(k),fb(k))=Y(fb(k),tb(k));
end
for m=1:nbus
for n=1:nl
if fb(n)==m
Y(m,m)=Y(m,m)+y(n)/a(n)^2+b(n);
else if tb(n)==m
Y(m,m)=Y(m,m)+y(n)+b(n);
end
end
end
end
k=1i*Y;
for i=2:nbus
for j=2:nbus
Y(i-1,j-1)=k(i,j);
end
end
%Z matrix formulation
Z=1i*Y^-1;

%prior to tripping
for k=1:nl
for i=linedata(k,1)
for j=linedata(k,2)
vi=busdata(i,3)
vj=busdata(j,3)
Zij(k,1)=-i*linedata(k,4);
Iij(k,1)=(vi-vj)/Zij;
%thevinin equivalent circuit
Zthij(k,1)=Z(i,i)+Z(j,j)-(2*Z(i,j));

%%Pre-outage current in line p-q


prompt = 'which first line outage = ? ';
result = input(prompt)
for w=result
for p=linedata(w,1);
for q=linedata(w,2);
Za(w,1)=-i*linedata(w,4);
vp=busdata(p,3);
vq=busdata(q,3);
Ipq(w,1)= (vp-vq)/Za;
%thevinin equivalent circuit
Zthpq(w,1)=Z(p,p)+Z(q,q)-(2*Z(p,q));
%%after outage of line p-q
Lijpq=(-Za/Zij)*((Z(i,p)-Z(i,q)-Z(j,p)-Z(j,q))/Zthpq-Za);
Lpqij=(Zij/Za)*((Z(p,i)-Z(q,i)-Z(p,j)-Z(q,j))/(Zthij-Zij));

%post tripping of p-q


dIij=Iij+(Lijpq*Ipq);

%%Pre-outage current in line r-s


prompt = 'which second line outage = ? ';
result2 = input(prompt)
for c=result2
for r=linedata(c,1);
for s=linedata(c,2);
Zb=-i*linedata(c,4);
vr=busdata(r,3);
vs=busdata(s,3);
Irs= (vr-vs)/Zb;
%thevinin equivalent circuit
Zthrs=Z(r,r)+Z(s,s)-(2*Z(r,s));
Lrsij=(Zij/Zb)*((Z(r,i)-Z(s,i)-Z(r,j)-Z(s,j))/(Zthij-Zij));
Lrspq=(-Zb/Za)*((Z(r,p)-Z(s,p)-Z(r,q)-Z(s,q))/(Zthij-Zij));
%post tripping of r-s
dLrsij=Lrsij+(Lrspq*Lpqij)
dLrspq=Lrspq+(Lrsij*Lijpq)
dIrs=Irs*(dLrsij*Ipq)+(dLrspq*Ipq)

end
end
end
end
end
end
end
end
end

You might also like