## 4 Slope Reference Generator  
As introduced in Section 2, the purpose of the slope reference generator (see Figure 1) is to convert the desired performance index set-point \(J_{ref}\leq J^{max}\) into corresponding gradient references \(\
abla J\big{|}_{ref_{(k)}}= \begin{bmatrix}\frac{\partial J}{\partial u_{1}}\\ \frac{\partial J}{\partial u_{2}}\end{bmatrix} \big{|}_{ref_{k}}\). Consider the quadratic static map, where the dependency on time k is omitted to simplify the notation, and more importantly, the actuator/sensor dynamics is neglected (as we are interested in generating the slope reference signals). \[J= a_{11}\,u_{1}^{2}+b_{1}\,u_{1}+a_{22}\,u_{2}^{2}+b_{2}\,u_{2}+c\] \[= a_{22}\,u_{2}^{2}+b_{2}\,u_{2}+c^{\prime}(u_{1}) \tag{19}\]  
where  
\[c^{\prime}(u_{1})= a_{11}\,u_{1}^{2}+b_{1}\,u_{1}+c \tag{20}\]  
The cost function gradient is given by:  
\[\
abla J= \begin{bmatrix}2a_{11}u_{1}+b_{1}\\ 2a_{22}u_{2}+b_{2}\end{bmatrix}  \tag{21}\]  
A set \(U_{2}(u_{1})\) of control inputs \(u_{2}\) driving the process performance index \(J\) to a desired value \(J_{ref}\) can be computed as the set of solutions of the second order polynomial Equation (19):  
\[U_{2}(u_{1})=\frac{-b_{2}\pm\sqrt{|b_{2}^{2}-4a_{22}\,(c^{\prime}(u_{1})-J_{ ref})|}}{2\,a_{22}} \tag{22}\]  
From an operational and economical point of view, it can be interesting to drive the process output to a desired set-point while minimizing one of the inputs or both. Considering the positiveness of \(u_{2}\), the gradient of \(U_{2}\) with respect to \(u_{1}\) reads:  
\[\frac{\partial U_{2}}{\partial u_{1}}=\frac{-b_{1}-2\,a_{11}\,u_{1}}{\sqrt{|b _{2}^{2}-4\,a_{22}\,(a_{11}\,u_{1}^{2}+b_{1}\,u_{1}-J_{ref}+c)|}} \tag{23}\]  
The value of \(u_{1}\) minimizing \(u_{2}\) such that \(J=J_{ref}\) is computed by setting  
\[\frac{\partial U_{2}}{\partial u_{1}}=0 \tag{24}\]  
which yields:  
\[u_{1}^{s}=-\frac{b_{1}}{2\,a_{11}} \tag{25}\]  
and the corresponding minimal value of \(u_{2}\) is computed by replacing \(u_{1}\) by \(u_{1}^{s}\) in (22). It should be noticed that the positiveness of the inputs \(u_{1}\) and \(u_{2}\), combined with (25) and the concavity of \(J\) (\(a_{11}\) and \(a_{22}\) are strictly negative parameters), imposes that \(b_{1}\) and \(b_{2}\) are positive. Therefore, the derivative (23) is negative when \(u_{1}<u_{1}^{s}\) and positive when \(u_{1}>u_{1}^{s}\), and (22) presents a minimum in \(u_{1}^{s}\). These results are compiled in Algorithm 1, which summarizes the design procedure for slope reference generation either for extremum seeking (ESC) or suboptimal setpoint (SOP) with minimization/maximization of one input (\(u_{2}\)). ```
1:procedure\(\
abla\big{|}_{\textit{ref}_{(k)}}(\widehat{A},\widehat{b},\widehat{c},\) Objective, \(J_{\textit{ref}_{(k)}}\), Model)
2:if Objective == 'ESC' then
3: \[\
abla\big{|}_{\textit{ref}_{(k)}}= \begin{bmatrix}0\\ 0\end{bmatrix} \]
4:else\(\triangleright\) Objective == 'SOP with \(u_{2}\) optimization'
5: Select a desired Performance index set-point: \(J_{\textit{ref}_{(k)}}\). 6: Compute \(u_{1_{k}}^{s}\), the value of \(u_{1}\) minimizing (maximizing) \(u_{2_{k}}\) such that \(J=J_{\textit{ref}_{(k)}}\) given parameter estimates at iteration \(k\): \[u_{1_{k}}^{s}=-\frac{\widehat{b}_{1}}{2\,\widehat{a}_{11}}\]
7: and substitute in (20) and (22) to obtain: \[u_{2_{k}}^{\textit{min}}(J_{\textit{ref}_{(k)}})= \frac{-\widehat{b}_{2}-\sqrt{\left|\widehat{b}_{2}^{2}-4\widehat{ a}_{22}\,(\widetilde{c}^{\prime}(u_{k-1}^{s})-J_{\textit{ref}_{(k)}})\right|}}{2\, \widehat{a}_{22}}, \widehat{a}_{22}\
eq 0\]
8: Deduce the gradient reference: \[\
abla\big{|}_{\textit{ref}_{(k)}}= \begin{bmatrix}2\widehat{a}_{11}u_{1_{k}}^ {s}+\widehat{b}_{1}\\ 2\widehat{a}_{22}u_{2_{k}}^{min}+\widehat{b}_{2}\end{bmatrix} \]
9:endif
10:return\(\
abla\big{|}_{\textit{ref}_{(k)}}\)
```  
**Algorithm 1** Adaptive slope reference generation algorithm for DISO processes ESC and SOP with minimization/maximization of one input  
Algorithm 2 considers a suboptimal setpoint tracking with minimization of both inputs.