電力系統分析(第二版)Hadi Saadat matlab 程式二(教材搬運)

一條冇得感情的頻率計 發表於 2020-11-21

例2.1

Vm=100;thetav=0;%電壓幅值和初始相角
Z=1.25;gama=60;%阻抗幅值和相角
thetai=thetav-gama;%電流相角
theta=(thetav-thetai)*pi/180;%化為弧度制
Im=Vm/Z;%電流幅值
wt=0:.05:2*pi;%wt from 0 to 2*pi
v=Vm*cos(wt);%瞬時電壓
i=Im*cos(wt + thetai*pi/180);%瞬時電流
p=v.*i;%瞬時功率
V=Vm/sqrt(2); I=Im/sqrt(2);%有效電壓和電流
P=V*I*cos(theta);%有功功率
Q=V*I*sin(theta);%無功功率
S=P+j*Q;%復功率
pr=P*(1+cos(2*(wt + thetav)));%式(2.6)
px=Q*sin(2*(wt + thetav));%式(2.8)
wt=180/pi*wt;%轉化為角度制
subplot(2,2,1), plot(wt, v, wt, i), grid
title(['v(t)=V_m cos\omegat, i(t)=I_m cos(\omegat +', num2str(thetai), ')'])
xlabel('\omegat,degree')
subplot(2,2,2), plot(wt, p), grid
title('p(t)=v(t) i(t)'), xlabel('\omegat, degree')
subplot(2,2,3), plot(wt, pr), grid
title('pr(t)Eq. 2.6'), xlabel('\omegat, degree')
subplot(2,2,4), plot(wt, px), grid
title('px(t)Eq. 2.8'), xlabel('\omegat, degree')
subplot(111)

在這裡插入圖片描述

例2.2

V = 1200; Z1= 60; Z2 = 6 + j*12; Z3 = 30 - j*30;
I1 = V/Z1; I2 = V/Z2; I3 = V/Z3;
S1= V*conj(I1), S2= V*conj(I2), S3= V*conj(I3) % conj 求共軛
S = S1 + S2 + S3

結果

S1 =  24000
S2 =  4.8000e+04 + 9.6000e+04i
S3 =  2.4000e+04 - 2.4000e+04i
S =  9.6000e+04 + 7.2000e+04i

例2.3

V = 200; Z1= 100; Z2 = 10 + j*20; 
I1 = V/Z1; I2 = V/Z2; 
S1= V*conj(I1), S2= V*conj(I2) 
I = I1 + I2 
S = S1 + S2, P = real(S); Q = imag(S); 
PF = cos(angle(S)) 
thd = acos(0.8), Qd = P*tan(thd) 
Sc = -j*(Q - Qd) 
Zc = V^2/conj(Sc), C = 1/(2*pi*60*abs(Zc)) 
Sd = P + j*Qd; 
Id=conj(Sd)/conj(V)

結果

S1 = 400
S2 = 8.0000e+02 + 1.6000e+03i
I = 6.0000 - 8.0000i
S = 1.2000e+03 + 1.6000e+03i
PF = 0.6000
thd = 0.6435
Qd = 900.0000
Sc = 0.0000e+00 - 7.0000e+02i
Zc = 0.0000 -57.1429i
C = 4.6420e-05
Id = 6.0000 - 4.5000i

例2.4

V = 1400; 
S1= 35000 + j*120000; S2 = 10000 - j*40000; S3 = 15000; 
S = S1 + S2 + S3, P = real(S); Q = imag(S); 
PF = cos(angle(S)) 
I = conj(S)/conj(V) 
thd = acos(0.8), Qd = P*tan(thd) 
Sc = -j*(Q - Qd) 
Zc = V^2/conj(Sc), C = 1/(2*pi*60*abs(Zc)) 
Sd = P + j*Qd; 
Id=conj(Sd)/conj(V)

結果

S =6.0000e+04 + 8.0000e+04i
PF =0.6000
I = 42.8571 -57.1429i
thd = 0.6435
Qd = 4.5000e+04
Sc = 0.0000e+00 - 3.5000e+04i
Zc = 0.0000 -56.0000i
C =  4.7368e-05
Id = 42.8571 -32.1429i

例2.5

R = 1; X = 7; Z = R +j*X; 
V1 = 120*(cos(-5*pi/180) + j*sin(-5*pi/180)); 
V2 = 100+j*0; 
I12 = (V1 - V2)/Z; 
I21 = -I12; 
S12 = V1*conj(I12), S21 = V2*conj(I21) 
SL = S12 + S21 
PL = R*abs(I12)^2, QL = X*abs(I12)^2

結果

S12 =-9.7508e+01 + 3.6331e+02i
S21 = 1.0733e+02 - 2.9452e+02i
SL = 9.8265 +68.7858i
PL = 9.8265
QL = 68.7858

例2.6

E1=input('Source # 1 Voltage Mag. = ');
a1=input('Source # 1 Phase Angle = ');
E2=input('Source # 2 Voltage Mag. = ');
a2=input('Source # 2 Phase Angle = ');
R=input('Line Resistance = ');
X= input('Line Reactance = ');
Z= R + j*X; % 線路阻抗
a1 = (-30+a1:5:30+a1)'; % a1 變化+/- 30 度
a1r = a1*pi/180; % 角度轉弧度
k=length(a1);
a2=ones(k,1)*a2; % 建立列 a2
a2r = a2*pi/180; % 角度轉弧度
V1=E1.*cos(a1r) + j*E1.*sin(a1r);
V2=E2.*cos(a2r) + j*E2.*sin(a2r);
I12 = (V1 - V2)./Z; I21=-I12;
S1= V1.*conj(I12); P1 = real(S1); Q1 = imag(S1);
S2= V2.*conj(I21); P2 = real(S2); Q2 = imag(S2);
SL= S1+S2; PL = real(SL); QL = imag(SL);
Result1=[a1, P1, P2, PL];
disp(' ')
disp(' Delta 1 P-1 P-2 P-L ')
disp(Result1)
plot(a1, P1, a1, P2, a1, PL)
xlabel('Source #1 Voltage Phase Angle')
ylabel('P, Watts')
text(-26, -550, 'P1'), text(-26, 600,'P2'), text(-26, 100, 'PL')

結果

Source # 1 Voltage Mag. = 120
Source # 1 Phase Angle = -5
Source # 2 Voltage Mag. = 100
Source # 2 Phase Angle = 0
Line Resistance = 1
Line Reactance = 7
 
 Delta 1 P-1 P-2 P-L 
  -35.0000 -872.2049  967.0119   94.8070
  -30.0000 -759.8461  832.1539   72.3078
  -25.0000 -639.5125  692.4848   52.9723
  -20.0000 -512.1201  549.0676   36.9475
  -15.0000 -378.6382  402.9938   24.3556
  -10.0000 -240.0828  255.3751   15.2923
   -5.0000  -97.5084  107.3349    9.8265
         0   48.0000  -40.0000    8.0000
    5.0000  195.3349 -185.5084    9.8265
   10.0000  343.3751 -328.0828   15.2923
   15.0000  490.9938 -466.6382   24.3556
   20.0000  637.0676 -600.1201   36.9475
   25.0000  780.4848 -727.5125   52.9723

例2.7

V1 = 207.85/sqrt(3); 
Zl = 2 + j*4; Z1 = 30 + j*40; 
Z2 = (60-j*45)/3; 
Z = Zl + Z1*Z2/(Z1+Z2); 
I=V1/Z, S=3*V1*conj(I) 
V2 = V1- Zl*I 
V2ab =sqrt(3)*(cos(pi/6)+j*sin(pi/6))*V2 
I1=V2/Z1, I2=V2/Z2 
Iab=I2/(sqrt(3)*(cos(pi/6)-j*sin(pi/6))) 
S1=3*V2*conj(I1), S2=3*V2*conj(I2) 
SL = 3*Zl*abs(I)^2

結果

I = 5.0001
S =1.8001e+03
V2 = 1.1000e+02 - 2.0000e+01i
V2ab = 1.8232e+02 + 6.5264e+01i
I1 = 1.0000 - 2.0000i
I2 = 4.0001 + 2.0000i
Iab = 1.4227 + 2.1547i
S1 = 4.5002e+02 + 6.0002e+02i
S2 = 1.2000e+03 - 9.0003e+02i
SL = 1.5001e+02 + 3.0001e+02i

例2.8

V2 = 3810.5/sqrt(3); 
Zl = 0.4 +j*2.7; 
S1 = 560.1*(cos(pi/4) + j*sin(pi/4)); S2 = 132; 
SR = S1+ S2 
I = conj(SR)*1000/(3*conj(V2)) 
V1 = V2 + Zl*I 
V1L = sqrt(3)*abs(V1) 
SL = 3*Zl*abs(I)^2/1000 
SS = 3 *V1*conj(I)/1000 
SS = SR + SL

結果

SR = 5.2805e+02 + 3.9605e+02i
I =80.0079 -60.0078i
V1 = 2.3940e+03 + 1.9202e+02i
V1L = 4.1599e+03
SL =12.0026 +81.0179i
SS =5.4005e+02 + 4.7707e+02i
SS =5.4005e+02 + 4.7707e+02i