Z-bus Matrix Building Algorithm

조회 수: 7 (최근 30일)
Fatima Yusuf
Fatima Yusuf 2021년 3월 30일
댓글: Fatima Yusuf 2021년 3월 30일
Write a MATLAB code to build Z-bu matrix if bus data and line data are given.
Here's my attempt, I got wrong result. Could someone please modify it? or wirting another code (the user have to input the bus data and line data matrices only).
clc;
clear all;
% | From | To | R | X | gsh | B | T|ysh
% | Bus | Bus | pu | pu | pu | pu | ph-sh
LD= [ 1 2 0 0.8 0 0
1 3 0 0.4 0 0
2 3 0 0.4 0 0];
r=1.05;
angle=5*(pi/180);
[x,y]=pol2cart(angle,r) ;
t=x+i*y;
fbus=LD(:,1); % Reading from bus
tbus=LD(:,2); % Reading to bus
r = LD(:,3); % Resistance, R...
x = LD(:,4); % Reactance, X...
gsh=LD(:,5);
B = 1i*LD(:,6); % Ground Admittance
%T=LD(:,7);
Zl=1/(r+(1i*x));
% fb tb Eg Xg Zd
BD = [1 0 0 inf 0.2i
2 0 0 inf 0.4i
2 3 0 inf 1]
fb=BD(:,1);
tb=BD(:,2);
Eg=BD(:,3);
Xg=1i*BD(:,4);
Zd=BD(:,5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
busses=max(max(fbus),max(tbus));
%zold=zeros(busses,busses)
z=zeros(busses);
zmod=z
for b=1:busses
z(b,b) = Zd(b) ; %diagonal matrix
end
for b=1:busses
%add col and row
for i=1:busses-1
if tb~=0
a=transpose (z(:,fb(b))) %column to add
%row to add
b=transpose (a)
zmod=[zmod,a;b]
end
if tb==0 %special case: add col and row of zero elements
zmod=[zmod,zeros(i,1);zeros(1,i+1)];
end
NS=size(zmod)
zmod(NS,NS) = Zd(b) + zmod(fb(b),fb(b)) %last element of the mod. matrix
end
end
zmod
  댓글 수: 1
Fatima Yusuf
Fatima Yusuf 2021년 3월 30일
The code above is just for the bus data, I didn't include the lines yet.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by