# Rotational Speed Control Using ANN-Based MPPT for OWC Based on Surface Elevation Measurements
## 3 Materials and Methods
### ANN Training Process  
For the training of the network the Levenberg-Marquardt Algorithm (LMA) has been used as a learning technique [42]. LMA is based on [PERSON]'s technique that was developed to minimize  
Figure 16: Minimum rotational speed for different wave amplitude and period.  
functions that are sums of squares of nonlinear functions [44]. The algorithm is intended to update the ANN weights to minimize the performance index by [45]:  
\[\Delta W=\left[\
abla^{2}F(W)+\mu I\right]^{-1}\
abla F(W) \tag{34}\]  
where \(W\) is weights vector, \(F(\cdot)\) is the performance index, \(\
abla F(\cdot)\) is the gradient, \(\
abla^{2}F(\cdot)\) the Hessian matrix, \(\mu\) is the learning rate and \(I\) is an identity matrix.  
The performance index may be described by:  
\[F(W)=\sum_{j=1}^{N}E_{j}^{2}(W)=E^{T}(W).E(W) \tag{35}\]  
with \(E(\cdot)\) is the error between the network's output and the desired output.  
The performance index's gradient can be given by:  
\[\
abla F(W)=2J^{T}(W).E(W) \tag{36}\]  
where \(J(W)\) is the Jacobian matrix defined as [46]:  
\[J(W)=\left(\begin{array}{cccc}\frac{\partial E_{1}(W)}{\partial W_{1}}& \frac{\partial E_{1}(W)}{\partial W_{2}}&\dots&\frac{\partial E_{1}(W)}{ \partial W_{n}}\\ \frac{\partial E_{2}(W)}{\partial W_{1}}&\frac{\partial E_{2}(W)}{\partial W_{ 2}}&\dots&\frac{\partial E_{2}(W)}{\partial W_{n}}\\ \vdots&\vdots&\ddots&\vdots\\ \frac{\partial E_{3}(W)}{\partial W_{1}}&\frac{\partial E_{N}(W)}{\partial W_{ 2}}&\dots&\frac{\partial E_{N}(W)}{\partial W_{n}}\end{array}\right) \tag{37}\]  
with \(n\) is the number of training patterns.  
Consequently, the Hessian matrix can be described by:  
\[\
abla^{2}F(W)=2J^{T}(W).J(W)+2\sum_{j=1}^{N}E_{j}(W).\
abla^{2}E_{j}(W) \tag{38}\]  
The pseudocode Algorithm 1 is given to detail the steps of the Levenberg-Marquardt Algorithm.  
```
1. Initialize training parameters: \(\mu\), \(\mu_{max}\), \(\beta\), \(E_{min}\), \(Epoch\), \(Epoch_{max}\).
2. Initialize weights vector \(W_{p}\) with small random numbers.
3. Calculate error \(E_{p}\) and performance index \(F\) using Equation (35).
4. Calculate Jacobian matrix \(J\) and Hessian matrix \(H\) using Equations (37) and (38).
5. Calculate weight corrections \(\Delta W\) using Equation (34).
6. Update weights \(W_{p+1}\) using Equation (33).
7. Using new weights calculate and evaluate new error \(E_{p+1}\): (i) if \(E_{p+1}\)\(>\)\(E_{p}\)then\(\bullet\) Reset weights to previous values \(W_{p}=W_{p}\), \(\bullet\) Increase learning rate by a factor \(\beta\): \(\mu=\mu.\beta\), \(\bullet\) Return to step 4. (ii) if \(E_{p+1}\)\(\leq\)\(E_{p}\)then\(\bullet\) Save new weights as current values \(W_{p}\)\(=\)\(W_{p+1}\), \(\bullet\) Decrease learning rate by a factor \(\beta\): \(\mu=\mu/\beta\), \(\bullet\) Return to step 3.
8. Continue training until one of the following termination conditions is reached: \((Epoch\)\(>\)\(Epoch_{max})\) or \((\mu\)\(>\)\(\mu_{max})\) or \((E_{p}\)\(\leq\)\(E_{min})\)
```  
**Algorithm 1**Levenberg-Marquardt Algorithm (LMA)  
The training and validation of all tested ANN structures was performed using MATLAB R2015a while using 3.2 GHz Intel Core i7-8700 Six-Core processor and Integrated Intel UHD Graphics 630.