64% found this document useful (11 votes)
7K views

Formation of Zbus Matrix

This MATLAB code allows the user to model different connections between buses in a power system model by modifying the impedance matrix (Zbus). The user can choose to: 1) connect a new bus to the reference bus, 2) connect an existing bus to a new bus, 3) connect two existing buses, or 4) connect an existing bus to the reference bus. The code updates Zbus based on the user's input for the new bus number(s) and reactance value.

Uploaded by

Akash Sarkar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
64% found this document useful (11 votes)
7K views

Formation of Zbus Matrix

This MATLAB code allows the user to model different connections between buses in a power system model by modifying the impedance matrix (Zbus). The user can choose to: 1) connect a new bus to the reference bus, 2) connect an existing bus to a new bus, 3) connect two existing buses, or 4) connect an existing bus to the reference bus. The code updates Zbus based on the user's input for the new bus number(s) and reactance value.

Uploaded by

Akash Sarkar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

clc; clear all; nbus=input('Enter the total no of bus excluding ref bus:'); zbus=zeros(nbus,nbus); t=1; while t==1; s=menu('specify

the case no','connect a new bus to ref bus','connect an old bus to new bus','connect 2 old buses','connect an old bus to ref bus','quit'); switch s case{1} zb=input('Enter the impedance value:'); zbus=zb; case{2} n=input('Enter the new bus no:'); zb=input('Enter the reactance value:'); for i=1:n if i==n zbus(n,n)=zbus(n-1,n-1)+zb; else zbus(i,n)=zbus(i,n-1); zbus(n,i)=zbus(n-1,i); end end case{3} l=input('Enter the existing bus no1:'); n=input('Enter the existing bus no2:'); zb=input('Enter the reactance value:'); n=n+1; fori=1:n if i==n zbus(n,n)=zbus(1,1)+zb+zbus(n-1,n-1)-(2*zbus(1,n-1)); zbus(n,n); else zbus(i,n)=zbus(1,i)-zbus(i,n-1); zbus(i,n); zbus(n,i)=zbus(i,n); end for i=1:nbus for j=1:nbus if i==j zbus(i,j)=zbus(i,j)-(zbus(i,n)*zbus(n,j)/zbus(n,n)); zbus(j,i)=zbus(i,j); zbus(i,j)=zbus(j,i); else zbus(i,j)=zbus(i,j)-(zbus(i,n)*zbus(n,j)/zbus(n,n)); end end end for i=1:n zbus(i,n)=0; zbus(n,i)=0; end case{4} n=input('Enter the bus no:'); zb=input('Enter the reactance value:'); n=n+1; for i=1:n if i==n zbus(n,n)=zbus(n-1,n-1)+zb; else

zbus(i,n)=zbus(i,n-1); zbus(n,i)=zbus(n-1,i); end end for i=1:n for j=1:n if i==j zbus(i,j)=zbus(i,j)-(zbus(i,n)*zbus(n,j)/zbus(n,n)); zbus(j,i)=zbus(i,j); zbus(i,j)=zbus(j,i); else zbus(i,j)=zbus(i,j)-(zbus(i,n)*zbus(n,j)/zbus(n,n)); end end end case{5} 'End the program' choice=menu('Would you like to print program or end the program','Pr int','End'); if choice==1 zbus end t=0; end end

You might also like