Z-bus Matrix Building Algorithm

8 vues (au cours des 30 derniers jours)
Fatima Yusuf
Fatima Yusuf le 30 Mar 2021
Commenté : Fatima Yusuf le 30 Mar 2021
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 commentaire
Fatima Yusuf
Fatima Yusuf le 30 Mar 2021
The code above is just for the bus data, I didn't include the lines yet.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by