### PSMPC – Pulse-step model predictive controller Function Description
The PSMPC block can be used for control of hardly controllable linear time-invariant systems with manipulated value constraints (e.g. time delay or non-minimum phase systems). It is especially well suited for the case when fast transition without overshoot from one level of controlled variable to another is required. In general, the PSMPC block can be used where the PID controllers are commonly used. The PSMPC block is a predictive controller with explicitly defined constraints on the amplitude of manipulated variable.

The prediction is based on the discrete step response $g\left(j\right),\phantom{\rule{1em}{0ex}}j=1,\dots ,N$ is used. The figure above shows how to obtain the discrete step response $g\left(j\right),\phantom{\rule{1em}{0ex}}j=0,1,\dots ,N$ and the discrete impulse response $h\left(j\right),\phantom{\rule{1em}{0ex}}j=0,1,\dots ,N$ with sampling period ${T}_{S}$ from continuous step response. Note that $N$ must be chosen such that $N\cdot {T}_{S}>{t}_{95}$, where ${t}_{95}$ is the time to reach 95 % of the final steady state value.

For stable, linear and t-invariant systems with monotonous step response it is also possible to use the moment model set approach  and describe the system by only 3 characteristic numbers $\kappa$, $\mu$, and ${\sigma }^{2}$, which can be obtained easily from a very short and simple experiment. The controlled system can be approximated by first order plus dead-time system

 ${F}_{FOPDT}\left(s\right)=\frac{K}{\tau s+1}\cdot {e}^{-Ds},\phantom{\rule{1em}{0ex}}\kappa =K,\phantom{\rule{1em}{0ex}}\mu =\tau +D,\phantom{\rule{1em}{0ex}}{\sigma }^{2}={\tau }^{2}$ (7.1)

or second order plus dead-time system

 ${F}_{SOPDT}\left(s\right)=\frac{K}{{\left(\tau s+1\right)}^{2}}\cdot {e}^{-Ds},\phantom{\rule{1em}{0ex}}\kappa =K,\phantom{\rule{1em}{0ex}}\mu =2\tau +D,\phantom{\rule{1em}{0ex}}{\sigma }^{2}=2{\tau }^{2}$ (7.2)

with the same characteristic numbers. The type of approximation is selected by the imtype parameter.

To lower the computational burden of the open-loop optimization, the family of admissible control sequences contains only sequences in the so-called pulse-step shape depicted below: Note that each of these sequences is uniquely defined by only four numbers ${n}_{1},{n}_{2}\in \left\{0,\dots ,{N}_{C}\right\}$, ${p}_{0}$ and , where ${N}_{C}\in \left\{0,1,\dots \right\}$ is the control horizon and ${u}^{-},{u}^{+}$ stand for the given lower and upper limit of the manipulated variable. The on-line optimization (with respect to ${p}_{0}$, ${n}_{1}$, ${n}_{2}$ and ${u}^{\infty }$) minimizes the criterion

 $I=\sum _{i={N}_{1}}^{{N}_{2}}ê{\left(k+i|k\right)}^{2}+\lambda \sum _{i=0}^{{N}_{C}}\Delta û{\left(k+i\left|k\right\right)}^{2}\to min,$ (7.3)

where $ê\left(k+i|k\right)$ is the predicted control error at time $k$ over the coincidence interval $i\in \left\{{N}_{1},{N}_{2}\right\}$, $\Delta û\left(k+i|k\right)$ are the differences of the control signal over the interval $i\in \left\{0,{N}_{C}\right\}$ and $\lambda$ penalizes the changes in the control signal. The algorithm used for solving the optimization task (7.3) combines brute force and the least squares method. The value ${u}^{\infty }$ is determined using the least squares method for all admissible combinations of ${p}_{0}$, ${n}_{1}$ and ${n}_{2}$ and the optimal control sequence is selected afterwards. The selected sequence in the pulse-step shape is optimal in the open-loop sense. To convert from open-loop to closed-loop control strategy, only the first element of the computed control sequence is applied and the whole optimization procedure is repeated in the next sampling instant.

The parameters ${N}_{1}$, ${N}_{2}$, ${H}_{C}$, and $\lambda$ in the criterion (7.3) take the role of design parameters. Only the last parameter $\lambda$ is meant for manual tuning of the controller. In the case the model in the form (7.1) or (7.2) is used, the parameters ${N}_{1}$ and ${N}_{2}$ are determined automatically with respect to the $\mu$ and ${\sigma }^{2}$ characteristic numbers. The controller can be then effectively tuned by adjusting the characteristic numbers $\kappa$, $\mu$ and ${\sigma }^{2}$.

Warning
It is necessary to set the nsr parameter to sufficiently large number to avoid Matlab/Simulink crash when using the PSMPC block for simulation purposes. Especially when using FOPDT or SOPDT model, the nsr parameter must be greater than the length of the internally computed discrete step response.

Inputs

 sp Setpoint variable Double (F64) pv Process variable Double (F64) tv Tracking variable (applied control signal) Double (F64) hv Manual value Double (F64) MAN Manual or automatic mode Bool off .. Automatic mode on ... Manual mode

Outputs

 mv Manipulated variable (controller output) Double (F64) dmv Controller velocity output (difference) 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 pve Predicted process variable based on the controlled process model Double (F64) iE Error code Long (I32) 0 .... No error 1 .... Incorrect FOPDT model 2 .... Incorrect SOPDT model 3 .... Invalid step response sequence

Parameters

 nc Control horizon length (${N}_{C}$)  $\odot$5 Long (I32) np1 Start of coincidence interval (${N}_{1}$)  $\odot$1 Long (I32) np2 End of coincidence interval (${N}_{2}$)  $\odot$10 Long (I32) lambda Control signal penalization coefficient ($\lambda$)  $\odot$0.05 Double (F64) umax Upper limit of the controller output (${u}^{+}$)  $\odot$1.0 Double (F64) umin Lower limit of the controller output (${u}^{-}$)  $\odot$-1.0 Double (F64) imtype Controlled process model type  $\odot$3 Long (I32) 1 .... FOPDT model (7.1) 2 .... SOPDT model (7.2) 3 .... Discrete step response kappa Static gain ($\kappa$)  $\odot$1.0 Double (F64) mu Resident time constant ($\mu$)  $\odot$20.0 Double (F64) sigma Measure of the system response length ($\sqrt{{\sigma }^{2}}$)  $\odot$10.0 Double (F64) nsr Length of the discrete step response ($N$), see the warning above  $↓$10 $↑$10000000 $\odot$11 Long (I32) sr Discrete step response sequence ($\left[g\left(1\right),\dots ,g\left(N\right)\right]$)  $\odot$[0 0.2642 0.5940 0.8009 0.9084 0.9596 0.9826 0.9927 0.9970 0.9988 0.9995] Double (F64)

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