SMHCCA – Sliding mode heating/cooling controller with autotuner
Block SymbolLicensing group: AUTOTUNING
Function Description
The functional block SMHCCA (Sliding Mode Heating/Cooling Controller with Autotuner) is a
highquality control algorithm with a builtin autotuner for automatic tuning of the controller
parameters. The controller is an easily adjustable controller for quality control of
thermal systems with twostate (ONOFF) heating and twostate (ONOFF) cooling. A
classic example of such systems is the plastic extruder. However, it can of course also
be deployed on other systems where conventional thermostats are commonly used
so far. To ensure proper function, the SMHCCA block must be supplemented by the
PWM block (Pulse Width Modulation), as is evident from the following
figure.
Operating Principles
It’s important to realize that the SMHCCA block operates with several time periods. The first
period ${T}_{S}$
is the sampling period of the measured temperature and is also equal to the
period with which the SMHCCA controller block is executed. The second period
${T}_{C}={i}_{pwmc}{T}_{S}$ is the
control period with which the SMHCCA block generates the manipulated variable. This period
${T}_{C}$ is identical to
the cycle period of the PWM block. At every instant when the manipulated variable mv
of the SMHCCA block changes, the PWM block algorithm recalculates the pulse width and
starts a new PWM cycle. The third period that needs to be set is the triggering period
${T}_{R}$ of the PWM
block. Generally, ${T}_{R}$ may
be different from ${T}_{S}$.
To achieve the best control quality, it is recommended to set the period
${T}_{S}$ to the minimum possible
value (${i}_{pwmc}$ to the maximum
possible value), the ratio ${T}_{C}\u2215{T}_{S}$
maximum, but ${T}_{C}$
should be sufficiently small with respect to the process dynamics. For applications in the
plastics industry, the following values are recommended:
Note, however, that for a faster controlled system, the sampling periods ${T}_{S}$, ${T}_{C}$, and ${T}_{R}$ must be shortened! More precisely, the three minimum time constants of the process are important for selecting these time periods (all real thermal processes have at least three time constants). For example, the sampling period ${T}_{S}=0.1$ is sufficiently short for such processes that have at least three time constants, the minimal of them is greater than 10s and the maximal is greater than 100s. For the proper function of the controller, it is necessary that these time parameters are suitably chosen by the user according to the current dynamics of the process! If SMHCCA is implemented on a processor with floatingpoint arithmetic, then the accurate setting of the sampling periods ${T}_{S}$, ${T}_{C}$, ${T}_{R}$ and the parameter beta is critical for the correct function of the controller. Also, some other parameters with the clear meaning described below have to be chosen manually. All the remaining parameters (xi, om, taup, taum, tauf) can be set automatically by the builtin autotuner.
Automatic Tuning Mode
The autotuner uses two methods for this purpose:
 The first one is intended for situations where the process asymmetry is not too large (approximately, this means that the gain ratio of heating/cooling or cooling/heating is less than 5).
 The second method provides tuning support for strongly asymmetric processes and is not yet implemented (So far, this method has been developed and tested in Simulink only).
Despite the fact that the first method of tuning is based only on the heating mode, the resulting parameters are usually satisfactory for both heating and cooling modes due to the strong robustness of sliding mode control. The tuning procedure is very quick and can be completed during the normal rise time of the process temperature from a cold state to the setpoint usually without any delay or degradation of control performance. Thus, the tuning procedure can be included in every startup from a cold state to a working point specified by a sufficiently high temperature.
Now, the implemented procedure will be described in detail:
 The tuning procedure begins in tuning mode or in manual mode. If the tuning mode ($\mathtt{\text{TMODE}}=\mathtt{\text{on}}$) is selected, the manipulated variable mv is automatically set to zero, and the output TBSY is set to on to indicate the tuning phase of the controller. The cold state of the process is preserved until a rising edge off$\to $on is indicated at the TUNE input.
 After some time (dependent on beta), when the noise amplitude is estimated, heating is turned on with the amplitude given by the ut_p parameter. The process temperature pv and its two derivatives (outputs t_pv, t_dpv, t_d2pv) are observed to obtain the optimal controller parameters.
 If the tuning procedure ends without errors, then TBSY is set to off, and the controller begins to operate in manual or automatic mode according to the MAN input. If $\mathtt{\text{MAN}}=\mathtt{\text{off}}$ and the confirmation input TAFF is set to on, then the controller begins to operate in automatic mode with the new set of parameters provided by tuning (if $\mathtt{\text{TAFF}}=\mathtt{\text{off}}$, then the new parameters are only displayed on the outputs p1..p6).
 If an error occurs during tuning, then the tuning procedure stops immediately or stops after the condition pv>sp is met, the output TE is set to on, and ite indicates the type of error. Also in this case, the controller begins to operate in the mode determined by the MAN input. If $\mathtt{\text{MAN}}=\mathtt{\text{off}}$, then it operates in automatic mode with the original parameters before tuning!
 Tuning errors are usually caused by either inappropriate setting of the beta parameter or too low a value of sp. The suitable value of beta ranges in the interval (0.001,0.1). If drift and noise in pv are large, a small beta value must be chosen, especially for the tuning phase. The default value (beta=0.01) should work well for extruder applications. The correct value gives properly filtered signal of the second derivative of the process temperature t_d2pv. This wellfiltered signal (corresponding to the low value of beta) is mainly necessary for proper tuning. For control, the parameter beta can sometimes be slightly increased.
 The tuning procedure can also be started from manual mode ($\mathtt{\text{MAN}}=\mathtt{\text{off}}$) with any constant value of the hv input. However, a steady state must be ensured in this case. Again, tuning is initiated by an upward edge at the TUNE input, and after tuning stops, the controller continues in manual mode. In both cases, the resulting parameters appear on the outputs p1,...,p6.
For individual ips values, the parameters p1,...,p6 have the following meanings:
 0: Controller parameters
 p1… recommended control period ${T}_{C}$
 p2 … xi
 p3 … om
 p4 … taup
 p5 … taum
 p6 … tauf
 1: Auxiliary parameters
 p1 … htp2 – time of the peak in the second derivative of pv
 p2 … hpeak2 – peak value in the second derivative of pv
 p3 … d2 – peak to peak amplitude of t_d2pv
 p4 … tgain
Automatic mode
The control law of the SMHCCA block in automatic mode (MAN=off) is based on the discrete
dynamic sliding mode control technique and employs a special thirdorder filter for estimating
the first and second derivatives of the control error.
After a setpoint change or upset, the controller enters the first phase, the reaching phase, where the discrete sliding variable
is forced to zero. In this definition, ${e}_{k}$, ${\u0117}_{k}$, ${\xeb}_{k}$ denote the filtered deviation error $\left(\mathtt{\text{pv}}\mathtt{\text{sp}}\right)$, its first and second derivatives at time $k$, respectively. The parameters $\xi $ and $\Omega $ are described below. In the second phase, the quasi sliding mode, the variable ${s}_{k}$ is kept near zero value through appropriate control actions, alternating between heating and cooling modes. The amplitudes for heating and cooling are adapted to approximately achieve ${s}_{k}=0$. Consequently, the hypothetical continuous sliding variable
remains approximately zero at all times. In other words, the control deviation $e$ is described by a secondorder differential equation
This implies that the evolution of $e$ can be influenced by choosing the parameters $\xi $ and $\Omega $. Note that for stable behavior, it is required that $\xi >0$ and $\Omega >0$. The typical optimal value of $\xi $ lies in the range $\left[0.1,8\right]$. The optimal value of $\Omega $ is strongly dependent on the controlled process; slower processes have a lower optimal $\Omega $, and faster ones have a higher. The recommended value of $\Omega $ for the start of tuning parameters is $\pi \u2215\left(5{T}_{C}\right)$.
The manipulated variable mv typically ranges from $\left[1,1\right]$. A positive value corresponds to heating, a negative to cooling, e.g., $\mathtt{\text{mv}}=1$ means full heating. The limits on mv can be set by the parameters hilim_p and hilim_m. This limitation may be necessary when there is a significant asymmetry between heating and cooling. For example, if cooling is much more aggressive than heating in the working zone, it is appropriate to set $\mathtt{\text{hilim\_p}}=1$ and $\mathtt{\text{hilim\_m}}<1$. If such limitation is only to be applied in some time interval after a change of setpoint (during the transient response), the initial values of the heating (cooling) action amplitude u0_p and u0_m should be set such that $\mathtt{\text{u0\_p}}\le \mathtt{\text{hilim\_p}}$ and $\mathtt{\text{u0\_m}}\le \mathtt{\text{hilim\_m}}$.
The amplitudes of heating and cooling variables t_ukp and t_ukm, respectively, are automatically adapted by a special algorithm to achieve a quasisliding mode, where the signs of $\mathtt{\text{sk}}$ alternate at each step. In this case, the controller output isv switches between $1$ and $1$. The rate of adaptation of heating and cooling amplitudes is given by the time constants taup and taum. Both of these time constants must be sufficiently large to ensure the proper functioning of adaptation, but finetuning is not essential for the final quality of regulation. For completeness, mv is determined based on the amplitudes t_ukp and t_ukm according to the following expression:
It is also worth mentioning that achieving quasisliding mode occurs very rarely because controlled processes contain transport delays and are subject to disturbances. A suitable indicator of the quality of sliding is again the output isv. For finetuning, it may be possible in exceptional cases to use the beta parameter defining the bandwidth of the derivative filter. In most cases, however, the preset value $\mathtt{\text{beta}}=0.1$ suffices. In manual mode ($\mathtt{\text{MAN}}=\mathtt{\text{on}}$), the controller input hv is copied (after possible limitation by saturation limits $\left[\mathtt{\text{hilim\_m}},\mathtt{\text{hilim\_p}}\right]$) to the output mv.
Manual mode
In the manual mode ($\mathtt{\text{MAN}}=\mathtt{\text{on}}$)
the controller input hv is (after limitation to the range
$\left[\mathtt{\text{hilim\_m}},\mathtt{\text{hilim\_p}}\right]$)
copied to the manipulated variable mv. The controller output mve provides the equivalent
amplitudemodulated value of the manipulated variable mv for informative purposes. The
output mve is obtained by the first order filter with the time constant tauf applied to
mv.
This block propagates the signal quality. More information can be found in the 1.4 section.
Input
sp  Setpoint variable  Double (F64) 
pv  Process variable  Double (F64) 
hv  Manual value  Double (F64) 
MAN  Manual or automatic mode  Bool 



TMODE  Tuning mode  Bool 
TUNE  Start the tuning experiment  Bool 
TBRK  Stop the tuning experiment  Bool 
TAFF  Tuning affirmation  Bool 



ips  Meaning of the output signals  Long (I32) 



Parameter
ipwmc  PWM cycle (in sampling periods of the block) $\odot $100  Long (I32) 
xi  Relative damping of sliding zero dynamics $\downarrow $0.5 $\uparrow $8.0 $\odot $1.0  Double (F64) 
om  Natural frequency of sliding zero dynamics $\downarrow $0.0 $\odot $0.01  Double (F64) 
taup  Time constant for adaptation  heating [s] $\odot $700.0  Double (F64) 
taum  Time constant for adaptation  cooling [s] $\odot $400.0  Double (F64) 
beta  Bandwidth parameter of the derivative filter $\odot $0.01  Double (F64) 
hilim_p  Upper limit of the heating action amplitude $\downarrow $0.0 $\uparrow $1.0 $\odot $1.0  Double (F64) 
hilim_m  Upper limit of the cooling action amplitude $\downarrow $0.0 $\uparrow $1.0 $\odot $1.0  Double (F64) 
u0_p  Initial amplitude  heating action $\odot $1.0  Double (F64) 
u0_m  Initial amplitude  cooling action $\odot $1.0  Double (F64) 
sp_dif  Setpoint difference threshold $\odot $10.0  Double (F64) 
tauf  Equivalent manipulated variable filter time constant $\odot $400.0  Double (F64) 
itm  Tuning method $\odot $1  Long (I32) 



ut_p  Amplitude of heating for tuning experiment $\downarrow $0.0 $\uparrow $1.0 $\odot $1.0  Double (F64) 
ut_m  Amplitude of cooling for tuning experiment $\downarrow $0.0 $\uparrow $1.0 $\odot $1.0  Double (F64) 
Output
mv  Manipulated variable (controller output)  Double (F64) 
mve  Equivalent manipulated variable  Double (F64) 
de  Deviation error  Double (F64) 
SAT  Saturation flag  Bool 



isv  Number of sliding variable steps  Long (I32) 
t_ukp  Current amplitude of heating  Double (F64) 
t_ukm  Current amplitude of cooling  Double (F64) 
t_sk  Discrete dynamic sliding variable  Double (F64) 
t_pv  Filtered process variable  Double (F64) 
t_dpv  Filtered first derivative of process variable  Double (F64) 
t_d2pv  Filtered second derivative of process variable  Double (F64) 
TBSY  Tuner busy flag  Bool 
TE  Tuning error  Bool 



ite  Error code  Long (I32) 



p1..p6  Results of identification and design phase  Double (F64) 
[Previous] [Back to top] [Up] [Next]
2024 © REX Controls s.r.o., www.rexygen.com