Example H4.7
Matlab code for example 4.7 from the book "Regeltechniek voor het HBO"
Determining a second order model from a response with no overshoot
- Date : 31/03/2022
- Revision : 3.1
Copyright (c) 2022, Studieboeken Specialist Permission is granted to copy, modify and redistribute this file, provided that this header message is retained.
The approximation of a time delay according to formula 4.41 makes it possible to approximately determine the two time constants of a second order process with (so no overshoot in the step response) If , then the method of example 4.4 provides the solution. As an intermediate step we first reduce the system to a first order process with time delay. To demonstrate this we consider the unit step response of figure 4.19. We see a step response with the characteristics of figure 4.7a, described by a formula like equation 4.19. So we decide it is a step response of a (dominant) second order process without overshoot. There are many processes with a step response as shown in figure 4.19. Especially thermal systems show that behaviour very often. Not surprising that this type of step response has got its own (famous) name: "s-curve"!
In figure 4.19 we draw as best as we can the bent tangent line. With the times and in this figure, the process can be approximately represented as a first order system with time delay and time constant : . With formula 4.41 we can approximate the time delay of 2 seconds with result:
Matlab code (1) for this example (under construction)
To check the result you must simulate the unit step response of the approximation:
% clear all variables from Workspace and close all figures.
Tsim=14; % simulationtime in seconds
As can be seen the approximation is not so good
Matlab code (2) for this example (under construction)
The approximation of a delay with a first order proces can be used to create a model of a system that shows a second order stepresponse with no overshoot (). Let's assume that the measured unit step response looks like the Matlab created figure below:
% For the moment in stead of a measurement we assume a time constant Tau_1 of 1 seconds
% and a time constant of Tau_2 of 2 seconds to simulate a measured stepresponse.
H_meas=(K_stat/(Tau_1*s+1))*(1/(Tau_2*s+1));
% Plot measured stepresponse
title('Simulation of a measured stepresponse');
Matlab code (3) for this example (under construction)
We try to approximate it with a dead time Td followed by an exponential curve that fits with the right half of the measurement.
With measurements at two time points and the final value we can determine the time constant of an exponential curve. We measure the y-value at a time t1, t2 and its final value.
The tau value is then given by:
This all assumes that the exponential curve will start at t=0. Which it does not.
% Note down the measurements
Calculate the time constant and the dead time:
Tau_est=(t2-t1)/log((Y_end-Y_t1)/(Y_end-Y_t2))
fact_1=log((Y_end-Y_t1)/Y_end)
fact_2=log((Y_end-Y_t2)/Y_end)
Td_est=((fact_2*t1-fact_1*t2)/(fact_1-fact_2))
Tau_est1=-(t1-Td_est)/fact_1
Tau_est2=-(t2-Td_est)/fact_2
Generate Matlab figure(s) for usage in the book
Init create Enhanced Figures
Close all the earlier enhanced figures with a certain tag
EnhancedFig = findobj(0, 'Tag', 'EnhancedImage');
Enhance the figures
set(gcf, 'Tag','EnhancedImage');
% First plot the measured stepresonse
title('Approximation of 2nd order model for a stepresponse with no overshoot');`z
Yoffset=0.01; % A slight offset to show the dashed e-curve better
% PLot a exponential that fits with the right part
Y_end=4; % Final value of y(t)
H_approx1=1/(Tau*s+1)*exp(-s*Td);
exponential=Y_end*(1-exp(-max((t-Td),0)/Tau))-Yoffset;
plot(t,exponential,'--k');
% Create special characters
ch_tau = char(964); % Greek letter tau
ch_arrow = char(8594); % right arrow
plot([Td Td],[0 1],'--k');
plot([0 Td],[0.85 0.85],'-k');
plot([T_63pct T_63pct],[0 0.63*Y_end],'--k');
plot([0 T_63pct],[0.63*Y_end 0.63*Y_end],'--k');
plot([Td T_63pct],[0.75 0.75],'-k');
annotation(figure1,'textarrow',[0.385 0.166],...
[0.421 0.271],'String',{['Td' ch_arrow ' ' ch_tau '_1 = 2']});
annotation(figure1,'textarrow',[0.383 0.246],...
[0.347 0.254],'String',{[ch_tau '_2 = 4']});
= Make model
H_approx2=Y_end/((Td*s+1)*(Tau*s+1));
= Compare the model with the measured reponse