Guideline for implementing PID and saturation
Ältere Kommentare anzeigen



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 Kommentare
Hi @Jo
It appears that the blocks in the 2nd image form a nonlinear function,
, but this does not correspond to any of the three commonly expressed Hill equations. The exponent n is not provided. While the 3rd-order transfer function is linear, its output is connected to the Hill equation block, rendering the closed-loop system nonlinear.
It is unclear whether you intend for the process variable to be regulated at a constant setpoint of 10 or for the response of the process variable to oscillate around the setpoint like a sine wave.
t = linspace(0, 20, 2001)';
sp = 10;
y1 = 10*heaviside(t);
y2 = y1/27.*(27 - 2*exp(-10*t) + 15*exp(-4*t) - 40*exp(-t));
y3 = y2 + sin(2*pi/5*t);
plot(t, [y1, y2, y3]), grid on
xlabel('t')
ylabel('y(t)')
legend({'Setpoint', 'Flat response', 'Ocillating response'}, 'Location', 'east')
Jo
am 4 Jun. 2025
Jo
am 4 Jun. 2025
Antworten (2)
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
Sam Chak
am 5 Jun. 2025
0 Stimmen
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.


Kategorien
Mehr zu PID Controller Tuning finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



