**6. Results and discussion**

In this section, a time-varying nonlinear discrete systems is used which is described by the input–output model in the following Equation [21].

$$y(k+1) = \frac{y(k)y(k-1)y(k-2)u(k-1)(y(k-2)-1) + u(k)}{a\_0(k) + a\_1(k)y^2(k-1) + a\_2(k)y^2(k-2)}\tag{46}$$

where *y k*ð Þ and *u k*ð Þ are respectively the output and the input of the timevarying nonlinear system at instant *k*; *a*0ð Þ*k* , *a*1ð Þ*k* and *a*2ð Þ*k* are given by

$$\begin{cases} a\_0(k) = \mathbf{1} \\ a\_1(k) = \mathbf{1} + \mathbf{0}.2\cos\left(k\right) \\ a\_2(k) = \mathbf{1} + \mathbf{0}.2\sin\left(k\right) \end{cases} \tag{47}$$

In this case, both neural network model and neural network controller consist of single input, 1 hidden layer with 8 nodes, and a single output node, identically. The

*Tuning Artificial Neural Network Controller Using Particle Swarm Optimization Technique…*

.

used scaling coefficient is *<sup>λ</sup>* <sup>¼</sup> *<sup>λ</sup><sup>c</sup>* <sup>¼</sup> 1 and *<sup>ε</sup>*<sup>1</sup> <sup>¼</sup> *<sup>ε</sup>*<sup>2</sup> <sup>¼</sup> <sup>10</sup>�<sup>2</sup>

*DOI: http://dx.doi.org/10.5772/intechopen.96424*

*The NN control system output and the desired values.*

**Figure 3.**

**Figure 4.** *The control law.*

**Figure 5.** *The control error.*

**17**

The trajectory of *a*1ð Þ*k* and *a*2ð Þ*k* are given in the following **Figure 2**.

In this section, in order to examine the effectiveness of the proposed algorithm of neural network controller and the PSO neural network controller different performance criteria are used. Indeed, the mean squared tracking error (*MSEec*) and the mean absolute tracking error (*MAEec*) are, respectively, given by respectively, given by

$$\text{MSE}\_{\epsilon\_{\epsilon}} = \frac{1}{N} \sum\_{k=1}^{N} \left( y(k) - r(k) \right)^2 \tag{48}$$

and

$$MAE\_{e\_\varepsilon} = \frac{1}{N} \sum\_{k=1}^{N} (y(k) - r(k)) \tag{49}$$

where *y k*ð Þ is the time-varying system output, *r k*ð Þ is the desired value and the used number of observations *N* is 100.

In this simulation, the desired value, *r k*ð Þ, is given in the following

$$r(k) = \sin\left(2\pi k/25\right);\tag{50}$$

#### **6.1 Simulation system using classical NN controller**

In this section, we examine the effectiveness of the used classical neural network controller in the adaptive indirect control system. Indeed, in offline phase, using a reduced number of observations ð Þ *M* ¼ 3 to find, either, the parameter initialization of the neural network parameters (*w*1*<sup>j</sup>*, *wji*, *v*1*<sup>j</sup>*, *vji*).

In online phase, at instant ð Þ *k* þ 1 , we use the input vector of the neural network controller *<sup>x</sup>*<sup>1</sup> <sup>¼</sup> ½ � *xr*ð Þ*<sup>k</sup>* , *xr*ð Þ *<sup>k</sup>* � <sup>1</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>2</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>3</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>4</sup> *<sup>T</sup>*. The results of simulation are given by **Figures 3**–**5**.

**Figure 2.** *a*1ð Þ*k and a*2ð Þ*k trajectories.*

*Tuning Artificial Neural Network Controller Using Particle Swarm Optimization Technique… DOI: http://dx.doi.org/10.5772/intechopen.96424*

In this case, both neural network model and neural network controller consist of single input, 1 hidden layer with 8 nodes, and a single output node, identically. The used scaling coefficient is *<sup>λ</sup>* <sup>¼</sup> *<sup>λ</sup><sup>c</sup>* <sup>¼</sup> 1 and *<sup>ε</sup>*<sup>1</sup> <sup>¼</sup> *<sup>ε</sup>*<sup>2</sup> <sup>¼</sup> <sup>10</sup>�<sup>2</sup> .

**Figure 3.**

where *y k*ð Þ and *u k*ð Þ are respectively the output and the input of the time-

*a*1ð Þ¼ *k* 1 þ 0*:*2 *cos k*ð Þ *a*2ð Þ¼ *k* 1 þ 0*:*2 *sin k*ð Þ

In this section, in order to examine the effectiveness of the proposed algorithm of neural network controller and the PSO neural network controller different performance criteria are used. Indeed, the mean squared tracking error (*MSEec*) and the mean absolute tracking error (*MAEec*) are, respectively, given by respectively,

(47)

varying nonlinear system at instant *k*; *a*0ð Þ*k* , *a*1ð Þ*k* and *a*2ð Þ*k* are given by

*a*0ð Þ¼ *k* 1

The trajectory of *a*1ð Þ*k* and *a*2ð Þ*k* are given in the following **Figure 2**.

*N* X *N*

> *N* X *N*

In this simulation, the desired value, *r k*ð Þ, is given in the following

*k*¼1

where *y k*ð Þ is the time-varying system output, *r k*ð Þ is the desired value and the

In this section, we examine the effectiveness of the used classical neural network controller in the adaptive indirect control system. Indeed, in offline phase, using a reduced number of observations ð Þ *M* ¼ 3 to find, either, the parameter initialization

In online phase, at instant ð Þ *k* þ 1 , we use the input vector of the neural network

controller *<sup>x</sup>*<sup>1</sup> <sup>¼</sup> ½ � *xr*ð Þ*<sup>k</sup>* , *xr*ð Þ *<sup>k</sup>* � <sup>1</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>2</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>3</sup> , *xr*ð Þ *<sup>k</sup>* � <sup>4</sup> *<sup>T</sup>*. The results of

*k*¼1

ð Þ *y k*ð Þ� *r k*ð Þ <sup>2</sup> (48)

ð Þ *y k*ð Þ� *r k*ð Þ (49)

*r k*ð Þ¼ *sin* ð Þ 2*πk=*25 ; (50)

8 ><

>:

*MSEec* <sup>¼</sup> <sup>1</sup>

*MAEec* <sup>¼</sup> <sup>1</sup>

used number of observations *N* is 100.

**6.1 Simulation system using classical NN controller**

of the neural network parameters (*w*1*<sup>j</sup>*, *wji*, *v*1*<sup>j</sup>*, *vji*).

simulation are given by **Figures 3**–**5**.

given by

*Deep Learning Applications*

and

**Figure 2.**

**16**

*a*1ð Þ*k and a*2ð Þ*k trajectories.*

*The NN control system output and the desired values.*

**Figure 4.** *The control law.*

**Figure 5.** *The control error.*

Using a multilayered perceptron architecture, three layers: one input layer, one hidden layer and one output layer. The result of simulation are given by the following figures.

## **6.2 Simulation system using PSO NN controller**

The PSO parameters values are respectively the number of variables (m = 50), the population size (pop = 10), the maximum of inertia weight 0.9, the minimum of the inertia weight 0.4, the first acceleration factor (c1 = 2) and the second acceleration factor (c2 = 2).

Using a multilayered perceptron architecture, three layers: one input layer, one hidden layer and one output layer. The result of simulation are given by the following figures.

**Figure 6** presents the control system output and the desired values. In this case, the neural network parameters of controller are optimized by PSO technique. A concordance between the desired values and the control system output is noticed, although the time-varying parameters.

However, **Figures 7** and **8** present respectively the control law and the control error. These figures reveal that the PSO NN controller has smaller errors than the other controller.

**Table 1** presents the influence of the PSO technique in the control error. From **Table 1** we observe that, using the neural network controller, the PSO neural network controller has the smallest performance criteria in the control error

*η* variable variable *MSEec* 0*:*0349 3*:*7730*e* � 04 *max e*ð Þ*<sup>c</sup>* 0*:*3291 0*:*1372 *min e*ð Þ*<sup>c</sup>* �0*:*4907 �9*:*9998*e* � 04 *MAEec* 0*:*1305 0*:*0043 time (s) 323*:*829 100*:*926

*Tuning Artificial Neural Network Controller Using Particle Swarm Optimization Technique…*

**NN controller PSO NN controller**

An added noise *v k*ð Þ is injected to the output of the time-varying nonlinear system in order to test the effectiveness of the proposed optimization technique of the neural network controller. To measure the correspondence between the system output and the desired value, a Signal Noise Ratio ð Þ *SNR* is taken from the following

> P *N k*¼0

P *N k*¼0

Using the desired value *r k*ð Þ, the sensitivity of the proposed neural network

with *v k*ð Þ is a noise of the measurement of symmetric terminal *δ*, *v k*ð Þ∈½ � �*δ*, *δ* , *y* and *v* are an output average value and a noise average value respectively. In this

ð Þ *y k*ð Þ� *y*

(51)

ð Þ *v k*ð Þ� *v*

*SNR* ¼

*ec*ð Þ*k* . These results are shown in **Figures 6**–**8**.

*The influence of the PSO technique in the control error.*

*DOI: http://dx.doi.org/10.5772/intechopen.96424*

**6.3 Effect of disturbances**

paper, the taken SNR is 5%.

controller is examined in **Table 2**.

equation:

**19**

**Figure 8.** *The control error.*

**Table 1.**

**Figure 6.** *The PSO NN control system output and the desired values.*

**Figure 7.** *The control law.*

*Tuning Artificial Neural Network Controller Using Particle Swarm Optimization Technique… DOI: http://dx.doi.org/10.5772/intechopen.96424*

**Figure 8.** *The control error.*

Using a multilayered perceptron architecture, three layers: one input layer, one hidden layer and one output layer. The result of simulation are given by the

The PSO parameters values are respectively the number of variables (m = 50), the population size (pop = 10), the maximum of inertia weight 0.9, the minimum of the inertia weight 0.4, the first acceleration factor (c1 = 2) and the second acceler-

Using a multilayered perceptron architecture, three layers: one input layer, one hidden layer and one output layer. The result of simulation are given by the follow-

**Figure 6** presents the control system output and the desired values. In this case, the neural network parameters of controller are optimized by PSO technique. A concordance between the desired values and the control system output is noticed,

However, **Figures 7** and **8** present respectively the control law and the control error. These figures reveal that the PSO NN controller has smaller errors than the

following figures.

*Deep Learning Applications*

ation factor (c2 = 2).

ing figures.

other controller.

**Figure 6.**

**Figure 7.** *The control law.*

**18**

**6.2 Simulation system using PSO NN controller**

although the time-varying parameters.

*The PSO NN control system output and the desired values.*


#### **Table 1.**

*The influence of the PSO technique in the control error.*

**Table 1** presents the influence of the PSO technique in the control error.

From **Table 1** we observe that, using the neural network controller, the PSO neural network controller has the smallest performance criteria in the control error *ec*ð Þ*k* . These results are shown in **Figures 6**–**8**.

#### **6.3 Effect of disturbances**

An added noise *v k*ð Þ is injected to the output of the time-varying nonlinear system in order to test the effectiveness of the proposed optimization technique of the neural network controller. To measure the correspondence between the system output and the desired value, a Signal Noise Ratio ð Þ *SNR* is taken from the following equation:

$$\text{SNR} = \frac{\sum\_{k=0}^{N} (\mathbf{y}(k) - \overline{\mathbf{y}})}{\sum\_{k=0}^{N} (\mathbf{v}(k) - \overline{\mathbf{v}})} \tag{51}$$

with *v k*ð Þ is a noise of the measurement of symmetric terminal *δ*, *v k*ð Þ∈½ � �*δ*, *δ* , *y* and *v* are an output average value and a noise average value respectively. In this paper, the taken SNR is 5%.

Using the desired value *r k*ð Þ, the sensitivity of the proposed neural network controller is examined in **Table 2**.


**References**

[1] Slama S., Errachdi A. and

**97**, no. 2, pp. 361–371, 2019.

[2] Errachdi A. and Benrejeb M., Performance comparison of neural network training approaches in indirect adaptive control, International Journal of Control, Automation and Systems, **16**, no. 3, pp. 1448–1458, 2018.

Sadhana **39**, Part 3, June 2014, pp. 533–548. Indian Academy of

[5] Elbeltagi E., Hegazy T. and Grierson D., Comparison among five evolutionary-based optimization algorithms. Advanced Eng. Informatics

[6] Feng H.M., Self-generation RBFNs using evolutional PSO learning.

Neurocomputing **70**, pp. 241–251, 2006.

[7] Karpat Y. and Ozel T., Hard turning optimization using neural network modelling and swarm intelligence. Transactions of NAMRI/SME **33**,

[8] Zhang, R., Tao, J., Lu, R. and Jin, Q. Decoupled ARX and RBF neural network modeling using PCA and GA optimization for nonlinear distributed parameter systems. IEEE Transactions on Neural Networks and Learning Systems, **29**, no. 2, pp. 457–469, 2018.

**19**, pp. 43–-53, 2005.

pp. 179–-186, 2005.

**21**

Sciences

[3] Saurabh G., Karali P. and Surjya K.P., Particle swarm optimization of a neural network model in a machining process,

[4] Zhou J., Duan Z., Li Y., Deng J. and Yu D., PSO-based neural network optimization and its utilization in a boring machine. J. Material Process Technol. **178**, pp. 19–-23, 2006.

Benrejeb M., Adaptive PID controller based on neural networks for MIMO nonlinear systems, Journal of Theoretical and Applied Information Technology,

*DOI: http://dx.doi.org/10.5772/intechopen.96424*

[9] Stacey A., Jancic M. and Grundy I., Particle swarm optimization with mutation. Proceedings of IEEE,

[10] Zhao F., Ren Z., Yu D. and Yang Y., Application of an improved particle swarm optimization algorithm for neural network training. Proceedings of IEEE International Conference on Neural Networks and Brain, Beijing, China, pp. 1693-–1698, 2005.

[11] Asokan P., Baskar N., Babu K., Prabhaharan G. and Saravanan R., Optimization of surface grinding operations using particle swarm optimization technique. J.

Manufacturing Sci. Eng. **127**, pp. 885–

[13] Gaitonde V.N. and Karnik S.R., Minimizing burr size in drilling using artificial neural network (ANN)-particle swarm optimization (PSO) approach. J. Intelligent Manufacturing **23**, pp. 1783–

[14] Navalertporn T. and Afzulpurkar N.V., Optimization of tile manufacturing process using particle swarm

optimization. Swarm and Evolutionary Computation **1**, pp. 97–109, 2011.

[15] Samanta B. and Nataraj C., Use of particle swarm optimization for machinery fault detection. Eng. Appl. Artificial Intelligence, **22**, pp. 308–316,

[16] Malviya R. and Pratihar D.K., Tuning of neural networks using particle swarm optimization to model

[12] Haq A.N., Sivakumar K., Saravanan R. and Karthikeyan K., Particle swarm optimization (PSO) algorithm for optimal machining allocation of clutch assembly. Int. J. Advance Manufacturing Technol. **27**,

pp. 865–869, 2006.

1793, 2012.

2009.

pp. 1425-1430, 2003.

*Tuning Artificial Neural Network Controller Using Particle Swarm Optimization Technique…*

892, 2005.

### **Table 2.**

*The influence of the PSO optimization in the control error.*

From this table, we observe that, using the PSO as a method to optimize the parameters of neural network controller, we have got the smallest performance criteria in the control error.

According to the obtained simulation results, the lowest *MSEec* , *MAEec* and *max e*ð Þ*<sup>c</sup>* are obtained using a combination between the neural network controller and the PSO technique, although the added disturbance in the system output and the time-varying parameters thanks to the PSO technique.
