完整版短路计算matlab程序.docx
《完整版短路计算matlab程序.docx》由会员分享,可在线阅读,更多相关《完整版短路计算matlab程序.docx(19页珍藏版)》请在冰豆网上搜索。
完整版短路计算matlab程序
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PowerSystemAnalysis'Project:
MatlabProgram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clearall
closeall
clc
a=exp(j*2*pi/3);
A=[111;
1a^2a;
1aa^2];
Sref=900e6;
Uref=300e3;
Iref=Sref/(sqrt(3)*Uref);
%datafromthedifferentdocuments:
Positive;
Negative;
Zero;
%runpowerflow:
opt=mpoption('ENFORCE_Q_LIMS',1);
results=runpf(case9gs,opt);
Vp=[results.bus(:
8).*(cos(pi/180*results.bus(:
9))+j*sin(pi/180*results.bus(:
9)))];
clc;
%Menu:
Bucle=1;
while(Bucle==1)
%Menu:
disp('________________________________________________________________________________________')
disp('%%%%%%Programtocalculatethesymetricalandunsymetricalshortcircuitfaults%%%%%%');
disp('1)Symetricalfault(threephaseshortcircuitfault)');
disp('2)Unsymetricalfault(Asinglephasetogroundfault)');
disp('0)Forexittheprogram');
obtion=input('Choosetheoptionyouwanttobecalculatedbytypingitsnumber:
','s');
disp('________________________________________________________________________________________')
%Calculationofthefault
switch(obtion)
%%
case'1'
disp('YouHavechoose:
SYMETRICALFAULT');
disp('');
disp('Pleasefollowthemenu');
%Askforthefault'sbusnumberandtheRfvalue:
disp('');
disp('*******************************************************************************')
disp('*DATA*')
disp('*******************************************************************************')
bus=input('Please,numberthebuswherethethreephaseshortcircuitfaultoccur.Busnumber:
');
%bus=bus+1;%Sincenodezeroisalsoanalyzed,thebusnumberXwillhaveaX+1index
Rf=input('PleasewritethevalueofthearcresistanceRfperphase.Rf=');
%Calculation:
If=zeros(8,1);
If(bus)=Vp(bus)/(Zpos(bus,bus)+Rf);
Vs=Vp-Zpos*If;
%ShowingtheResults:
disp('');
disp('*******************************************************************************')
disp('*RESULTS*')
disp('*******************************************************************************')
FaultCurrent=sprintf('Theshortcircuitcurrentsis:
%gA.withangle%g?
Iref*abs(If(bus)),180/pi*angle(If(bus)));
disp(FaultCurrent);
figure();
compass(If(bus),'blue');
holdon
compass(If(bus)*a,'red');
compass(If(bus)*a^2,'green');
text(-abs(If(bus)),-abs(If(bus)),'ShortCircuitcurrent');
disp('')
disp('TheVoltagesatallthebusesinthesystemare:
')
disp('_____________________________________________')
disp('BusVAngle[Degree]')
disp('_____________________________________________')
VoltageTokke=sprintf('Tokke%gV%g?
Uref*abs(Vs
(1)),180/pi*angle(Vs
(1)));disp(VoltageTokke)
VoltageVinje=sprintf('Vinje%gV%g?
Uref*abs(Vs
(2)),180/pi*angle(Vs
(2)));disp(VoltageVinje)
VoltageSonga=sprintf('Songa%gV%g?
Uref*abs(Vs(3)),180/pi*angle(Vs(3)));disp(VoltageSonga)
VoltageVemork=sprintf('Vemork%gV%g?
Uref*abs(Vs(4)),180/pi*angle(Vs(4)));disp(VoltageVemork)
VoltageRjukan=sprintf('Rjunkan%gV%g?
Uref*abs(Vs(5)),180/pi*angle(Vs(5)));disp(VoltageRjukan)
VoltageFlesaker=sprintf('Flesaker%gV%g?
Uref*abs(Vs(6)),180/pi*angle(Vs(6)));disp(VoltageFlesaker)
VoltageTveiten=sprintf('Tveiten%gV%g?
Uref*abs(Vs(7)),180/pi*angle(Vs(7)));disp(VoltageTveiten)
VoltageRod=sprintf('Rod%gV%g?
Uref*abs(Vs(8)),180/pi*angle(Vs(8)));disp(VoltageRod)
disp('_____________________________________________')
figure()
subplot(2,4,1)
compass(Vs
(1),'b');
holdon
compass(Vs
(1)*a,'r');
compass(Vs
(1)*a^2,'g');
text(-abs(Vs
(1)),-abs(Vs
(1)),'Tokke`sVoltagevectors');
subplot(2,4,2)
compass(Vs
(2));
holdon
compass(Vs
(2)*a,'r');
compass(Vs
(2)*a^2,'g');
text(-abs(Vs
(2)),-abs(Vs
(2)),'Vinje`sVoltagevectors');
subplot(2,4,3)
compass(Vs(3));
holdon
compass(Vs(3)*a,'r');
compass(Vs(3)*a^2,'g');
text(-abs(Vs(3)),-abs(Vs(3)),'Songa`sVoltagevectors');
subplot(2,4,4)
compass(Vs(4));
holdon
compass(Vs(4)*a,'r');
compass(Vs(4)*a^2,'g');
text(-abs(Vs(4)),-abs(Vs(4)),'Vemork`sVoltagevectors');
subplot(2,4,5)
compass(Vs(5));
holdon
compass(Vs(5)*a,'r');
compass(Vs(5)*a^2,'g');
text(-abs(Vs(5)),-abs(Vs(5)),'Rjukan`sVoltagevectors');
subplot(2,4,6)
compass(Vs(6));
holdon
compass(Vs(6)*a,'r');
compass(Vs(6)*a^2,'g');
text(-abs(Vs(6)),-abs(Vs(6)),'Flesaker`sVoltagevectors');
subplot(2,4,7)
compass(Vs(7));
holdon
compass(Vs(7)*a,'r');
compass(Vs(7)*a^2,'g');
text(-abs(Vs(7)),-abs(Vs(7)),'Tveiten`sVoltagevectors');
subplot(2,4,8)
compass(Vs(8));
holdon
compass(Vs(8)*a,'r');
compass(Vs(8)*a^2,'g');
text(-abs(Vs(8)),-abs(Vs(8)),'Rod`sVoltagevectors');
disp('')
disp('*******************************************************************************')
disp('*CURRENTS*')
disp('*******************************************************************************')
Q=input('Doyouwanttoknowanyofthecurrentsthroughtwoconnectedpoints?
Y/N:
','s');
k=0;
whileQ=='Y'
k=k+1;
B1(k)=input('Writethefirstbusnumber:
');
B2(k)=input('Writethesecondbusnumber:
');
ifYpos(B1(k),B2(k))==0
disp('')
disp('Warning:
*************Thereisnoconnectionbetween*************')
disp('')
k=k-1;
else
Ibranch(k)=(Vs(B1(k))-Vs(B2(k)))*(-Ypos(B1(k),B2(k)));
end
Q=input('Doyouwanttoknowanymoreofthecurrents?
Y/N:
','s');
end
disp('')
disp('*******************************************************************************')
disp('*CURRENTSRESULTS*')
disp('*******************************************************************************')
disp('')
ifk==0
disp('Therearenocurrentsresults');
end
forK=1:
k
Current=sprintf('Frombusno%gtobusno%gthecurrentflowingis:
%gA%g?
B1(K),B2(K),Iref*abs(Ibranch(K)),180/pi*angle(Ibranch(K)));disp(Current)
figure();
compass(Ibranch(K),'blue');
holdon
compass(Ibranch(K)*a,'red');
compass(Ibranch(K)*a^2,'green');
text(-abs(Ibranch(K)),-abs(Ibranch(K)),'Currentbetweenselectednodes');
end
%%
case'2'
disp('YouHavechoose:
UNSYMETRICALFAULT');
disp('Theprogramonlycalcutessinglelinetogroundfaults,itisconsidertohappeninphase"a"')
disp('')
disp('Pleasefollowthemenu');
%Askforthefault'sbusnumberandtheRfvalue:
disp('');
disp('*******************************************************************************')
disp('*DATA*')
disp('*******************************************************************************')
bus=input('Please,numberthebuswherethesinglephasetogroundfaultoccur.Busnumber:
');
%bus=bus+1;%Sincenodezeroisalsoanalyzed,thebusnumberXwillhaveaX+1index
Rf=input('PleasewritethevalueofthearcresistanceRfperphase.Rf=');
%Calculationofthecurrents:
Ifphaseground=3*Vp(bus)/(Zpos(bus,bus)+Zneg(bus,bus)+Zzero(bus,bus)+3*Rf);
%Fasea
Ifa=zeros(8,1);
Ifa(bus)=Ifphaseground;
Ifa1=Ifa/3;
Ifa2=Ifa/3;
Ifa0=Ifa/3;
fork=1:
8
Ifault=A*[Ifa0(k);Ifa1(k);Ifa2(k)];
IF(k,:
)=Ifault';
end
%Voltages;
%Fasea:
V1=Vp-Zpos*Ifa1;
V2=-Zneg*Ifa2;
V0=-Zzero*Ifa0;
fork=1:
8
U=A*[V0(k);V1(k);V2(k)]
V(k,:
)=transpose(U)
end
%ShowingtheResults:
disp('');
disp('*******************************************************************************')
disp('*RESULTS*')
disp('*******************************************************************************')
disp('')
FaultCurrent=sprintf('Theshortcircuitcurrentsis:
%gA.withangle%g?
Iref*abs(Ifa(bus)),180/pi*angle(Ifa(bus)));
disp(FaultCurrent);
figure();
compass(IF(bus,1),'red');
holdon
compass(IF(bus,2),'blue');
compass(IF(bus,3),'green');
text(-abs(IF(bus,1)),-abs(IF(bus,1)),'ShortCircuitcurrent');
disp('')
disp('TheVoltagesatallthebusesinthesystemare:
')
disp('__________________________________________________________________________________________________')
disp('BusVaVbVc');
disp('__________________________________________________________________________________________________')
VoltageTokke=sprintf('Tokke%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(1,1)),180/pi*angle(V(1,1)),Uref/sqrt(3)*abs(V(1,2)),180/pi*angle(V(1,2)),Uref/sqrt(3)*abs(V(1,3)),180/pi*angle(V(1,3)));disp(VoltageTokke)
VoltageVinje=sprintf('Vinje%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(1,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(2,2)),180/pi*angle(V(2,2)),Uref/sqrt(3)*abs(V(2,3)),180/pi*angle(V(2,3)));disp(VoltageVinje)
VoltageSonga=sprintf('Songa%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(3,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(3,2)),180/pi*angle(V(3,2)),Uref/sqrt(3)*abs(V(3,3)),180/pi*angle(V(3,3)));disp(VoltageSonga)
VoltageVemork=sprintf('Vemork%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(4,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(4,2)),180/pi*angle(V(4,2)),Uref/sqrt(3)*abs(V(4,3)),180/pi*angle(V(4,3)));disp(VoltageVemork)
VoltageRjukan=sprintf('Rjukan%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(5,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(5,2)),180/pi*angle(V(5,2)),Uref/sqrt(3)*abs(V(5,3)),180/pi*angle(V(5,3)));disp(VoltageRjukan)
VoltageFlesaker=sprintf('Flesaker%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(6,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(6,2)),180/pi*angle(V(6,2)),Uref/sqrt(3)*abs(V(6,3)),180/pi*angle(V(6,3)));disp(VoltageFlesaker)
VoltageTveiten=sprintf('Tveiten%gVand%g?
%gVand%g?
%gVand%g?
',Uref/sqrt(3)*abs(V(7,1)),180/pi*angle(V(2,1)),Uref/sqrt(3)*abs(V(7,2)),180/pi*angle(V(7,2)),Uref/sqrt(3)*abs(V(7,3)),180/pi*angle(V(7,3)));disp(VoltageTveiten)
VoltageRod=spr