Guideline for implementing PID and saturation
9 views (last 30 days)
Show older comments



I have the following model where I have as a setpoint a step input with constant value 10 and stepme 0 and used initially a step input of value 600 in order to approximate an impulse; which are now the PID and saturation block guidelines in order to successfully track the setpoint (R=10)? How can I achieve an oscillating behaviour around the setpoint?
5 Comments
Answers (2)
Sam Chak
on 4 Jun 2025
Hi @Jo
This system is somewhat difficult to control. I have not explored how you successfully track the setpoint using a gain-scheduling control approach. If a relatively slow response is acceptable, it may be possible to design a series of gain schedules. Would you mind sharing how you achieved that?
In my control design in MATLAB, I assume that all system states are measurable for simplicity. I have not tested it in Simulink, but in theory, it should work as well if the system states are properly estimated using an observer.
%% settings
format long g
sympref("HeavisideAtOrigin", 1);
%% call ode45
[t, x] = ode45(@ode, [0 30], [1; 1; 1]);
y = zeros(1, numel(t));
for j = 1:numel(t)
[~, y(j)] = ode(t(j), x(j,:).');
end
%% plot result
figure
plot(t, y)
grid on
xlabel({'$t$'}, 'interpreter', 'latex')
ylabel({'$y(t)$'}, 'interpreter', 'latex')
title({'System''s Output'}, 'interpreter', 'latex')
%% steady-state value
y(end)
%% Lur'e System - Nonlinear feedback with Linear Time-invariant System
function [dx, y] = ode(t, x)
% Parameters
wn = 0.0307;
a1 = 40*wn^3;
a2 = 54*wn^2;
a3 = 15*wn;
B = a1;
gamma = 1.8499;
% Nonlinear Output, y(t)
y = 100/(abs(real(x(1)))^gamma + 1);
dy = - (100*gamma*abs(real(x(1)))^(gamma - 1))/(abs(real(x(1)))^gamma + 1)^2;
d2y = (100*gamma*abs(real(x(1)))^(gamma - 2)*(abs(real(x(1)))^gamma + gamma*(abs(real(x(1)))^gamma - 1) + 1))/(abs(real(x(1)))^gamma + 1)^3;
dx3 = - a1*x(1) - a2*x(2) - a3*x(3);
yinv = abs(100*abs(real(x(1))) - 1)^(1/gamma);
% Controller
k = 1/1.000014303460806;
ref = 10; % setpoint
yref = k*ref;
dyref = 0;
d2yref = 0;
d3yref = 0;
% u = heaviside(t);
u = (yinv*(d3yref - 3*(dy*x(2) + y*x(3) - d2yref) - 3*(y*x(2) - dyref) - (y - yref) - d2y*x(2) - 2*dy*x(3)) - dx3)/(2*B);
% Linear System
dx = zeros(3, 1);
dx(1) = x(2);
dx(2) = x(3);
dx(3) = B*u - a1*x(1) - a2*x(2) - a3*x(3);
end
0 Comments
Sam Chak
on 5 Jun 2025
Hi @Jo
I revisited your Lur'e system and designed a combined PID controller with a lead compensator in Simulink to regulate the nonlinear process variable at the desired setpoint.
Sometimes, I find myself clouded by the overkill math I derived in MATLAB. The graphical model in Simulink allows me to "see" where the problem lies, enabling me to attack its weak points.


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!


