Advertisement
Ailili1997

Constrains

Nov 11th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. %===========================================%
  2. %Power Electronics in Distribution Networks %
  3. %Coursework Task 2 Constrains %
  4. %===========================================%
  5. function [g,h]=nonlcon(x)
  6. global V1;
  7. global G12;
  8. global B12;
  9. global G13;
  10. global B13;
  11. global G14;
  12. global B14;
  13. global G22;
  14. global B22;
  15. global G23;
  16. global B23;
  17. global G33;
  18. global B33;
  19. global G24;
  20. global B24;
  21. global G34;
  22. global B34;
  23. global G44;
  24. global B44;
  25. global PG;
  26. global PSOP;
  27. global QSOP;
  28. global QSOP4;
  29. %The system do not have inequality constrains
  30. g=[];
  31. %equality constrains
  32. h=[V1*x(1)*(G12*cos(x(4))+B12*sin(x(4)))+x(1)*x(1)*G22+x(1)*x(2)*(G23*cos(x(4)-x(5))+B23*sin(x(4)-x(5)))+x(3)*x(1)*(G24*cos(x(4)-x(6))+B24*sin(x(4)-x(6)))-PG+V1*x(3)*(G14*cos(x(6))+B14*sin(x(6)))+x(1)*x(3)*(G24*cos(x(6)-x(4))+B24*sin(x(6)-x(4)))+x(3)*x(2)*(G34*cos(x(6)-x(5))+B34*sin(x(6)-x(5)))+x(3)*x(3)*G44;
  33. V1*x(2)*(G13*cos(x(5))+B13*sin(x(5)))+x(1)*x(2)*(G23*cos(x(5)-x(4))+B23*sin(x(5)-x(4)))+x(2)*x(2)*G33+x(3)*x(2)*(G34*cos(x(5)-x(6))+B34*sin(x(5)-x(6)));
  34. V1*x(1)*(G12*sin(x(4))-B12*cos(x(4)))-x(1)*x(1)*B22+x(1)*x(2)*(G23*sin(x(4)-x(5))-B23*cos(x(4)-x(5)))+x(1)*x(3)*(G24*sin(x(4)-x(6))-B24*cos(x(4)-x(6)))+QSOP;
  35. V1*x(2)*(G13*sin(x(5))-B13*cos(x(5)))+x(1)*x(2)*(G23*sin(x(5)-x(4))-B23*cos(x(5)-x(4)))-x(2)*x(2)*B33+x(2)*x(3)*(G34*sin(x(5)-x(6))-B34*cos(x(5)-x(6)));
  36. V1*x(3)*(G14*sin(x(6))-B14*cos(x(6)))+x(1)*x(3)*(G24*sin(x(6)-x(4))-B24*cos(x(6)-x(4)))+x(2)*x(3)*(G34*sin(x(6)-x(5))-B34*cos(x(6)-x(5)))-x(3)*x(3)*B44+QSOP4;];
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement