Source Code for the Analysis of Symmetrical Faults

Source Code for the Analysis of Symmetrical Faults

<p>Source code for the analysis of symmetrical faults clc % Main program for the analysis of symmetrical faults. %This section tells the user to input the number of buses, generators, lines % and transformers. % This section allows the user to choose the type of function to be % performed. The user may decide to use the existing data or to input a new % set of data. type = input('Enter type (1) for data input (2) for fault analysis ') if type == 1 nb = input ('Enter the number of buses '); ng = input ('Enter the number of generators '); nl = input ('Enter the number of lines '); nt = input ('Enter the number of transformers '); numb = [nb ng nl nt]; numb = numb'; fid=fopen('numbdatas.txt','w'); fprintf(fid,'%6.2f\n',numb); fclose(fid); %numbdata is a file that stores nb,ng,nl and nt datainput(nb,ng,nl,nt) end % datainput is a function subprogram that accepts data and stores them in a % format defined by the programmer. if type == 2 Vf = input('Enter the prefault voltage in prer unit ') fid = fopen ('numbdatas.txt', 'r'); dat = textread ('numbdatas.txt'); nb = dat(1,1); ng = dat(2,1); nl = dat(3,1); nt = dat(4,1); Zimp = Zbus(nb,ng,nl,nt); % zbus is a fuction sub program that builds the bus impedance matrix % based on the input data, i.e macnine, line and transformer data. for i = 1: nb If(i) = Vf ./ Zimp(i,i); % If(i) = fault current at bus i end for i = 1: nb for j = 1 : nb Evolt(i,j) = (1.-Zimp(i,j)./Zimp(i,i))* Vf; %E(i,j) = voltages during the fault end end</p><p>Zimpedance = Zimp fid=fopen('impdata.txt','w'); for i=1:nb for k=1:nb fprintf(fid,'%6.4f\t',Zimp(i,k)); end fprintf(fid,'\n\n'); end fclose(fid); %impdata is a file that stores the bus impedance matrix Ifault = If fid=fopen('currentdata.txt','w'); for i=1:nb fprintf(fid,'%6.4f\n',If(i)); end fclose(fid); %currentdata is a file that stores the fault currents Evoltage = Evolt fid=fopen('voltagedata.txt','w'); for i=1:nb for k=1:nb fprintf(fid,'%6.4f\t',Evolt(i,k)); end fprintf(fid,'\n\n'); end fclose(fid); %voltagedata is a file that stores the per-unit bus voltages during fault fid = fopen ('gendatas.txt', 'r'); dat = textread ('gendatas.txt'); a = dat (:,1); y = dat(:,2); for i = 1:ng Ig(i) = Vf/ y(i); end b = zeros(ng,1); fid = fopen ('linedatas.txt', 'r'); dat = textread ('linedatas.txt'); y = dat(:,3); start = dat (:,1); ennd = dat (:,2); for i = 1 : (nl+nt) I(i) = Evolt(start(i),ennd(i))/y(i); Is(i) = I(i); II(i) = Evolt(ennd(i),start(i))/y(i); Ic(i) = II(i); end Ik =[Ig,Is,Ic]; Ik = Ik'; from =[b;start;ennd]; to = [a;ennd;start]; need=[from to Ik] need = need'; fid=fopen('contridata.txt','w'); fprintf(fid,'%6.2f %6.2f %6.4f\n',need); fclose(fid); end </p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us