Advertisement
Ailili1997

Coursework Task 1

Nov 11th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. %===========================================%
  2. %Power Electronics in Distribution Networks %
  3. %Coursework Task 1 %
  4. %===========================================%
  5. %Clear Data
  6. clear
  7. clc
  8. %System Parameters
  9. V1=1.01;
  10. ZL12=0.05+1i*0.01;
  11. ZL13=0.04;ZL34=0.01;
  12. Zload3=2.21;
  13. Zload4=2.08+i*0.52;
  14. %PG=0;
  15. PG=0.6;
  16. %SOP Parameters
  17. PSOP=0;
  18. QSOP2=0;
  19. QSOP4=0;
  20. %Admittance Matrix
  21. YL12=1/ZL12;
  22. YL13=1/ZL13;
  23. YL34=1/ZL34;
  24. Yload3=1/Zload3;
  25. Yload4=1/Zload4;
  26.  
  27. Y=[YL12+YL13,-YL12,-YL13,0; -YL12,YL12,0,0;-YL13,0,YL13+YL34+Yload3,-YL34; 0,0,-YL34,YL34+Yload4];
  28.  
  29. G12=real(Y(1,2));
  30. B12=imag(Y(1,2));
  31.  
  32. G13=real(Y(1,3));
  33. B13=imag(Y(1,3));
  34.  
  35. G14=real(Y(1,4));
  36. B14=imag(Y(1,4));
  37.  
  38. G22=real(Y(2,2));
  39. B22=imag(Y(2,2));
  40.  
  41. G23=real(Y(2,3));
  42. B23=imag(Y(2,3));
  43.  
  44. G24=real(Y(2,4));
  45. B24=imag(Y(2,4));
  46.  
  47. G33=real(Y(3,3));
  48. B33=imag(Y(3,3));
  49.  
  50. G34=real(Y(3,4));
  51. B34=imag(Y(3,4));
  52.  
  53. G44=real(Y(4,4));
  54. B44=imag(Y(4,4));
  55. %fsolve to solve nonlinear equations
  56. f=@(V2,V3,V4,theta2,theta3,theta4) [
  57. V1*V2*(G12*cos(theta2)+B12*sin(theta2))+V2*V2*G22+V2*V3*(G23*cos(theta2-theta3)+B23*sin(theta2-theta3))+V4*V2*(G24*cos(theta2-theta4)+B24*sin(theta2-theta4))-PG+PSOP;
  58. V1*V3*(G13*cos(theta3)+B13*sin(theta3))+V2*V3*(G23*cos(theta3-theta2)+B23*sin(theta3-theta2))+V3*V3*G33+V4*V3*(G34*cos(theta3-theta4)+B34*sin(theta3-theta4));
  59. V1*V4*(G14*cos(theta4)+B14*sin(theta4))+V2*V4*(G24*cos(theta4-theta2)+B24*sin(theta4-theta2))+V4*V3*(G34*cos(theta4-theta3)+B34*sin(theta4-theta3))+V4*V4*G44-PSOP;
  60. V1*V2*(G12*sin(theta2)-B12*cos(theta2))-V2*V2*B22+V2*V3*(G23*sin(theta2-theta3)-B23*cos(theta2-theta3))+V2*V4*(G24*sin(theta2-theta4)-B24*cos(theta2-theta4))+QSOP2;
  61. V1*V3*(G13*sin(theta3)-B13*cos(theta3))+V2*V3*(G23*sin(theta3-theta2)-B23*cos(theta3-theta2))-V3*V3*B33+V3*V4*(G34*sin(theta3-theta4)-B34*cos(theta3-theta4));
  62. V1*V4*(G14*sin(theta4)-B14*cos(theta4))+V2*V4*(G24*sin(theta4-theta2)-B24*cos(theta4-theta2))+V3*V4*(G34*sin(theta4-theta3)-B34*cos(theta4-theta3))-V4*V4*B44+QSOP4;];
  63.  
  64. fp=@(x) f(x(1),x(2),x(3),x(4),x(5),x(6));
  65.  
  66. [x, fval, exitflag] = fsolve (fp, [1.01;1.01;1.01;0;0;0]);
  67.  
  68. disp(x);
  69. %Convert radian to degree
  70. theta2=rad2deg(x(4));
  71. theta3=rad2deg(x(5));
  72. theta4=rad2deg(x(6));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement