# Real-Time Sea State Estimation for Wave Energy Converter Control via Machine Learning
## 5 Result Analysis  
### Model Training  
In the first stage, the WaveBot device is simulated in MATLAB/Simulink (Version 24.1) to generate device position (\(z\)), velocity (\(\dot{z}\)), and PTO force (FftO). A wide range of JONSWAP spectra is used to mimic real-life ocean conditions. Wave heights of \(H_{m}\in[1,6]\) m and peak periods of \(T_{p}\in[8,15]\) s are suitable for Pacific Northwest sea conditions. Therefore, a full-scale \(T_{p}\) ranging from 1 to 15 s is used to generate the WaveBot physical data. Since we are using a 1/17 th scaled version of the original WaveBot device, we apply similar scaling to the input wave characteristics, \(H_{m}\) and \(T_{p}\).  
During training, wave excitation force, \(F_{\text{exc}}\) is generated using wave surface elevation profiles for \(T_{p}\in[1,4]\) s, \(H_{m}=0.127\) m, and the hydrodynamic properties of the WaveBot device. A time step of 0.01 s is used to generate device data that are later used to train the LSTM model. The choice of window size and _step size_ in feature extraction plays a critical role in effectively capturing the underlying dynamics of the WEC. In this study, we select a sampling frequency of 100 Hz, meaning that each recorded second contains 100 data points. To ensure that the extracted features encapsulate meaningful temporal variations, a window size of 1000 samples is chosen, equivalent to 10 s of data per window. This 10-second duration is sufficiently long to capture the dominant wave characteristics and WEC response while balancing computational efficiency. Given that ocean waves exhibit characteristic periods ranging from a few seconds to over a dozen seconds, this window size ensures that at least one full wave cycle is included in each window, even for the longest wave periods in the dataset.  
For model training, wave periods (\(T_{p}\)) between 1 and 4 s are used, covering a wide range of dynamically different sea states. In all cases, the wave height (\(H_{\text{m}}\)) and the peak enhancement factor (\(\gamma\)) are fixed at 0.127 m and 1, respectively. We have used Python 3.10 along with TensorFlow 2.11.0 to build, train, and test the LSTM-based neural network model. A list of model architecture is shown in Table 3.  
Figure 5 illustrates the comparison between predicted and actual peak period (\(T_{p}\)) values. The black scatter points represent the LSTM model's predictions, while the red dashed line corresponds to the ideal one-to-one fit. The close alignment of most data points along this line indicates strong predictive performance. The model achieves a coefficient of determination (\(R^{2}\)-score) of 98.4%, demonstrating its ability to capture the underlying wave dynamics with high accuracy. Even on test data with \(T_{p}\) values extending beyond the training range, the model maintains strong predictive capability, highlighting its generalization performance. Minor deviations from the ideal fit can be seen due to inherent noise in wave conditions and model uncertainties. However, the overall trend confirms that the LSTM-based approach effectively learns the nonlinear relationships between  
\begin{table}
\begin{tabular}{l c} \hline
**Parameter** & **Value** \\ \hline Loss Function & MSE \\ Optimizer & Adam \\ Number of Layers & 2 \\ Neurons per Layer & 50, 50 \\ Dropout & 0.2 \\ Batch Size & 32 \\ Epochs & 50 \\ Learning Rate & 0.001 \\ Activation Function & ReLU \\ \hline \end{tabular}
\end{table}
Table 3: LSTM model architecture.  
wave excitation forces and device responses, making it a reliable choice for real-world WEC applications.