### SMHCC – Sliding mode heating/cooling controller Function Description
The sliding mode heating/cooling controller SMHCC is a novel high quality control algorithm intended for temperature control of heating-cooling (possibly asymmetrical) processes with ON-OFF heaters and/or ON-OFF coolers. The plastic extruder is a typical example of such process. However, it can also be applied to many similar cases, for example in thermal systems where a conventional thermostat is employed. To provide the proper control function the block SMHCC must be combined with the block PWM (Pulse Width Modulation) as depicted in the following figure. It is important to note that the block SMHCC 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 SMHCC itself is executed. The second period ${T}_{C}={i}_{pwmc}{T}_{S}$ is the control period with which the block SMHCC generates manipulated variable. This period ${T}_{C}$ is also equal to the cycle time of PWM block. At every instant when the manipulated variable mv is changed by SMHCC 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 with. This period is equal to the period with which the block PWM is run 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}=100,\phantom{\rule{1em}{0ex}}{T}_{C}=10s,\phantom{\rule{1em}{0ex}}{T}_{R}=0.01s.$

The control law of the block SMHCC 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 the 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.

Inputs

 sp setpoint variable Double (F64) pv process variable Double (F64) hv manual value Double (F64) MAN controller mode Bool 0 .... automatic mode 1 .... manual mode

Outputs

 mv manipulated variable (position controller output) Double (F64) mve equivalent manipulated variable Double (F64) de deviation error Double (F64) SAT saturation flag Bool 0 .... the controller implements a linear control law 1 .... the controller output is saturated, $\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 ${s}_{k}$ Double (F64) t_pv filtered control error -de Double (F64) t_dpv filtered first derivative of the control error t_ek Double (F64) t_d2pv filtered second derivative of the control error t_ek Double (F64)

Parameters

 ipwmc PWM cycle in the sampling periods of SMHCC (${T}_{C}∕{T}_{S}$) Long (I32) xi relative damping $\xi$ of sliding zero dynamics $\mathtt{\text{xi}}\ge 0$ Double (F64) om natural frequency $\Omega$ of sliding zero dynamics $↓$(0.0) Double (F64) taup time constant for adaptation of heating action amplitude in seconds Double (F64) taum time constant for adaptation of cooling action amplitude in seconds Double (F64) beta bandwidth parameter of the derivative filter $↓$0 Double (F64) hilim_p high limit of the heating action amplitude $↓$0.0 $↑$1.0 Double (F64) hilim_m high limit of the cooling action amplitude $↓$0.0 $↑$1.0 Double (F64) u0_p initial value of the heating action amplitude after setpoint change and start of the block Double (F64) u0_m initial value of the cooling action amplitude after setpoint change and start of the block Double (F64) sp_dif Setpoint difference threshold  $\odot$10.0 Double (F64) tauf Equivalent manipulated variable filter time constant  $\odot$400.0 Double (F64)

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