Issues tuning pid using simulink
8 views (last 30 days)
Show older comments
I'm trying to evaluate a closed loop system using Zigler nichols table for a Pid with G(s)=
and k_p=5,16,k_i= 3,85 and k_d =1,72
But everytime I set a K_d > 1 i have the following error log by simulink
An error occurred while running the simulation and the simulation was terminated
Caused by: Derivative of state '1' in block 'untitled1/Sistema_analogico/Gs1' at time 11.225798821660552 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
Where the simularion stops depends ow how large I set the k_d, i don t know how to fix this.
Thanks in advance for your help
0 Comments
Answers (1)
Sam Chak
on 2 Jan 2024
Hi @Paolo
Your question on the control problem went unnoticed for more than 1 month. The plant system has a zero (s = 0.1) in the right-half plane. Therefore, it is not easy to design a satisfactory ideal PID controller. You may have noticed that as the derivative gain
approaches 1, the undershoot of the closed-loop system also grows infinitely large in the negative direction.
The example below illustrates four cases, with the first being the uncompensated system (stable but with unacceptably large undershoot), and the other three involving 'ideal' PID controllers. If a smaller undershoot is desired, you will need to explore other configurations of controllers.
%% Non-minimum Phase Plant
s = tf('s');
Gp = tf((- s + 0.1)/((s + 0.6)*(s + 8)))
%% OP's manually-tuned PID Controller (Ziegler–Nichols)
Gc1 = pid(5.16, 3.85, 0.6172) % with kd < 1 is selected
Gcl1= minreal(feedback(Gc1*Gp, 1))
%% Auto-tuned PID Controller (Unspecified requirements)
Gc2 = pidtune(Gp, 'PID')
Gcl2= minreal(feedback(Gc2*Gp, 1));
%% Optimized 'ideal' PID Controller
kp = 0.0290818775069017; % P-gain
ki = 2.45979506934827; % I-gain
kd = 0.216673683005054; % D-gain
Gc3 = pid(kp, ki, kd)
Gcl3= minreal(feedback(Gc3*Gp, 1));
%% Plot Step response and data collection
Gcl = [Gp/dcgain(Gp), Gcl1, Gcl2, Gcl3];
for j = 1:4
sNFO(j) = stepinfo(Gcl(j)); % stored in sNFO structure
step(Gcl(j), 60) % simulate up to 60 sec
hold on
end
hold off
grid on
legend('Case 1: Uncompensated', 'Case 2: Z–N tuned PID', 'Case 3: Auto-tuned PI', 'Case 4: Optimized PID', 'location', 'E')
%% Table of Step-response Characteristics
myCell = [fieldnames(sNFO), permute(struct2cell(sNFO), [1 3 2])];
myTable = cell2table(myCell, "VariableNames", ["Performance Aspect", "Case 1", "Case 2", "Case 3", "Case 4"])
0 Comments
See Also
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!