### SMHCCA – Sliding mode heating/cooling controller with autotuner

Block SymbolLicensing group: AUTOTUNING

Function Description
The sliding mode heating/cooling controller (SMHCCA) is a novel high quality control algorithm with a built-in autotuner for automatic tuning of the controller parameters. The controller is mainly intended for temperature control of heating-cooling (possibly asymmetrical) processes with ON-OFF heaters and/or ON-OFF coolers. The plastic extruder heating/cooling system is a typical example of such process. However, it can also be applied to many similar cases, for example, to thermal systems where a conventional thermostat is normally employed. To provide the proper control function, the SMHCCA block must be combined with the PWM block (Pulse Width Modulation) as depicted in the following figure.

It is important to note that the block SMHCCA works with two time periods. The first period ${T}_{S}$ is the sampling time of the process temperature, and this period is equal to the period with which the block SMHCCA itself is executed. The other period ${T}_{C}={i}_{pwmc}{T}_{S}$ is the control period with which the block SMHCCA generates the manipulated variable. This period ${T}_{C}$ is equal to the cycle time of PWM block. At every instant when the manipulated variable mv is changed by SMHCCA the PWM algorithm recalculates the width of the output pulse and starts a new PWM cycle. The time resolution ${T}_{R}$ of the PWM block is third time period involved in. This period is equal to the period with which the block PWM is executed and generally may be different from ${T}_{S}$. To achieve the high quality of control it is recommended to choose ${T}_{S}$ as minimal as possible (${i}_{pwmc}$ as maximal as possible), the ratio ${T}_{C}∕{T}_{S}$ as maximal as possible but ${T}_{C}$ should be sufficiently small with respect to the process dynamics. An example of reasonable values for an extruder temperature control is as follows:

${T}_{S}=0.1,\phantom{\rule{1em}{0ex}}{i}_{pwmc}=50,\phantom{\rule{1em}{0ex}}{T}_{C}=5s,\phantom{\rule{1em}{0ex}}{T}_{R}=0.1s.$

Notice however that for a faster controlled system the sampling periods ${T}_{S}$, ${T}_{C}$ and ${T}_{R}$ must be shortened! More precisely, the three minimal time constant of the process are important for selection of these time periods (all real thermal process has 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 actual dynamics of the process! If SMHCCA is implemented on a processor with floating point arithmetic then the accurate setting of the sampling periods ${T}_{S}$, ${T}_{C}$, ${T}_{R}$ and the parameter beta is critical for 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 by the built-in autotuner automatically. The autotuner uses the two methods for this purpose.

• The first one is dedicated to situations where the asymmetry of the process is not enormous (approximately, it means that the gain ratio of heating/cooling or cooling/heating is less than 5).
• The second method provides the tuning support for the strong asymmetric processes and is not implemented yet (So far, this method has been developed and tested in Simulink only).

Despite the fact that the first method of the tuning is based only on the heating regime, the resulting parameters are usually satisfactory for both heating and cooling regimes because of the strong robustness of sliding mode control. The tuning procedure is very quick and can be accomplished during the normal rise time period of the process temperature from cold state to the setpoint usually without any temporization or degradation of control performance. Thus the tuning procedure can be included in every start up from cold state to the working point specified by the sufficiently high temperature setpoint. Now the implemented procedure will be described in detail. The tuning procedure starts in the tuning mode or in the 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 1 for indication of the tuning stage of the controller. The cold state of the process is preserved until the initialization pulse is applied to the input TUNE ($\mathtt{\text{0}}\to \mathtt{\text{1}}$). After some time (depending on beta), when the noise amplitude is estimated, the heating is switched on with the amplitude given by the parameter ut_p. The process temperature pv and its two derivatives (outputs t_pv, t_dpv, t_d2pv) are observed to obtain the optimal parameters of the controller. If the tuning procedure ends without errors, then TBSY is set to 0 and the controller begins to work in manual or automatic mode according to the input MAN. If $\mathtt{\text{MAN}}=\mathtt{\text{off}}$ and affirmation input TAFF is set to 1, then the controller starts to work in automatic mode with the new parameter set provided by the tuner (if $\mathtt{\text{TAFF}}=\mathtt{\text{off}}$, then the new parameters are only displayed on the outputs p1..p6). If some error occurs during the tuning, then the tuning procedure stops immediately or stops after the condition pv>sp is fulfilled, the output TE is set to 1 and ite indicate the type of error. Also in this case, the controller starts to work in the mode determined by the input MAN. If $\mathtt{\text{MAN}}=\mathtt{\text{off}}$ then works in automatic mode with the initial parameters before tuning! The tuning errors are usually caused either by an inappropriate setting of the parameter beta or by the too low value of sp. The suitable value of beta ranges in the interval (0.001,0.1). If a drift and noise in pv are large the small beta 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 well-filtered signal (corresponding to the low value of beta) is mainly necessary for proper tuning. For control, the parameter beta may be sometimes slightly increased. The tuning procedure may be also started from manual mode ($\mathtt{\text{MAN}}=\mathtt{\text{off}}$) with any constant value of the input hv. However, the steady state must be provided in this case. Again, the tuning is started by the initialization pulse at the input TUNE ($\mathtt{\text{0}}\to \mathtt{\text{1}}$) and after the stop of tuning the controller continues in the manual mode. In both cases the resulting parameters appear on the outputs p1,...,p6.

The control law of the block SMHCCA in automatic mode ($\mathtt{\text{MAN}}=\mathtt{\text{off}}$) is based on the discrete dynamic sliding mode control technique and special 3rd order filters for estimation of the first and second derivatives of the control error.

The first control stage, after a setpoint change or upset, is the reaching phase when the dynamic sliding variable

${s}_{k}\stackrel{△}{=}{ë}_{k}+2\xi \Omega {ė}_{k}+{\Omega }^{2}{e}_{k}$

is forced to zero. In the above definition of the sliding variable, ${e}_{k},{ė}_{k},{ë}_{k}$ denote the filtered deviation error $\left(\mathtt{\text{pv}}-\mathtt{\text{sp}}\right)$ and its first and second derivatives in the control period $k$, respectively, and $\xi ,\Omega$ are the control parameters described below. In the second phase, ${s}_{k}$ is hold at the zero value (the sliding phase) by the proper control "bangs". Here, the heating action is alternated by cooling action and vice versa rapidly. The amplitudes of control actions are adapted appropriately to guarantee ${s}_{k}=0$ approximately. Thus, the hypothetical continuous dynamic sliding variable

$s\stackrel{△}{=}ë+2\xi \Omega ė+{\Omega }^{2}e$

is approximately equal to zero at any time. Therefore the control deviation behaves according to the second order differential equation

$s\stackrel{△}{=}ë+2\xi \Omega ė+{\Omega }^{2}e=0$

describing so called zero sliding dynamics. From it follows that the evolution of $e$ can be prescribed by the parameters $\xi ,\Omega$. For stable behavior, it must hold $\xi >0,\Omega >0$. A typical optimal value of $\xi$ ranges in the interval $\left[4,8\right]$ and $\xi$ about $6$ is often a satisfactory value. The optimal value of $\Omega$ strongly depends on the controlled process. The slower processes the lower optimal $\Omega$. The recommended value of $\Omega$ for start of tuning is $\pi ∕\left(5{T}_{C}\right)$.

The manipulated variable mv usually ranges in the interval $\left[-1,1\right]$. The positive (negative) value corresponds to heating (cooling). For example, $\mathtt{\text{mv}}=1$ means the full heating. The limits of mv can be reduced when needed by the controller parameters hilim_p and hilim_m. This reduction is probably necessary when the asymmetry between heating and cooling is significant. For example, if in the working zone the cooling is much more aggressive than heating, then these parameters should be set as $\mathtt{\text{hilim_p}}=1$ and $\mathtt{\text{hilim_m}}<1$. If we want to apply such limitation only in some time interval after a change of setpoint (during the transient response) then it is necessary to set initial value of the heating (cooling) action amplitude u0_p (u0_m) to the suitable value less than hilim_p (hilim_m). Otherwise set $\mathtt{\text{u0_p}}=\mathtt{\text{hilim_p}}$ and $\mathtt{\text{u0_m}}=\mathtt{\text{hilim_m}}$.

The current amplitudes of heating and cooling uk_p, uk_m, respectively, are automatically adapted by the special algorithm to achieve so called quasi sliding mode, where the sign of ${s}_{k}$ alternately changes its value. In such a case the controller output isv alternates the values $1$ and $-1$. The rate of adaptation of the heating (cooling) amplitude is given by time constant taup (taum). Both of these time constants have to be sufficiently high to provide the proper function of adaptation but the fine tuning is not necessary. Note for completeness that the manipulated variable mv is determined from the action amplitudes uk_p, uk_m by the following expression

$\mathrm{\text{if}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\left({s}_{k}<0.0\right)\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{\text{then}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\mathtt{\text{mv}}=\mathtt{\text{uk_p}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{\text{else}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\mathtt{\text{mv}}=-\mathtt{\text{uk_m}}.$

Further, it is important to note that quasi sliding is seldom achievable because of a process dead time or disturbances. The suitable indicator of the quality of sliding is again the output isv. If the extraordinary fine tuning is required then it may be tried to find the better value for the bandwidth parameter beta of derivative filter, otherwise the default value $0.1$ is preferred.

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 amplitude-modulated 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.

Inputs

 sp Setpoint variable Double (F64) pv Process variable Double (F64) hv Manual value Double (F64) MAN Manual or automatic mode Bool 0 .... Automatic mode 1 .... Manual mode TMODE Tuning mode Bool TUNE Start the tuning experiment: TUNE off$\to$on Bool TBRK Stop the tuning experiment: TBRK off$\to$on Bool TAFF Affirmation of the parameter set provided by the tuning procedure: $\mathtt{\text{TAFF}}=\mathtt{\text{on}}$ Bool ips Meaning of the output signals p1,…,p6 Long (I32) 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

Outputs

 mv Manipulated variable (controller output) Double (F64) mve Equivalent manipulated variable Double (F64) de Deviation error Double (F64) SAT Saturation flag Bool 0 .... Signal not limited 1 .... Saturation limits active, $\mathtt{\text{mv}}\ge \mathtt{\text{hilim_p}}$ or $\mathtt{\text{mv}}\le \mathtt{\text{-hilim_m}}$ isv Number of the positive ($+$) or negative ($-$) 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 pv by 3rd order filter Double (F64) t_dpv Filtered first derivative of pv by 3rd order filter Double (F64) t_d2pv Filtered second derivative of pv by 3rd order filter Double (F64) TBSY Tuner busy flag ($\mathtt{\text{TBSY}}=\mathtt{\text{on}}$) Bool TE Tuning error Bool off .. Autotuning successful on ... An error occured during the experiment ite Error code Long (I32) 0 .... No error 1 .... Noise level in pv too high, check the temperature input 2 .... Incorrect parameter ut_p 3 .... Setpoint sp too low 4 .... The two minimal process time constants are probably too small with respect to the sampling period ${T}_{S}$ OR too high level of noise in the second derivative of pv (try to decrease the beta parameter) 5 .... Premature termination of the tuning procedure (TBRK) pi Identified parameters with respect to ips, $i=1,...,6$ Double (F64)

Parameters

 ipwmc PWM cycle (in sampling periods of the block, ${T}_{C}∕{T}_{S}$) $\odot$100 Long (I32) xi Relative damping of sliding zero dynamics $↓$0.5$↑$8.0$\odot$1.0 Double (F64) om Natural frequency $\omega$ of sliding zero dynamics $↓$0.0$\odot$0.01 Double (F64) taup Time constant for adaptation of heating action amplitude [s] $\odot$700.0 Double (F64) taum Time constant for adaptation of cooling action amplitude [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 $↓$0.0 $↑$1.0 $\odot$1.0 Double (F64) hilim_m Upper limit of the cooling action amplitude $↓$0.0 $↑$1.0 $\odot$1.0 Double (F64) u0_p Initial amplitude of the heating action $\odot$1.0 Double (F64) u0_m Initial amplitude of the cooling action $\odot$1.0 Double (F64) sp_dif Setpoint difference threshold for blocking of heating/cooling amplitudes reset $\odot$10.0 Double (F64) tauf Time constant of the filter for obtaining the equivalent manipulated variable $\odot$400.0 Double (F64) itm Tuning method  $\odot$1 Long (I32) 1 .... Restricted to symmetrical processes 2 .... Asymmetrical processes (not implemented yet) ut_p Amplitude of heating for tuning experiment $↓$0.0 $↑$1.0 $\odot$1.0 Double (F64) ut_m Amplitude of cooling for tuning experiment $↓$0.0 $↑$1.0 $\odot$1.0 Double (F64)

2020 © REX Controls s.r.o., www.rexygen.com