Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Most PID tuning rules are based on the assumption that the plant can be approaximated by a first-order plus time delay system. This code explains why this assumption is valid and how to identify such an approximation model. Finaly, we use a 4th-order example to show how this can be done and compare it with oscilation based tuning approach.
Contents
Step Response
Approximation of the 4th Order System using the Maximum Slope Line Process Reaction Curve Approximation
PID Tuning
Step Response
Consider a typical first order system,
Their step responses are generated using the MATLAB Control System Toolbox as follows.
subplot(223) step(G) hold plot([0 1],[0 1],'Linewidth',2) plot([1 1],[0 1],':') set(gca,'Xtick',1) Current plot held
Approximation of the 4th Order System using the Maximum Slope Line
To approximate the 4th order system, we wish to keep the maximum response speed being the same between the actual system and the approximated first-order plus time delay system. Therefore, this leads to the so called process reaction curve approach to identify the approaximation.
[y,t]=step(G2); % The maximum response speed and the corresponding time point [dydt,idx]=max(diff(y)./diff(t)); % The crossing point with the initial line t0=t(idx)-y(idx)/dydt; % The crossing point with the steady state line t1=t(idx)+(1-y(idx))/dydt; % plot the step response with the maximum slope subplot(224) plot(t,y,'-',[t0 t1],[0 1],'r--','Linewidth',2)
[model,controller]=ReactionCurve(t,y); fprintf('Process gain: %g, Time constant: %g, Time delay: %g\n',model.gain, model.time_constant, model.time_delay) % We can compare how good the approximation is. figure Ga = tf(model.gain,[model.time_constant 1]); set(Ga,'InputDelay',model.time_delay') step(Ga) hold plot(t,y,'--','Linewidth',2) legend('approximation','Process Reaction Curve')
% This example shows that the approximation matches the maximum response % speed well but overall response speed is slower than original system. % This is the general behaviour of this approach. Process gain: 0.998794, Time constant: 4.45908, Time delay: 1.42509 Current plot held
PID Tuning
There are many PID tuning rules around for first-order plus time delay systems. The following tuning table was derived by ZieglerNichols to provide a quarter decay ratio (the ratio of the second peak over the first peak). (alpha: time delay, tau: time constant, Kp: gain) Controller P PI PID Kc tau/(Kp*alpha) 0.9*tau/(Kp*alpha) 3.33*alpha 1.2*tau/(Kp*alpha) 2*alpha 0.5*alpha Ti Td
For the 4th order example, the corresponding controller is derived by the ReactionCurve function as follows:
Controller P PI PID
Ti
Td
For the 4th order example, the ITAE PI and PID controllers are: Controller PI PID Kc Ti Td
K = controller.PID; % Connect it with the 4th-order system to form a closed-loop system. T = feedback(G2*K,1); % The closed-loop response to a step input is as follows. [y,t]=step(T); % Compare it with the ITAE PID controller derived as above % k=znpidtuning(G2,3); K2=2.5622*(1+tf(1,[5.9532 0])+tf([0.4760 0],1)); T2=feedback(G2*K2,1); y2=step(T2,t); figure plot(t,y,'-',t,y2,'--','Linewidth',2) grid legend('Approximate Model Tuning','ITAE Tuning') % Clearly, the ITAE tuning rule gives much better result.