Advertisement
Ailili1997

Coursework Task 2 Optimisation

Nov 11th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. %===========================================%
  2. %Power Electronics in Distribution Networks %
  3. %Coursework Task 2 Optimisation %
  4. %===========================================%
  5. clear
  6. clc
  7. %Define all variables as global variables
  8. global V1;
  9. global G12;global B12;
  10. global G13;global B13;
  11. global G14;global B14;
  12. global G22;global B22;
  13. global G23;global B23;
  14. global G33;global B33;
  15. global G24;global B24;
  16. global G34;global B34;
  17. global G44;global B44;
  18. global PG;global PSOP;
  19. global QSOP;global QSOP4;
  20. % System Parameters
  21. V1=1.01;
  22. ZL12=0.05+1i*0.01;
  23. ZL13=0.04;
  24. ZL34=0.01;
  25. Zload3=2.21;
  26. Zload4=2.08+1i*0.52;
  27. PG=0.6;
  28. PSOP=0;
  29. QSOP=0;
  30. QSOP4=0;
  31. % Y matrix
  32. YL12=1/ZL12;
  33. YL13=1/ZL13;
  34. YL34=1/ZL34;
  35. Yload3=1/Zload3;
  36. Yload4=1/Zload4;
  37.  
  38. Y=[YL12+YL13,-YL12,-YL13,0;-YL12,YL12,0,0; -YL13,0,YL13+YL34+Yload3,-YL34; 0,0,-YL34,YL34+Yload4];
  39.  
  40. G12=real(Y(1,2));
  41. B12=imag(Y(1,2));
  42.  
  43. G13=real(Y(1,3));
  44. B13=imag(Y(1,3));
  45.  
  46. G14=real(Y(1,4));
  47. B14=imag(Y(1,4));
  48.  
  49. G22=real(Y(2,2));
  50. B22=imag(Y(2,2));
  51.  
  52. G23=real(Y(2,3));
  53. B23=imag(Y(2,3));
  54.  
  55. G24=real(Y(2,4));
  56. B24=imag(Y(2,4));
  57.  
  58. G33=real(Y(3,3));
  59. B33=imag(Y(3,3));
  60.  
  61. G34=real(Y(3,4));
  62. B34=imag(Y(3,4));
  63.  
  64. G44=real(Y(4,4));
  65. B44=imag(Y(4,4));
  66. % Solution of Min Opt
  67. x=fmincon('Psop',[1.01;1.01;1.01;0;0;0],[],[],[],[],[0.98;0.98;0.98;-5;-5;-5],[1.02;1.02;1.02;5;5;5],'nonlcon')
  68. %Dispaly Result
  69. Psop(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement