📄 dataentry.m
字号:
function x=dataentry(nb,ng,nl,nt)
%entry of generator data
for i=1:ng
disp('data entry for generator');
disp(i);
gen_bus(i)=input('enter the bus number at which the generator is connected');
pos_gen(i)=input('enter the positive/negative sequence impedance of the generator');
zero_gen(i)=input('enter the zero sequence impedance of the generator');
gen_ground(i)=input('if the generator is grounded enter the grounding impedance and if ungrounded enter 1000');
end
gen=[gen_bus' pos_gen' zero_gen' gen_ground'];
gen=gen';
fid=fopen('gendata.txt','w');
fprintf(fid,'%6.2f %6.2f %6.2f %6.2f\n',gen);
fclose(fid);
%entry of line data
for i=1:nl
disp('data entry for line');
disp(i);
start_bus(i)=input('enter the starting bus number');
end_bus(i)=input('enter the ending bus number');
pos_line(i)=input('enter the positive/negative sequence impedance of the line');
zero_line(i)=input('enter the zero sequence impedance of the line');
realtap_line(i)=input('enter the real part of off nominal tap of the line');
imagtap_line(i)=input('enter the imaginary part of off nominal tap of the line');
end
linedata=[start_bus' end_bus' pos_line' zero_line' realtap_line' imagtap_line'];
linedata=linedata';
fid=fopen('linedata.txt','w');
fprintf(fid,'%6.2f %6.2f %6.2f %6.2f %6.2f\n',linedata);
fclose(fid);
%entry of transformer data
for i=1:nt
disp('data entry for transformer');
disp(i)
hv_bus(i)=input('enter the HV bus of the transformer');
hv_code(i)=input('enter the connection code 0-star grounded 1-star ungrounded 2-delta');
lv_bus(i)=input('enter the LV bus of the transformer');
lv_code(i)=input('enter the connection code 0-star grounded 1-star ungrounded 2-delta');
pos_trans(i)=input('enter the positive/negative sequence impedance of the transformer');
zero_trans(i)=input('enter the zero sequence impedance of the transformer');
end
transdata=[hv_bus' hv_code' lv_bus' lv_code' pos_trans' zero_trans'];
transdata=transdata';
fid=fopen('transformerdata.txt','w');
fprintf(fid,'%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n',transdata);
fclose(fid);
%entry of fault data
fault_bus=input('enter the faulted bus number');
disp('1)Balanced three phase fault');
disp('2)Single line to ground fault');
disp('3)Line to line fault');
disp('4)Line to line fault with ground\n');
fault_type=input('Enter the type of fault');
fault_imp=input('ENter the fault impedance');
fault=[fault_bus fault_type fault_imp];
fid=fopen('faultdata.txt','w');
fprintf(fid,'%6.2f %6.2f %6.2f\n',fault);
fclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -