Implementing PID regulator in multiple output system
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a problem with implementing PID regulator in my university project. I have to regulate the system and I think that means regulating the position of both masses 1 and 2. I have a state spece model of system, simulink model for system without PID and simulink model with a probably incorrectly installed PID controller. I'm not sure if the responses are correct and I need advice.
Can someone check my attempt and explain how to implement a PID controller for my problem?
Thanks guys :D .
Problem
State space model
Simulink without PID
m1 without PID
m2 without PID
With PID
m1 with PID
m2 with PID
0 Commenti
Risposta accettata
Sam Chak
il 1 Set 2022
Since you have state-space model, it is recommended to implement linear state-space system using the State-Space Block. This may reduce human error when attempting to build a large system with many fundamental blocks. Troubleshoot is also easy.
By the way, what are the requirements of the responses in terms of desired settling time and percentage overshoot?
2 Commenti
Sam Chak
il 2 Set 2022
I added an example in the second Answer. The PID gains are tuned to achieve the shortest settling time (1.1 sec) for , but it exceeds 7% overshoot. You can tune the PID by setting . Overshot is less than 7%.
Più risposte (2)
Sam Chak
il 2 Set 2022
If you find the performances and tuning are acceptable, please consider voting 👍 the Answer. Thanks!
The Plants are 4th-order systems, but the PID is a 2nd-order compensator. Naturally, it is unable to satisfy all kinds of performance requirements. But we can try.
Since your Prof didn't specify the requirements, the PID gains are tuned across a range of the 0 dB gain crossover frequency [wc] of the tuned open-loop response to achieve the fastest settling time for the step response of without high overshoot and oscillatory transient response.
You can try this range if you want to converge within 10 seconds.
m1 = 2;
m2 = 1;
k1 = 2;
k2 = 1;
c1 = 6;
c2 = 3;
A = [0 1 0 0; -(k1+k2)/m1 -(c1+c2)/m1 k2/m1 c2/m1; 0 0 0 1; k2/m2 c2/m2 -k2/m2 -c2/m2];
B = [0; 1/m1; 0; 0];
C = [1 0 0 0; 0 0 1 0];
D = zeros(2, 1);
sys = ss(A, B, C, D);
G = tf(sys);
% Plant transfer function of Y2(s)/U(s)
Gp = G(2)
% Design PIDF to achieve the shortest Settling Time for x2
wc = 3.5031;
Gc = pidtune(Gp, 'PIDF', wc)
% Closed-loop transfer function of Y2(s)/R(s)
Gcl2= minreal(feedback(Gc*Gp, 1))
% Closed-loop transfer function of Y1(s)/R(s)
Gcl1= minreal(feedback(Gc*G(1), 1))
S1 = stepinfo(Gcl1)
S2 = stepinfo(Gcl2)
Ts1 = S1.SettlingTime;
subplot(2, 1, 1)
step(Gcl1, round(3*Ts1)), grid on, title('Step Response of x_{1}')
subplot(2, 1, 2)
step(Gcl2, round(3*Ts1)), grid on, title('Step Response of x_{2}')
Sam Chak
il 3 Set 2022
Thanks for your vote. You can use the gensig() function to generate the sine wave input, and then use lsim() to produce the output responses.
% parameters
m1 = 2;
m2 = 1;
k1 = 2;
k2 = 1;
c1 = 6;
c2 = 3;
A = [0 1 0 0; -(k1+k2)/m1 -(c1+c2)/m1 k2/m1 c2/m1; 0 0 0 1; k2/m2 c2/m2 -k2/m2 -c2/m2];
B = [0; 1/m1; 0; 0];
C = [1 0 0 0; 0 0 1 0];
D = zeros(2, 1);
sys = ss(A, B, C, D);
G = tf(sys);
% Plant transfer function of Y2(s)/U(s)
Gp = G(2)
% Design PIDF to achieve the shortest Settling Time for x2
wc = 3.5031;
Gc = pidtune(Gp, 'PIDF', wc)
% Closed-loop transfer function of Y2(s)/R(s)
Gcl2= minreal(feedback(Gc*Gp, 1))
% Closed-loop transfer function of Y1(s)/R(s)
Gcl1= minreal(feedback(Gc*G(1), 1))
tau = 10; % one period cycle of the sine wave
[u, t] = gensig('sine', tau, 2*tau, 0.01);
subplot(2, 1, 1)
lsim(Gcl1, u, t), ylim([-1.5 1.5]), grid on, title('Step Response of x_{1}')
subplot(2, 1, 2)
lsim(Gcl2, u, t), ylim([-1.5 1.5]), grid on, title('Step Response of x_{2}')
0 Commenti
Vedere anche
Categorie
Scopri di più su PID Controller Tuning in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!