# A Combined Anomaly and Trend Detection System for Industrial Robot Gear Condition Monitoring
## 2 Materials and Methods
### Method for Anomaly and Trend Detection Model Selection
#### 2.2.2 Synthetic Data Generation  
For the model comparison based on synthetic data, a data generator was implemented to create time series as described in Equation (1). Different trend, noise, seasonality and anomaly functions were considered. In detail, linear and quadratic trend functions were implemented. White noise and uniform noise with different variances or ranges were used as noise functions. Sine functions and a hand crafted function as described in Equation (2) were applied for seasonality. Here, \(t\) is the current time step, which would relate to the length of one hour of the time series and \(a\) is the magnifier factor, which is further described in Table 2. An example of this function is depicted in Figure 4 on the upper right side. \[f(x)= \begin{cases}(t\%24)\times a/4&\text{if }(t\%24)\leq 4\\ 1,&\text{if }4<(t\%24)\leq 20\\ \frac{24-(t\%24)}{4}\times a&\text{otherwise}\end{cases}  \tag{2}\]  
For the anomaly function, a uniform distribution was used to define the anomaly positions. Different lengths for collective and different amplitudes for both collective and point anomalies were applied. To derive reasonable parameter ranges, certain realistic assumptions were made. A time series consists of 8736 samples representing 24 measurements per day for one year. The range of the trend functions' slopes should allow a doubling of the HI value in no less than one week and no more than half a year. Noise and seasonality should as a minimum result in a deviation of the time series by the factor 0.3 and as a maximum by the factor 9 from the mean of the signal. These assumptions were based on collected HI data from industrial robots in a car manufacturing plant. Due to confidentiality reasons, this data can not be published. The different functions, their parameters, the range of the parameters used and underlying assumptions for the parameter range choice are specified in Table 2. In the first three months of the time series no anomaly or trend occurs. In the last nine months anomalies may occur. Figure 4 shows a typical synthetic time series. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Anomaly Detection Model** & **Anomaly Detection Model Type** & **Reference** \\ \hline CNN & Reconstruction based & [28] \\ LSTM & Reconstruction based & [27] \\ AR & Reconstruction based & [25] \\ ARMA & Reconstruction based & [26] \\ KDE & Probabilistic & [20] \\ GP & Probabilistic & [21] \\ OCSVM & Domain based & [29] \\ IF & Distance based & [23] \\ DBSCAN & Distance based & [24] \\ LOF & Distance based & [22] \\ STD & Distance based & [-] \\ \hline \hline
**Trend detection model** & **Trend detection model type** & **Reference** \\ \hline MK & Statistical test & [31] \\ CS & Statistical test & [32] \\ LR & Slope based & [-] \\ MA & Slope based & [-] \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Models considered. Based on this parameter range, over 26 million unique time series could be modeled. To reduce the computational effort, two reduced data sets were created. The first data set (synthetic data set 1) was used for an initial screening of the models' performance.