y bus matlab

2
Search: File Exchange Site Help Patents Trademarks Privacy Policy Preventing Piracy Terms of Use Featured MathWorks.com Topics: New Products Support Documentation Training Webinars Newsletters MATLAB Trials Careers Create Account Log In File Exchange Answers Newsgroup Link Exchange Blogs Trendy Cody Contest MathWorks.com by arvind singh Y-bus 06 Oct 2010 admittance matrix ybus_final.m Dow nload Submission Code covered by the BSD License Highlights from Y-bus ybus_final.mProgram to form Admittance Bus Formation with Transformer Tap setting.. View all files % Program to form Admittance Bus Formation with Transformer Tap setting.. 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 + i*x; % Z matrix... y = 1./z; % To get inverse of each element... Ldata(p,:)=[fb tb r x B T y]; end fb = Ldata(:,1); % From bus number... tb = Ldata(:,2); % To bus number... r = Ldata(:,3); % Resistance, R... x = Ldata(:,4); % Reactance, X... b = Ldata(:,5); % Ground Admittance, B/2... a = Ldata(:,6); % Tap setting value.. y = Ldata(:,7); b = i*b; % Make B imaginary... nbus = max(max(fb),max(tb)); % no. of buses... Y = zeros(nbus,nbus); % Initialise YBus... % Formation of the Off Diagonal Elements... 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 % Formation of Diagonal Elements .... 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 Y % Bus Admittance Matrix.. Contact us © 1994-2014 The MathWorks, Inc.

Upload: dushyant-dadhich

Post on 30-Dec-2015

24 views

Category:

Documents


0 download

DESCRIPTION

its a print out of the web page .. i hope it will help people :). njoy

TRANSCRIPT

Page 1: y bus  MATLAB

2/16/14 File Exchange - MATLAB Central

www.mathworks.in/matlabcentral/fileexchange/28954-y-bus/content/ybus_final.m 1/2

Search: File Exchange

Site Help Patents Trademarks Privacy Policy Preventing Piracy Terms of Use

Featured MathWorks.com Topics: New Products Support Documentation Training Webinars Newsletters MATLAB Trials Careers

Create Account Log In

File Exchange Answers Newsgroup Link Exchange Blogs Trendy Cody Contest MathWorks.com

by arvind singh

Y-bus

06 Oct 2010

admittance matrix

ybus_final.m

Dow nload Submission

Code covered by the BSD License

Highlights from Y-bus

ybus_final.mProgram to form Admittance Bus Formation with Transformer Tap setting..

View all files

% Program to form Admittance Bus Formation with Transformer Tap setting..

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 + i*x; % Z matrix...

y = 1./z; % To get inverse of each element...

Ldata(p,:)=[fb tb r x B T y];

end

fb = Ldata(:,1); % From bus number...

tb = Ldata(:,2); % To bus number...

r = Ldata(:,3); % Resistance, R...

x = Ldata(:,4); % Reactance, X...

b = Ldata(:,5); % Ground Admittance, B/2...

a = Ldata(:,6); % Tap setting value..

y = Ldata(:,7);

b = i*b; % Make B imaginary...

nbus = max(max(fb),max(tb)); % no. of buses...

Y = zeros(nbus,nbus); % Initialise YBus...

% Formation of the Off Diagonal Elements...

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

% Formation of Diagonal Elements....

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

Y % Bus Admittance Matrix..

Contact us

© 1994-2014 The MathWorks, Inc.

Page 2: y bus  MATLAB

2/16/14 File Exchange - MATLAB Central

www.mathworks.in/matlabcentral/fileexchange/28954-y-bus/content/ybus_final.m 2/2