ASSIGNMENT NO:1 Gauss Seidel and Newton Raphson Method for Load Flow Analysis Submitted To: Professor Asif Gulraiz Submitted By: Engr. Shahnila Badar (EE-221601) MAY 17, 2023 ELECTRICAL DEPARTMENT DHA SUFFA University Karachi ASSIGNMENT 1 Task: Use MATLAB to apply Gauss Seidel and Newton Raphson method on given examples. Compare the results between simulation and hand calculated. During simulation I found the results for Load lines, Load Losses and Power flow results to be same as hand calculated values. Load Flow analysis using Gauss Seidel Method Example 1: MATLAB Code: clear all; clc; 1 y12=10-j*20; y13=10-j*30; y23=16-j*32; V1=1.05+j*0; iter =0; S2=-2.566-j*1.102; S3=-1.386-j*.452; V2=1+j*0; V3=1+j*0; for I=1:10; iter=iter+1; V2 = (conj(S2)/conj(V2)+y12*V1+y23*V3)/(y12+y23); V3 = (conj(S3)/conj(V3)+y13*V1+y23*V2)/(y13+y23); disp([iter, V2, V3]) end V2= .98-j*.06; V3= 1-j*.05; I12=y12*(V1-V2); I21=-I12; I13=y13*(V1-V3); I31=-I13; I23=y23*(V2-V3); I32=-I23; S12=V1*conj(I12); S21=V2*conj(I21); S13=V1*conj(I13); S31=V3*conj(I31); S23=V2*conj(I23); S32=V3*conj(I32); I1221=[I12,I21] I1331=[I13,I31] I2332=[I23,I32] S1221=[S12, S21 (S12+S13) S12+S21] S1331=[S13, S31 (S31+S32) S13+S31] S2332=[S23, S32 (S23+S21) S23+S32] Simulation Results: a) Phasor values of Voltage at Load bus 2 and 3 (P-Q Buses) Iterations 1 to 10 1.0000 + 0.0000i 0.9825 - 0.0310i 1.0011 - 0.0353i 2.0000 + 0.0000i 0.9816 - 0.0520i 1.0008 - 0.0459i 3.0000 + 0.0000i 0.9808 - 0.0578i 1.0004 - 0.0488i 4.0000 + 0.0000i 0.9803 - 0.0594i 1.0002 - 0.0497i 5.0000 + 0.0000i 0.9801 - 0.0598i 1.0001 - 0.0499i 6.0000 + 0.0000i 0.9801 - 0.0599i 1.0000 - 0.0500i 7.0000 + 0.0000i 0.9800 - 0.0600i 1.0000 - 0.0500i 2 8.0000 + 0.0000i 0.9800 - 0.0600i 1.0000 - 0.0500i 9.0000 + 0.0000i 0.9800 - 0.0600i 1.0000 - 0.0500i 10.0000 + 0.0000i 0.9800 - 0.0600i 1.0000 - 0.0500i b) Line Current I1221 = 1.9000 - 0.8000i -1.9000 + 0.8000i I1331 = 2.0000 - 1.0000i -2.0000 + 1.0000i I2332 = -0.6400 + 0.4800i 0.6400 - 0.4800i c) Line Flows and Line Losses S1221 = 1.9950 + 0.8400i -1.9100 - 0.6700i 4.0950 + 1.8900i 0.0850 + 0.1700i S1331 = 2.1000 + 1.0500i -2.0500 - 0.9000i -1.3860 - 0.4520i 0.0500 + 0.1500i S2332 = -0.6560 - 0.4320i 0.6640 + 0.4480i -2.5660 - 1.1020i 0.0080 + 0.0160i 3 Example 2: MATLAB CODE: %Power flow analysis using Gauss Seidal Method % %Engr. Shahnila Badar EE-221601% clc; clear all; y12=10-j*20; y13=10-j*30; y23=16-j*32; y33=y13+y23; V1=1.05+j*0; 4 format long iter =0; S2=-4.0-j*2.5; P3 = 2; V2=1+j*0; Vm3=1.04; V3=1.04+j*0; for I=1:10; iter=iter+1 E2 = V2; E3=V3; V2 = (conj(S2)/conj(V2)+y12*V1+y23*V3)/(y12+y23) DV2 = V2-E2 Q3 = -imag(conj(V3)*(y33*V3-y13*V1-y23*V2)) S3 = P3 +j*Q3; Vc3 = (conj(S3)/conj(V3)+y13*V1+y23*V2)/(y13+y23) Vi3 = imag(Vc3); Vr3= sqrt(Vm3^2 - Vi3^2); V3 = Vr3 + j*Vi3 DV3=V3-E3 end format short I12=y12*(V1-V2); I21=-I12; I13=y13*(V1-V3); I31=-I13; I23=y23*(V2-V3); I32=-I23; S12=V1*conj(I12); S21=V2*conj(I21); S13=V1*conj(I13); S31=V3*conj(I31); S23=V2*conj(I23); S32=V3*conj(I32); I1221=[I12,I21] I1331=[I13,I31] I2332=[I23,I32] S1221=[S12, S21 (S12+S13) S12+S21] S1331=[S13, S31 (S31+S32) S13+S31] S2332=[S23, S32 (S23+S21) S23+S32] Simulation Result: a) Phasor values of Voltage at Load bus 2 and 3 (P-Q Buses) Iterations 1 to 10 iter = 1 V2 = 0.974615384615385 - 0.042307692307692i DV2 = -0.025384615384615 - 0.042307692307692i Q3 = 1.160000000000001 Vc3 = 1.037831858407080 - 0.005170183798502i V3 = 1.039987148574197 - 0.005170183798502i DV3 = -0.000012851425803 - 0.005170183798502i iter = 2 V2 = 0.971057059512953 - 0.043431876337850i DV2 = -0.003558325102432 - 0.001124184030158i Q3 = 1.387957731052817 Vc3 = 1.039081476179430 - 0.007300111679686i V3 = 1.039974378708180 - 0.007300111679686i 5 DV3 = -0.000012769866018 - 0.002129927881184i iter = 3 V2 = 0.970733708554698 - 0.044791724463619i DV2 = -0.000323350958254 - 0.001359848125769i Q3 = 1.429040300785471 Vc3 = 1.039536102030377 - 0.008325001047174i V3 = 1.039966679445820 - 0.008325001047174i DV3 = -0.000007699262360 - 0.001024889367487i iter = 4 V2 = 0.970652437281433 - 0.045329920732880i DV2 = -8.127127326573724e-05 - 5.381962692614858e-04i Q3 = 1.448333275594840 Vc3 = 1.039783582412907 - 0.008752000354604i V3 = 1.039963173621928 - 0.008752000354604i DV3 = -3.505823891414295e-06 - 4.269993074304240e-04i iter = 5 V2 = 0.970623655331095 - 0.045554240372625i DV2 = -2.878195033773068e-05 - 2.243196397443484e-04i Q3 = 1.456209166612119 Vc3 = 1.039887186964488 - 0.008929007616053i V3 = 1.039961668920058 - 0.008929007616053i DV3 = -1.504701870214120e-06 - 1.770072614492024e-04i iter = 6 V2 = 0.970612037114234 - 0.045646940090561i DV2 = -1.161821686124220e-05 - 9.269971793655907e-05i Q3 = 1.459469889628077 Vc3 = 1.039930224431334 - 0.009002221658867i V3 = 1.039961037734205 - 0.009002221658867i DV3 = -6.311858531393710e-07 - 7.321404281408414e-05i iter = 7 V2 = 0.970607253520093 - 0.045685276728252i DV2 = -4.783594140689296e-06 - 3.833663769042817e-05i Q3 = 1.460818201396914 Vc3 = 1.039948029840190 - 0.009032502820155i V3 = 1.039960775170297 - 0.009032502820155i DV3 = -2.625639083930764e-07 - 3.028116128733424e-05i iter = 8 6 V2 = 0.970605276281561 - 0.045701131870879i DV2 = -1.977238532457903e-06 - 1.585514262764792e-05i Q3 = 1.461375872168914 Vc3 = 1.039955394551153 - 0.009045027392915i V3 = 1.039960666313617 - 0.009045027392915i DV3 = -1.088566798923551e-07 - 1.252457276070332e-05i iter = 9 V2 0.970604458527297 - 0.045707689707255i DV2 =-8.177542636378377e-07 - 6.557836375535586e-06i Q3 = 1.461606535170453 Vc3 =1.039958440697760 - 0.009050207830587i V3 = 1.039960621244008 - 0.009050207830587i DV3 = -4.506960848971175e-08 - 5.180437672010207e-06i iter =10 V2 = 0.970604120282796 - 0.045710402176455i DV2 = -3.382445014077362e-07 - 2.712469200305545e-06i Q3 = 1.461701943643423 Vc3 = 1.039959700654411 - 0.009052350604469i V3 = 1.039960602594413 - 0.009052350604469i DV3 = -1.864959564557012e-08 - 2.142773881465970e-06i b) Line Current I1221 = 1.7082 - 1.1308i -1.7082 + 1.1308i I1331 = 0.3720 - 0.2107i -0.3720 + 0.2107i I2332 = -2.2828 + 1.6329i 2.2828 - 1.6329i c) Line Flow and Line Losses S1221 = 1.7936 + 1.1874i -1.7096 - 1.0195i 2.1841 + 1.4085i 0.0839 + 0.1679i S1331 = 0.3906 + 0.2212i -0.3887 - 0.2157i 2.0000 + 1.4618i 0.0018 + 0.0055i S2332 = -2.2903 - 1.4805i 2.3888 + 1.6775i -3.9999 - 2.5000i 0.0985 + 0.1969i 7 Load Flow analysis using Newton Raphson Method MATLAB Code: % Newton-Raphson method V = [1.05; 1.0; 1.04]; d = [0; 0; 0]; Ps=[-4; 2.0]; Qs= -2.5; YB = [ 20-j*50 -10+j*20 -10+j*30 8 -10+j*20 26-j*52 -10+j*30 -16+j*32 Y= abs(YB); t = angle(YB); -16+j*32 26-j*62]; iter=0; pwracur = 0.00025; % Power accuracy DC = 10; % Set the maximum power residual to a high value while max(abs(DC)) > pwracur iter = iter +1 P=[V(2)*V(1)*Y(2,1)*cos(t(2,1)-d(2)+d(1))+V(2)^2*Y(2,2)*cos(t(2,2))+ ... V(2)*V(3)*Y(2,3)*cos(t(2,3)-d(2)+d(3)); V(3)*V(1)*Y(3,1)*cos(t(3,1)-d(3)+d(1))+V(3)^2*Y(3,3)*cos(t(3,3))+ ... V(3)*V(2)*Y(3,2)*cos(t(3,2)-d(3)+d(2))]; Q= -V(2)*V(1)*Y(2,1)*sin(t(2,1)-d(2)+d(1))-V(2)^2*Y(2,2)*sin(t(2,2))- ... V(2)*V(3)*Y(2,3)*sin(t(2,3)-d(2)+d(3)); J(1,1)=V(2)*V(1)*Y(2,1)*sin(t(2,1)-d(2)+d(1))+... V(2)*V(3)*Y(2,3)*sin(t(2,3)-d(2)+d(3)); J(1,2)=-V(2)*V(3)*Y(2,3)*sin(t(2,3)-d(2)+d(3)); J(1,3)=V(1)*Y(2,1)*cos(t(2,1)-d(2)+d(1))+2*V(2)*Y(2,2)*cos(t(2,2))+... V(3)*Y(2,3)*cos(t(2,3)-d(2)+d(3)); J(2,1)=-V(3)*V(2)*Y(3,2)*sin(t(3,2)-d(3)+d(2)); J(2,2)=V(3)*V(1)*Y(3,1)*sin(t(3,1)-d(3)+d(1))+... V(3)*V(2)*Y(3,2)*sin(t(3,2)-d(3)+d(2)); J(2,3)=V(3)*Y(2,3)*cos(t(3,2)-d(3)+d(2)); J(3,1)=V(2)*V(1)*Y(2,1)*cos(t(2,1)-d(2)+d(1))+... V(2)*V(3)*Y(2,3)*cos(t(2,3)-d(2)+d(3)); J(3,2)=-V(2)*V(3)*Y(2,3)*cos(t(2,3)-d(2)+d(3)); J(3,3)=-V(1)*Y(2,1)*sin(t(2,1)-d(2)+d(1))-2*V(2)*Y(2,2)*sin(t(2,2))-... V(3)*Y(2,3)*sin(t(2,3)-d(2)+d(3)); DP = Ps - P; DQ = Qs - Q; DC = [DP; DQ] J DX = J\DC d(2) =d(2)+DX(1); d(3)=d(3) +DX(2); V(2)= V(2)+DX(3); V, d, delta =180/pi*d; end P1= V(1)^2*Y(1,1)*cos(t(1,1))+V(1)*V(2)*Y(1,2)*cos(t(1,2)-d(1)+d(2))+... V(1)*V(3)*Y(1,3)*cos(t(1,3)-d(1)+d(3)) Q1=-V(1)^2*Y(1,1)*sin(t(1,1))-V(1)*V(2)*Y(1,2)*sin(t(1,2)-d(1)+d(2))-... V(1)*V(3)*Y(1,3)*sin(t(1,3)-d(1)+d(3)) Q3=-V(3)*V(1)*Y(3,1)*sin(t(3,1)-d(3)+d(1))-V(3)*V(2)*Y(3,2)*... sin(t(3,2)-d(3)+d(2))-V(3)^2*Y(3,3)*sin(t(3,3)) Simulation Result: iter =1 9 DC = -2.8600 1.4384 -0.2200 J = 54.2800 -33.2800 24.8600 -33.2800 66.0400 -16.6400 -27.1400 16.6400 49.7200 DX = -0.0453 -0.0077 -0.0265 V = 1.0500 0.9735 1.0400 d=0 -0.0453 -0.0077 iter = 2 DC =-0.0992 0.0217 -0.0509 J = 51.7247 -31.7656 21.3026 -32.9816 65.6564 -15.3791 -28.5386 17.4028 48.1036 DX = -0.0018 -0.0010 -0.0018 V =1.0500 0.9717 1.0400 d= 0 -0.0471 -0.0087 iter =3 DC = 1.0e-03 * -0.2166 0.0382 -0.1430 J = 51.5967 -31.6939 21.1474 10 -32.9339 65.5976 -15.3516 -28.5482 17.3969 47.9549 DX = 1.0e-05 * -0.3856 -0.2386 -0.4412 V = 1.0500 0.9717 1.0400 d= 0 -0.0471 -0.0087 P1 = 2.1842 Q1 =1.4085 Q3 = 1.4618 11