# Using Intelligent Edge Devices for Predictive Maintenance on Injection Molds +
## 5 GFTs and Anomaly Detection for PdM
### Definition and Calculation of BEs  
Typically, the signs of malfunctions in industrial assets are manifested by abnormally high or low values of the sensors monitoring the relevant process parameters [42; 43]. Using the edge parameters to discretize the data and define BEs leads to the result that each variable generates five different BEs, increasing the complexity in training the GFT model. However, these abnormal behaviors can be well captured by anomaly detection techniques. In this approach, the BEs represent the anomalous datapoints for each variable detected through anomaly detection. The method used for anomaly detection is the well-known isolation forest (IF) method, which was deployed using the _Sklearn_ Python library. This technique identifies abnormal or unusual data points in a dataset by randomly partitioning the datapoints into a set of binary trees. To identify an anomaly, the algorithm creates a decision tree for each datapoint by randomly splitting the features and thresholds. It then counts the number of splits required to isolate the datapoint from the rest of the dataset. Anomalies are isolated closer to the tree's root [54], as they require fewer splits to be separated. An important parameter for this algorithm is the contamination ratio, which is the proportion of abnormal values in the training dataset. In this work, the contamination ratio was determined following [54], and the model was trained using 80% of the dataset as training data.  
This method was employed because it isolates anomalies instead of profiling the normal behavior of data. There are different configuration settings in the IMM use case (temperatures, pressures, cycle time, etc.) because different parts are produced, and the working parameters may change for a given mold, as it may produce parts from different materials. Thus, there is no unique normal behavior model, i.e., the sensor values that are normal for a given setup may be anomalous in another. For this reason, isolating anomalous points is a better approach for detecting abnormal behaviors in this case than outlier detection techniques or using cutting-edge parameters to discretize data.  
The distribution of the BEs is calculated by considering the time elapsed from the last mechanical failure until the BE occurred for a given mold, as illustrated by Figure 5. The elapsed time only accounts for working time, as the inactive periods (when the IMM is not producing) are previously removed by the preprocessing microservice on the edge device. Note that when there are other malfunctions, such as a mechanical failure of the IMM, data anomalies are expected to occur; however, such cases are generally related to IMM degradation, not mold degradation. When there are malfunctions that are not related to mold degradation, the occurrence of BEs is not accounted for. The CDF of each variable can be obtained with a discretization step \(h\) of five minutes, which is the time window used to aggregate the data. From the CDF of each BE, the probability of BEs can be calculated and updated according to its occurrence, i.e., at a given time after the last repair, the probability of a given BE is the value of the CDF curve for that elapsed time. If the event has already occurred, its probability is updated to the maximum value calculated from the training distribution.  
Note that injection molding may work in different IMMs; thus, each time there is a mold change, the number of working cycles performed by the mold and the cumulative probability of each BE is encoded into a JSON message and sent to the central broker to be stored in the cloud, as depicted by Figure 6. In each replacement, the set containingthe historical data on BEs occurring in each mold is pushed to the edge devices, thereby accounting for the degradation caused by previous working cycles on different machines.