SMHCCA – Sliding mode heating/cooling controller with autotuner

Block SymbolLicensing group: AUTOTUNING
Qt SVG Document Exported by REXYGEN Studio sp pv hv MAN TMODE TUNE TBRK TAFF ips mv mve de SAT isv t_ukp t_ukm t_sk t_pv t_dpv t_d2pv TBSY TE ite p1 p2 p3 p4 p5 p6 SMHCCA

Function Description
The functional block SMHCCA (Sliding Mode Heating/Cooling Controller with Autotuner) is a high-quality control algorithm with a built-in autotuner for automatic tuning of the controller parameters. The controller is an easily adjustable controller for quality control of thermal systems with two-state (ON-OFF) heating and two-state (ON-OFF) 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.

image/svg+xmlsppvhvMANTMODETUNETBRKTAFFipsmvmvedeSATisvt_ukpt_ukmt_skt_pvt_dpvt_d2pvTBSYTEitep1p2p3p4p5p6 SMHCCA uUPDN PWM [cooler_contactor] [heater_contactor] [setpoint] [process_temperature] [hand_value] [MAN_AUT_switch] [tuning_mode] [start_of_tuning] [tuning_break] [affirmation_of_parameters] [selection_of_parameter_set]

Operating Principles
It’s important to realize that the SMHCCA block operates with several time periods. The first period TS 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 TC = ipwmcTS is the control period with which the SMHCCA block generates the manipulated variable. This period TC 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 TR of the PWM block. Generally, TR may be different from TS. To achieve the best control quality, it is recommended to set the period TS to the minimum possible value (ipwmc to the maximum possible value), the ratio TCTS maximum, but TC should be sufficiently small with respect to the process dynamics. For applications in the plastics industry, the following values are recommended:

TS = 0.1,ipwmc = 50,TC = 5s,TR = 0.1s.

Note, however, that for a faster controlled system, the sampling periods TS, TC, and TR 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 TS = 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 floating-point arithmetic, then the accurate setting of the sampling periods TS, TC, TR 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 built-in 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 start-up 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 (TMODE = 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 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 MAN = 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 TAFF = 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 MAN = 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 well-filtered 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 (MAN = 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 TC
    • 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

image/svg+xml Automatic mode Tuning phase Automatic mode new parameters p1 - p6 TUNE BUSY TMODE mv MAN=0 ut_p

image/svg+xml Manual mode Tuning phase Manual mode new parameters p1 - p6 BUSY TUNE mv MAN=1 ut_p hv

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 third-order 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

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

is forced to zero. In this definition, ek, ėk, ëk denote the filtered deviation error (pvsp), its first and second derivatives at time k, respectively. The parameters ξ and Ω are described below. In the second phase, the quasi sliding mode, the variable sk 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 sk = 0. Consequently, the hypothetical continuous sliding variable

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

remains approximately zero at all times. In other words, the control deviation e is described by a second-order differential equation

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

This implies that the evolution of e can be influenced by choosing the parameters ξ and Ω. Note that for stable behavior, it is required that ξ > 0 and Ω > 0. The typical optimal value of ξ lies in the range [0.1,8]. The optimal value of Ω is strongly dependent on the controlled process; slower processes have a lower optimal Ω, and faster ones have a higher. The recommended value of Ω for the start of tuning parameters is π(5TC).

The manipulated variable mv typically ranges from [1,1]. A positive value corresponds to heating, a negative to cooling, e.g., 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 hilim_p = 1 and 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 u0_p hilim_p and u0_m 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 quasi-sliding mode, where the signs of 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 fine-tuning 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:

if(sk < 0.0)thenmv = t_ukpelsemv = t_ukm.

It is also worth mentioning that achieving quasi-sliding 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 fine-tuning, 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 beta = 0.1 suffices. In manual mode (MAN = on), the controller input hv is copied (after possible limitation by saturation limits [hilim_m,hilim_p]) to the output mv.

Manual mode
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. 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.

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

off ..

Automatic mode

on ...

Manual mode

TMODE

Tuning mode

Bool

TUNE

Start the tuning experiment

Bool

TBRK

Stop the tuning experiment

Bool

TAFF

Tuning affirmation

Bool

off ..

Parameters are only computed

on ...

Parameters are set into the control law

ips

Meaning of the output signals

Long (I32)

0 ....

Controller parameters

1 ....

Auxiliary parameters

Parameter

ipwmc

PWM cycle (in sampling periods of the block)  100

Long (I32)

xi

Relative damping of sliding zero dynamics   0.5  8.0 1.0

Double (F64)

om

Natural frequency of sliding zero dynamics   0.0 0.01

Double (F64)

taup

Time constant for adaptation - heating [s]  700.0

Double (F64)

taum

Time constant for adaptation - cooling [s]  400.0

Double (F64)

beta

Bandwidth parameter of the derivative filter  0.01

Double (F64)

hilim_p

Upper limit of the heating action amplitude   0.0  1.0 1.0

Double (F64)

hilim_m

Upper limit of the cooling action amplitude   0.0  1.0 1.0

Double (F64)

u0_p

Initial amplitude - heating action  1.0

Double (F64)

u0_m

Initial amplitude - cooling action  1.0

Double (F64)

sp_dif

Setpoint difference threshold  10.0

Double (F64)

tauf

Equivalent manipulated variable filter time constant  400.0

Double (F64)

itm

Tuning method  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 1.0

Double (F64)

ut_m

Amplitude of cooling for tuning experiment   0.0  1.0 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

off ..

The controller implements a linear control law

on ...

The controller output is saturated

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

off ..

Autotuning successful

on ...

An error occurred during the experiment

ite

Error code

Long (I32)

0 ....

No error

1 ....

Too noisy pv, check the temperature input

2 ....

Incorrect parameter ut_p

3 ....

Setpoint too low

4 ....

Sampling frequency too low or 2nd derivative of pv too noisy

5 ....

Premature termination of the tuning procedure

p1..p6

Results of identification and design phase

Double (F64)

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