Lab-01 Formation of Y-Bus: Date-21/07/2014 Programme Code
Lab-01 Formation of Y-Bus: Date-21/07/2014 Programme Code
Formation of Y-bus
Date-21/07/2014
Programme code:
clc
clear all
nbranch=input('Enter total no. of lines in network');
disp('Enter line data')
for p=1:1:nbranch
fb=input('From bus no. :');
tb=input('To bus no. :');
r=input('Resistance of line =');
x=input('Reactance of line =');
B=input('Line Charging Admittance"b/2"=');
T=input('Tap=');
z = r + 1i*x;
y = 1./z;
Ldata(p,:)=[fb tb r x B T y];
end
fb = Ldata(:,1);
tb = Ldata(:,2);
r = Ldata(:,3);
x = Ldata(:,4);
b = Ldata(:,5);
a = Ldata(:,6);
y = Ldata(:,7);
b = 1i*b;
nbus = max(max(fb),max(tb));
Y = zeros(nbus,nbus);
for k=1:nbranch
Y(fb(k),tb(k)) = Y(fb(k),tb(k))-y(k);
Y(tb(k),fb(k)) = Y(fb(k),tb(k));
end
for m =1:nbus
for n =1:nbranch
if fb(n) == m
Y(m,m) = Y(m,m) + y(n) + b(n);
elseif tb(n) == m
Y(m,m) = Y(m,m) + y(n) + b(n); end
end
end
Data :
Result:
Y=
8.9852 -44.8360i -3.8156 +19.0781i -5.1696 +25.8478i
0
-3.8156 +19.0781i 8.9852 -44.8360i
0
-5.1696 +25.8478i
-5.1696 +25.8478i
0
8.1933 -40.8638i -3.0237 +15.1185i
0
-5.1696 +25.8478i -3.0237 +15.1185i 8.1933 -40.8638i
>>