# Digital Twins in Solar Farms: An Approach through Time Series and Deep Learning
## 5 Experiments and Results
### Results  
To carry out the evaluation of our model in the detection of anomalies, a time interval of seven days was selected, from 7 February 2020 to 13 February 2020. Manual labeling of the anomalous samples was performed according to the experts. Table 4 shows the results for the proposed model. In the two first rows, we present the results obtained by the proposed model based on the loss and the \(RE\). In the last rows, we present the results in the detection of anomalies using the methods previously described. It can be noticed that, despite having a lower loss and reconstruction error, the corresponding DT performance declines in terms of anomaly detection. This is because the more intensive the data processing is, the more prone to discard features that can help the model to learn better the physical system. In the second stage, it was decided to make the comparison of our model in the data set only with pre-processing, against the following configurations: CNN autoencoder (A_CNN), with two convolutional layers (Conv1D) in the encoder and two layers transposed from the convolutional (Conv1 DTranspose) in the decoder; LSTM autoencoder (A_LSTM), two LSTM layers in the encoder and two LSTM layers in the decoder; Simple LSTM (S_LSTM), a single LSTM layer with L2 = 0.0001, and a Dense layer at the output. Finally, the Vector Auto Regression (VAR) method was used. Results of these samples are shown in Tables 5 and 6. For the evaluation of the first method, all anomalies were selected. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{1}{c}{**Pre-Processing**} & \multicolumn{1}{c}{**Time**} & \multicolumn{1}{c}{**Freq.**} & \multicolumn{1}{c}{**Time/Freq.**} \\ \hline \multirow{2}{*}{Loss} & Training & 0.0061 & 0.0089 & 0.0020 & 0.0021 \\  & Test & 0.0196 & 0.0374 & 0.0047 & 0.0036 \\ \hline \multirow{2}{*}{RE} & Training & 0.0441 & 0.0698 & 0.0362 & 0.0295 \\  & Test & 0.1074 & 0.1707 & 0.0588 & 0.0439 \\ \hline \multirow{2}{*}{F. Mth.} & Precision & 0.38 & 0.19 & 0.04 & 0.08 \\  & Recall & 0.83 & 0.76 & **0.73** & **0.69** \\  & AUC & 0.89 & 0.83 & **0.63** & **0.72** \\ \hline \multirow{2}{*}{S. Mth.} & Precision & 0.53 & 0.39 & - & - \\  & Recall & **0.92** & **0.92** & - & - \\ \cline{1-1}  & AUC & **0.97** & **0.93** & - & - \\ \hline \hline \end{tabular}
\end{table} 
Table 4: DT performance in different parts and domains (cells in bold report best scores). \begin{table}
\begin{tabular}{c c} \hline \hline  & **Techniques** \\ \hline Pre-processing & Data cleaning \\ Reduction of dimensionality \\ Logarithmic Smoothing \\ Seasonal Decomposition \\ \multirow{2}{*}{Frequency} & Low-pass filter \\ Logarithmic Smoothing \\ Seasonal Decomposition \\ Low-pass filter \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Applied processing techniques. As can be seen, the proposed DT model obtains the best recall and AUC values, although it presents a lower precision in the second anomaly detection method compared to models using only LSTM (A_LSTM and S_LSTM). Another point to highlight is that the model presents a consistent and better performance in both methods. Conversely, VAR completely fails in detecting anomalies for the second method. As can be seen in Figure 3, the proposed model presents a more robust response to the anomalies detected by the second proposed method, despite the possible influence of weather conditions. This gives us clues about including the climatic variables in the model for improving its detection performance. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & & **DT** & **A\_CNN** & **A\_LSTM** & **S\_LSTM** & **VAR** \\ \hline \multirow{3}{*}{F. Mth.} & Precision & 0.38 & 0.09 & 0.04 & 0.03 & 0.09 \\  & Recall & 0.83 & 0.76 & 0.80 & 0.61 & 0.73 \\  & AUC & 0.89 & 0.75 & 0.64 & 0.49 & 0.75 \\ \hline \multirow{3}{*}{S. Mth.} & Precision & 0.53 & 0.51 & **0.87** & **0.88** & INF \\  & Recall & **0.92** & 0.76 & 0.80 & 0.61 & 0 \\ \cline{1-1}  & AUC & **0.97** & 0.86 & 0.89 & 0.80 & 0.5 \\ \hline \hline \end{tabular}
\end{table}