SMHCC – Sliding mode heating/cooling controller

Block SymbolLicensing group: ADVANCED

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 TS 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 TC = ipwmcTS is the control period with which the block SMHCC generates manipulated variable. This period TC 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 TR 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 TS. To achieve the high quality of control it is recommended to choose TS as minimal as possible (ipwmc as maximal as possible), the ratio TCTS as maximal as possible but TC should be sufficiently small with respect to the process dynamics. An example of reasonable values for an extruder temperature control is as follows:

TS = 0.1,ipwmc = 100,TC = 10s,TR = 0.01s.

The control law of the block SMHCC in automatic mode (MAN = 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

sk=ëk + 2ξΩėk + Ω2e k

is forced to zero. In the above definition of the sliding variable, ek ,ėk,ëk denote the filtered deviation error (pvsp) and its first and second derivatives in the control period k, respectively, and ξ,Ω are the control parameters described below. In the second phase, sk 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 sk = 0 approximately. Thus, the hypothetical continuous dynamic sliding variable

s=ë + 2ξΩė + Ω2e

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

s=ë + 2ξΩė + Ω2e = 0

describing so called zero sliding dynamics. From it follows that the evolution of e can be prescribed by the parameters ξ,Ω. For stable behavior, it must hold ξ > 0,Ω > 0. A typical optimal value of ξ ranges in the interval [4,8] and ξ about 6 is often a satisfactory value. The optimal value of Ω strongly depends on the controlled process. The slower processes the lower optimal Ω. The recommended value of Ω for start of tuning is π(5TC).
The manipulated variable mv usually ranges in the interval [1,1]. The positive (negative) value corresponds to heating (cooling). For example, 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 hilim_p = 1 and 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 u0_p = hilim_p and u0_m = 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 sk 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

if(sk < 0.0)thenmv = uk_pelsemv = 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 (MAN = on) the controller input hv is (after limitation to the range [hilim_m,hilim_p]) copied to the manipulated variable mv.



setpoint variable

Double (F64)


process variable

Double (F64)


manual value

Double (F64)


controller mode


0 ....

automatic mode

1 ....

manual mode



manipulated variable (position controller output)

Double (F64)


equivalent manipulated variable

Double (F64)


deviation error

Double (F64)


saturation flag


0 ....

the controller implements a linear control law

1 ....

the controller output is saturated, mv hilim_p or mv -hilim_m


number of the positive (+) or negative () sliding variable steps

Long (I32)


current amplitude of heating

Double (F64)


current amplitude of cooling

Double (F64)


discrete dynamic sliding variable sk

Double (F64)


filtered control error -de

Double (F64)


filtered first derivative of the control error t_ek

Double (F64)


filtered second derivative of the control error t_ek

Double (F64)



PWM cycle in the sampling periods of SMHCC (TCTS)

Long (I32)


relative damping ξ of sliding zero dynamics xi 0

Double (F64)


natural frequency Ω of sliding zero dynamics (0.0)

Double (F64)


time constant for adaptation of heating action amplitude in seconds

Double (F64)


time constant for adaptation of cooling action amplitude in seconds

Double (F64)


bandwidth parameter of the derivative filter 0

Double (F64)


high limit of the heating action amplitude 0.0 1.0

Double (F64)


high limit of the cooling action amplitude 0.0 1.0

Double (F64)


initial value of the heating action amplitude after setpoint change and start of the block

Double (F64)


initial value of the cooling action amplitude after setpoint change and start of the block

Double (F64)


Setpoint difference threshold  10.0

Double (F64)


Equivalent manipulated variable filter time constant  400.0

Double (F64)

2020 © REX Controls s.r.o.,