Advertisement
Guest User

Untitled

a guest
Sep 18th, 2021
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.07 KB | None | 0 0
  1. % 18-9-2021 Max van Meer
  2. % Derivation of cascaded control system
  3. % based on https://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpeed&section=SystemModeling
  4. clc
  5. clear
  6. close all
  7. format long
  8.  
  9. syms b K J R L
  10.  
  11. % Define state-space
  12. A = [0 1 0; % first state is theta
  13.     0 -b/J K/J;
  14.     0 -K/L -R/L];
  15. B = [0; 0; 1/L]; % input is voltage
  16. C_theta = [1 0 0]; % output is first state: angle
  17. C_curr = [0 0 1]; % output is third state: current
  18.  
  19. syms s
  20. G_volt_to_theta = C_theta*(s*eye(3)-A)^-1 * B
  21. G_volt_to_curr = C_curr*(s*eye(3)-A)^-1 * B
  22.  
  23. mysubs.J = 0.01;
  24. mysubs.b = 0.1;
  25. mysubs.K = 0.01;
  26. mysubs.R = 1;
  27. mysubs.L = 0.5;
  28.  
  29. G_volt_to_theta = subs(G_volt_to_theta,mysubs);
  30. G_volt_to_theta = sym2tf(G_volt_to_theta); % see mathworks exchange
  31.  
  32. G_volt_to_curr = subs(G_volt_to_curr,mysubs);
  33. G_volt_to_curr = sym2tf(G_volt_to_curr);
  34.  
  35. figure
  36. bode(G_volt_to_theta)
  37. hold on;
  38. bode(G_volt_to_curr)
  39. grid
  40.  
  41. s = tf('s');
  42. current_controller = 1e6*(s+1e6) / s;
  43. figure
  44. step(feedback(current_controller*G_volt_to_curr,1)) % closed loop is stable with high bandwidth
  45.  
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement