Comparison of artificial neural network adaptive control techniques for
  a nonlinear system with delay
This research paper compares two neural-network-based adaptive controllers,
namely the Hybrid Deep Learning Neural Network Controller (HDLNNC) and the
Adaptive Model Predictive Control with Nonlinear Prediction and Linearization
along the Predicted Trajectory (AMPC-NPLPT), for controlling a nonlinear object
with delay. Specifically, the study investigates the effect of delay on the
accuracy of the two controllers. The experimental results demonstrate that the
AMPC-NPLPT approach outperforms HDLNNC regarding control accuracy for the given
nonlinear object control problem.
Bartłomiej Guś, Jakub Możaryn
Comparison of artificial neural network adaptive control techniques for a nonlinear system with delay

###### Abstract

This research paper compares two neural-network-based adaptive controllers, namely the Hybrid Deep Learning Neural Network Controller (HDLNNC) and the Adaptive Model Predictive Control with Nonlinear Prediction and Linearization along the Predicted Trajectory (AMPC-NPLPT), for controlling a nonlinear object with delay. Specifically, the study investigates the effect of delay on the accuracy of the two controllers. The experimental results demonstrate that the AMPC-NPLPT approach outperforms HDLNNC regarding control accuracy for the given nonlinear object control problem.

 Artificial Neural Network, Nonlinear object, Hybrid Deep Learning Neural Network, Adaptive Model Predictive Control, Time-Delay Object

## I Introduction

The PID control algorithm is a commonly utilized controller in industrial applications. This wide utilization can be attributed to the limited number of adjustable parameters, including the proportional, integral, and derivative actions, simplifying the controller's operation. However, for nonlinear systems, accurate control using constant parameter values for the PID control algorithm is only possible at specific operating points.

The limitations as mentioned above of the PID controller have driven the search for alternative control techniques that can ensure satisfactory performance over a larger operating range, especially for nonlinear objects with changing conditions. Various neural-network-based adaptive approaches have been proposed in the literature as promising solutions for controlling nonlinear systems.

The Hybrid Deep Learning Neural Network Controller (HDLNNC) was proposed in [2][3]. This controller utilizes multiple types of artificial neural networks (ANN), including the self-organizing Kohonen map (SOM), Hebbian learning procedure [4], and adaptive learning rate derived from the direct Lyapunov method, to achieve precise control for nonlinear objects, even in the presence of time-varying parameters. An extension of this approach involves considering changes in the dynamics of the controlled object to enable a smooth transition of the control signal.

Another adaptive control strategy gaining popularity in industry is based on the Model Predictive Control (MPC) algorithm, which has been recently extended using nonlinear models, including those in the form of ANN, as reported in [7][8]. Nonetheless, employing a nonlinear model directly results in a nonlinear quadratic optimization problem, necessitating more computational resources than a linear model. In [7], various approaches for efficient Model Predictive Control with nonlinear models have been proposed, among which the ANN-based Model Predictive Control with Nonlinear Prediction and Linearization along the Predicted Trajectory (MPC-NPLPT) technique stands out. In MPC-NPLPT, the predicted output is a linear approximation calculated along some assumed future control sequence, and to enhance prediction accuracy and control quality, linearization is performed repeatedly. In this paper, the Adaptive Model Predictive Control - Nonlinear Prediction and Linearization along the Predicted Trajectory (AMPC-NPLPT) with the ANN model was used to enhance prediction precision.

## II Hybrid Deep Learning Neural Network Controller

Figure 1 illustrates the HDLNNC scheme, which comprises two distinct blocks that respectively correspond to the model (Deep Recurrent Neural Network - DRNN) and the controller (Hybrid Deep Learning Neural Network Controller - HDLNNC).

### _Controller_

The model block in HDLNNC scheme [2] is a deep learning model employing an Artificial Neural Network (ANN) comprising three layers in each of two parts. The first part consists of a self-organizing Kohonen map (SOM) with Hebbian learning, referred to as the Hybrid Deep Learning (HDL) layer. The

Fig. 1: Scheme of HDLNNC.
second part comprises a Multi-Layer Feed-Forward Neural Network (MLFFNN), incorporating an adaptive learning factor for weight updates. The input signals to the ANN are defined as the error signal, the rate of change of the error signal, and the rate of change of the error signal at each sampling instance.

At the onset of each instance, the initial step involves computing the controller error, denoted by \(e_{con}\). Subsequently, the weight update for the first two layers of the HDL component is determined as

\[W_{j}(k+1)=W_{j}(k)-h_{winner,j}(k)(X(k)-W_{j}(k))\in R^{N_{L}} \tag{1}\]

Equation 1 is utilized in the SOM learning process, whereby the weight values are updated via the winner-takes-most (WTM) approach. The update of weight values \(W_{j}(k)\) is determined not only for the winning neuron, i.e., the one that exhibits weight values closest to the input values \(X(k)\in R^{N_{L}}\) of the ANN in a selected metric but also for the current iteration denoted by \(k\). Where \(N_{L}\) denotes the number of neurons in the previous layer. Function \(h_{winner,j}(k)\) is calculated as

\[h_{winner,j}(k)=l(k)e^{-\frac{r_{winner,j}^{2}(k)}{2\xi(k)^{2}}}\in R^{N_{L}} \tag{2}\]

where:

\[l(k)=e^{-\frac{k}{K_{L}}}\in R \tag{3}\]

\[\xi(k)=\xi_{0}\left(-\frac{\xi_{f}}{\xi_{0}}\right)^{\frac{k}{K_{L}}}\in R \tag{4}\]

where \(r_{winner,j}\) denotes the distance between the \(j^{th}\) neuron and the winning neuron, \(K_{L}\) denotes the maximum number of learning samples and \(l_{0}\),\(\xi_{0}\), \(\xi_{f}\) are coefficients selected from range \((0;1>\).

The weights in the last layer, i.e. in the third layer in HDL are updated using the Hebbian learning procedure as follows

\[W_{j}(k+1)=W_{j}(k)+\gamma Y(k)X(k)-\delta Y(k)W(k)\in R^{N_{L}} \tag{5}\]

Where \(Y(k)\in R^{N_{O}}\) means the previous output from the ANN, \(N_{O}\) the number of neurons in the layer, \(\delta\) and \(\gamma\) are coefficients from range (0,1). The part \(\delta Y(k)W(k)\) is responsible for forgetting a learned pattern.

\[\begin{split} CV(k)=f(f(\left[\begin{array}{c}e_{con}(k)\\ \Delta e_{con}(k)\\ \Delta^{2}e_{con}(k)\end{array}\right]W_{HDL}^{I}(k))\\ W_{HDL}^{II}(k))W_{HDL}^{II}(k)\in R\end{split} \tag{6}\]

Upon completion of the weight update procedure in the HDL component, the subsequent step involves computing the control variable, as specified in equation (6). Herein, \(W_{HDL}^{I}(k)\), \(W_{HDL}^{II}(k)\), and \(W_{HDL}^{III}(k)\) represent the weights of each layer at the current instant \(k\), as per equations (1) and (5). The activation function, denoted as \(f()\), is chosen as the tangent hyperbolic function. Assuming that the Mean Squared Error is the minimizing function, the weights in the MLFFNN are modified as

\[\begin{array}{l}W(k+1)=W(k)+\eta(k)e_{con}(k)\\ \frac{\sigma PV_{process}(k)}{\sigma CV(k)}\frac{\sigma CV(k)}{\sigma W(k)}\in R ^{N_{L}\times N_{A}}\end{array} \tag{7}\]

where

\[\eta(k)=\frac{\alpha}{\phi(1+\frac{\phi}{\phi}(\frac{\sigma e_{con}(k)}{ \sigma W(k)})^{2})}\in R^{N_{L}\times N_{A}} \tag{8}\]

Where \(N_{A}\) denotes the number of neurons in the actual layer.

Equation (8) is the result of the selection of the Lyapunov function as (9) in which the value of \(\eta(k)\) is determined by one of the three conditions present: \(V(k+1)-V(k)\leqslant 0\) in the direct Lyapunov method and satisfies the other two \(V(k)>0,V(0)=0\) as

\[V(k)=\frac{\alpha}{2}e_{con}(k)^{2}+\frac{\beta}{2}\Delta e_{con}(k)^{2}+ \frac{\phi}{2}\Delta W(k)^{2}\in R \tag{9}\]

Where in Equation (8), (9) \(e_{con}\) means the error of control in current instant, \(\alpha\), \(\beta\), \(\phi\) are coefficients selected between (0:1\(>\), Jacobian of model can be estimated by

\[\frac{\sigma PV_{process}(k)}{\sigma CV(k)}\approx\frac{\sigma PV_{model}(k)}{ \sigma CV(k)}\in R \tag{10}\]

### _Model_

The adaptive learning rate in the DRNN model [5] was calculated by

\[\eta_{O}(k)=\frac{2}{N_{h}}\in R \tag{11}\]

\[\eta_{D}(k)=\frac{2}{N_{h}(max||W^{0}(k)||)^{2}}\in R \tag{12}\]

\[\eta_{I}(k)=\frac{2}{N_{h}(max||W^{0}(k)||)^{2}(max||I^{0}(k)||)^{2}}\in R \tag{13}\]

Where \(N_{h}\) denotes the number of neurons in only the hidden layer, \(W^{O}(k)\) weights in the output layer, \(I^{O}(k)\) weights in input to the neural network model, \(\eta_{O}(k)\), \(\eta_{D}(k)\), \(\eta_{I}(k)\) adaptive learning rate respectively for output, diagonal, input layer. In this case, the selected Lyapunov function is

\[V(k)=\frac{1}{2}e_{mod}(k)^{2}\in R \tag{14}\]

Table I includes applied parameter values. Initial values for the weights of the controller and model, also the initial values of the diagonal layer in the DRNN model, were drawn from range (-0.1, 0.1).

III Adaptive Model Predictive Control - Nonlinear Prediction and Linearization Along The Predicted Trajectory

The MPC control algorithm offers several significant advantages, including its capacity to handle Multiple-Input Multiple-Output (MIMO) processes. Additionally, the algorithm is robust to process delays, and it delivers high-quality control performance even in the presence of such delays. Another advantage of the MPC algorithm is its ability to accommodate constraints on the input and output variables or state variables. This feature is particularly useful in practical control applications where constraints are commonly encountered and must be satisfied to ensure optimal performance and safety.
The basic idea of MPC algorithm [7] is to use the online dynamics of the model of the process to calculate predicted errors over the given horizon and minimize the cost function --

\[\begin{split} J_{\text{CF}}(k)=\sum_{p=1}^{N}(& y_{sp}(k+p|k)-y_{\sim}(k+p|k))^{2}+\\ &+\lambda\sum_{p=0}^{N_{U}-1}(\Delta u(k+p|k))^{2}\in R\end{split} \tag{15}\]

where \(y_{sp}(k+p|k)\) refers to the setpoint at step \(k+p\), which is known at the current step \(k\), for the process output, \(y_{\sim}(k+p|k)\) denotes the predicted value at step \(k+p\) for the output of the process model, known at the current step \(k\), \(\lambda\) is a user-defined weighting factor that is used to adjust the relative importance of the setpoint tracking and control effort optimization objectives, the prediction horizon is denoted by \(N\), and \(N_{u}\) is the control horizon, the quantity \(\Delta u(k+p|k)\) denotes the change in the control signal over the prediction horizon.

The imposed constraints are represented by

\[J_{\text{CF}}(k)=||Y_{sp}(k)-Y_{\sim}(k)||^{2}+||\Delta U(k)||_{\Lambda}^{2}\in R \tag{16}\]

only if

\[U_{min}\leq U(k)\leq U_{max} \tag{17}\]

\[\Delta U_{min}\leq U(k)\leq\Delta U_{max} \tag{18}\]

\[Y_{min}\leq Y_{\sim}(k)\leq Y_{max} \tag{19}\]

where

\[Y_{sp}(k)=[y_{sp}(k)\ldots y_{sp}(k+N)]^{T}\in R^{N} \tag{20}\]

\[Y_{\sim}(k)=[y_{\sim}(k+1|k)\ldots y_{\sim}(k+N|k)]^{T}\in R^{N} \tag{21}\]

\[U_{min}=[u_{min}\ldots u_{min}]^{T}\in R^{N_{u}} \tag{22}\]

\[U_{max}=[u_{max}\ldots u_{max}]^{T}\in R^{N_{u}} \tag{23}\]

\[\Delta U_{max}=[\Delta u_{max}\ldots\Delta u_{max}]^{T}\in R^{N_{u}} \tag{24}\]

\[Y_{min}=[y_{min}\ldots y_{min}]^{T}\in R^{N} \tag{25}\]

\[Y_{max}=[y_{max}\ldots y_{max}]^{T}\in R^{N} \tag{26}\]

\[\Lambda=diag(\lambda\ldots\lambda)\in R^{N_{u}\times N_{u}} \tag{27}\]

where \(u_{min}(k)\), \(u_{max}(k)\) denotes the minimum/maximum value of the control variable, \(y_{min}(k)\), \(y_{max}(k)\) denotes the minimum/maximum of the value of output variable.

Regarding the MPC-NPLPT and AMPC-NPLPT control algorithms (as shown in Figure 2), an internal iteration technique was employed to enhance both the accuracy of the predicted process output and the control performance. This involved repeated model linearization and calculation of the future control increment. Specifically, the Taylor series expansion approximates the nonlinear output with a linear model.

\[Y_{\sim}^{i}(k)=Y_{\sim}^{i-1}(k)+H^{i}(k)(U^{i}(k)-U^{i-1}(k)) \tag{28}\]

where:

\[Y_{\sim}^{i-1}(k)=[y_{\sim}^{i-1}(k+1|k)\ldots y_{\sim}^{i-1}(k+N|k)]^{T}\in R ^{N} \tag{29}\]

\[\begin{split} H^{i}(k)&=\frac{dV_{\sim}^{i-1}(k)}{ dU_{\sim}^{i-1}(k)}=\\ &=\begin{bmatrix}\frac{dy_{\sim}^{i-1}(k+1|k)}{du^{i-1}(k|k)}& \ldots&\frac{dy_{\sim}^{i-1}(k+1|k)}{du^{i-1}(k+N_{u}-1|k)}\\ \vdots&\ddots&\vdots\\ \frac{dy_{\sim}^{i-1}(k+N|k)}{du^{i-1}(k|k)}&\ldots&\frac{dy_{\sim}^{i-1}(k+N|k)}{du^{i-1}(k+N_{u}-1|k)} \end{bmatrix}\in R^{N\cdot N_{u}}\\ \end{split} \tag{30}\]

\[U^{i}(k)=[u^{i}(k|k)\ldots u^{i}(k+N|k)]^{T}\in R^{N_{u}} \tag{31}\]

\[U^{i-1}(k)=[u^{i-1}(k|k)\ldots u^{i-1}(k+N|k)]^{T}\in R^{N_{u}} \tag{32}\]

where \(i\) means the internal iteration of the MPC-NPLPT algorithm. Vector \(U^{i}(k)\) is calculated for \(i=0\) (i.e. the first iteration) as

\[U^{0}(k)=U^{i-1}(k)=[u(k-1)\ldots u(k-1)]^{T}\in R^{N_{u}} \tag{33}\]

Fig. 2: Scheme of AMPC-NPLPT.
and for \(i\) greater than zero is calculated as

\[U^{i}(k)=J\Delta U^{i}(k)+U(k-1)\in R^{N_{\text{u}}} \tag{34}\]

where \(J\) is all one lower triangular matrix. This study utilised an Artificial Neural Network (ANN) model with an Elman structure to represent the control process. When investigating the impact of process delays on the MPC-NPLPT and AMPC-NPLPT algorithms, a modified Elman structure was employed [8], which delayed the input to account for the processing delay. The Armijo rule [1] was applied to determine the optimal learning rate for the model, both before and during the control process. The parameter values used for the AMPC-NPLPT algorithm are presented in Table I. Where \(\gamma\), \(\delta\) means values below which the internal iteration is interrupted due to either a small change in the control signal or sufficient control accuracy. Specifically, the initial weights and the initial values of the hidden layer output were randomized within the range of (-0.1, 0.1).

## IV Simulation Results

The controllers HDLNNC, AMPC-NPLPT were used to control the following nonlinear process described as follows

\[x_{1}(k)=A_{1}x_{1}(k-1)+A_{2}x_{2}(k-1) \tag{35}\]

\[x_{2}(k)=\frac{x_{1}(k-1)}{A_{3}+x_{1}(k-1)^{2}+x_{2}(k-1)^{2}} \tag{36}\]

\[y(k)=x_{1}(k) \tag{37}\]

The initial values of the constants \(A_{1}\), \(A_{2}\), \(A_{3}\) were taken as: 0.2, 0.8, 1.1 and the values of states as \(x_{1}(0)=0\) and \(x_{2}(0)=0\). A sinusoidal signal with an amplitude of 1 and a frequency \(\frac{\pi}{4}\) was used as a reference signal from 0 to 100 seconds. In contrast, a rectangular signal with amplitudes between: -0.4, 0.4 was used and a cycle time of 4 seconds was used in 100-150 seconds, which was additionally filtered by an object with transfer function as \(\frac{1}{0.025\cdot s+1}\). In addition, in the \(100^{th}\) second the values of the constants: \(A_{1}\), \(A_{2}\), \(A_{3}\) were changed to: -0.2, 1.4, -15.

An assessment of the control accuracy of the two controllers and a comparison between them was undertaken based on following Integral Control Quality Indices (ICQI)

\[I_{IAE}=\int_{0}^{\infty}|e(t)|dt \tag{38}\]

\[I_{ISE}=\int_{0}^{\infty}e(t)^{2}dt \tag{39}\]

\[I_{ITAE}=\int_{0}^{\infty}t|e(t)|dt \tag{40}\]

Before initiating control of the process, the Elman model used in the AMPC-NPLPT controller was trained by a sinusoidal signal with amplitudes of 0.8, 0.6, and 0.5, respectively, and a frequency of \(\frac{\pi}{4}\) for each of these signals. The learning signal was updated after every 8 seconds, corresponding to a full period of each sinusoidal signal. The training was stopped once the target function's mean squared error (MSE) value fell below \(10^{-15}\), achieved in approximately the \(22^{nd}\) second. This procedure was intended to initialize the weights of the Elman model, which would be further adapted during the control process. The simulation was conducted in Simulink with a calculation step of 1 ms for the nonlinear process without delay.

In the AMPC-NPLPT controller, the only hidden layer had 5 neurons. The prediction horizon was set to 15 instants, and the control horizon was set to 3 instants. A weighting factor of 1 was used for \(\lambda\). The number of internal iterations was 10.

Table II presents the quality indicators for the control actions taken by both controllers from 0 to 100 seconds. In almost every case, the AMPC-NPLPT controller produced smaller ICQI values, indicating more accurate control.

Due to changes in the object's dynamics, which were calculated from changes in the DRNN's weights, the HDLNNC controller resulted in a smoother start of control than the AMPC-NPLPT controller. The AMPC-NPLPT controller adjusted its weights significantly in the initial phase based on the output of the nonlinear object (Fig. 3). After about 0.3 seconds, the AMPC-NPLPT controller produced more accurate tracking

Fig. 3: Reference signal and process output for HDLNNC and AMPC-NPLPT in time from 0 to 4 seconds.
of the reference signal than the HDLNNC controller. However, because the model inaccurately represented the object's behavior up to 0.3 seconds, it caused the output to exceed the acceptable limits of the \(y_{max}\) value.

Figure 4 compares the position of the nonlinear object using the AMPC-NPLPT controller and the HDLNNC controller from 88 to 96 seconds. Figure 5 presents a comparison of the absolute error values at the same time. Figure 6 presents a close-up between 89.7 and 90.3 seconds, showing that the AMPC-NPLPT controller provided more precise control.

Despite the change in the coefficients describing the behaviour of the nonlinear object as well as the reference signal, which occurred in the \(100^{th}\) second, an accurate control was obtained using both controllers. In this case, smaller values for all ICQI values were obtained using the controller: AMPC-NPLPT (Table II).

Figure 8 shows a comparison of the absolute error values from 144 to 148 seconds. Figure 7 depicts a portion of the control cycle at the end of the control time, which shows that the AMPC-NPLPT predictive controller begins to decrease the output signal of the nonlinear object at approximately 145.98 seconds.
number of weights for more accurate control.

For the AMPC-NPLPT controller, the number of hidden layer neurons remained at 5, but the prediction horizon was increased to 30 and the control horizon to 5. The \(\lambda\) coefficient was changed to 0.8, the number of internal iterations increased to 20, and the value of the \(\Delta u\) parameter was reduced to \(3.5\cdot 10^{-2}\).

The modification of the AMPC-NPLPT controller's input, which involved delaying it by as many steps as the output of a nonlinear object in an artificial neural network with an Elman structure, enabled the control of the process. However, the HDLNNC controller, despite an increase in the number of neurons in the hidden layers, was unable to follow the sinusoidal reference signal from time 0 to 200 seconds. To compensate for the delay and obtain the smallest possible ICQI, the CV signal was changed between the maximum values of -5 and 5. This course of the CV caused significant changes in the object position values.

Our study compared the AMPC-NPLPT and HDLNNC controllers' performance for a delayed nonlinear object. We found that the AMPC-NPLPT controller adjusts the control signal's course in a way that reduces the Integrated Control Quality Index (ICQI) from cycle five without exceeding the maximum control signal values, which in this case were -1 to 1 (as seen in Fig. 9). Moreover, when we used a modified rectangular signal as the reference signal with the predictive algorithm, the AMPC-NPLPT controller achieved more accurate control than the HDLNNC controller, as evidenced by the smaller ICQI values in Table III. In contrast, the HDLNNC controller aimed to reduce the error by changing the control signal values from -5 to 5, as it did for the sinusoidal signal. However, we observed that the total absolute error between the nonlinear object output and the DRNN model was 55.3831, indicating an average error per instant of \(6.9228\cdot 10^{-3}\).

## V Conclusion

The HDLNNC controller as well as the AMPC-NPLPT controller were successfully used to control the nonlinear object in the absence of delay. Using the AMPC-NPLPT controller, smaller ICQI values were obtained in most cases for the object in the absence of delay as well as with delay, even though it uses a single neural network and in the case of the HDLNNC controller the solution is more complex. Despite the increase in the number of neurons in both hidden layers, the HDLNNC controller was not able to control the selected nonlinear object with delay. Further research will be aimed at testing the performance of these controllers to other nonlinear objects even with delay as well as testing the absence of the previously learned AMPC-NPLPT controller.
