## 3 The Proposed PHM System
### The Logical Architecture  
The definition of logical architecture aims to explain the relationships between functions and the data flows within the framework layers. The proposed logical architecture is shown in Figure 5. The DA function is performed continuously at the edge to read, collect, and temporarily store streaming data as the machine works. Then, when a signal segment of a pre-defined length is stored, the DP function is activated to extract the system-level features and the component-level features. The length of the signal segment depends on the task that will be performed, the maximum accepted latency of the inference, and the data transmission. Therefore, the time instant in which each sub-function of the DP is activated may be different. The activation of the DP function implies the extraction of relevant features from raw signal segments; then, the OCR function is triggered to assign the label \"known\" or \"novel\" to the system-level features. Figure 4: The proposed functional architecture. If the operating condition is known, then the FDA and the PA function are activated. The FDA aims to recognize abrupt faults (for instance, the detachment of a sucker). Thus, a model trained in the cloud assigns to the current observation a label \(l\in(Nominal,\,Fault_{1},\dots Fault_{N})\) among the \((N+1)\) known fault classes. At the same time, the signal batch is eliminated from the storage memory of the edge device; in addition, in the FDA function, anomaly detection is also performed. It requires the same input as the classification models (i.e., component-level features). However, it aims to detect unknown faults, i.e., faults not considered during the training of the models for diagnostics. The PA function aims to recognize degradations occurring during the machine functioning (for instance, the wear of a screw). Thus, a pre-built degradation model (which may depend on the implemented setting) is used to predict the future values of the HIs in order to compute the RUL of the corresponding component, based on pre-defined Failure Thresholds (FT). However, the degradation begins after several hours of machine functioning for many components; moreover, the computation of the future values of the HI and the RUL prediction would be expensive from the computational point of view. For these reasons, anomaly detection is also applied to the HIs to detect the degradation starting time. Thus, the RUL is computed only when an anomaly is detected. If the OCR function identifies a novel operating condition for the current observation, a new cluster is created. In this case, since the setting is novel, neither classification nor degradation models are available. However, anomaly detection can be applied to component-level features to detect anomalous behaviors that may represent a symptom of problems in the corresponding component. All the above-described activities are conducted at the edge. Now, the extracted feature vectors and the associated labels assigned by the streaming application of prediction models are transmitted to the cloud. Here, data related to known conditions (anomalies, fault classes, and RULs) are stored in a permanent database to help producers to make decisions about maintenance interventions and the supply of spare parts. Instead, the data associated with novel conditions are used to re-train diagnostic and prognostic models. Figure 5: The proposed logical architecture. For this reason, the DA, FDA, and PA functions are also included in the cloud. Here, the DA function aims to acquire the data in different moments, depending on the data type. When the condition is known, the detection of a fault or anomaly triggers the transmission of the predicted fault class and the predicted RUL value to the cloud, so that the producer can react as soon as possible. When the condition is unknown, or no anomalies or faults are detected under known conditions, the data transmission occurs at fixed moments, such as at the end of a shift or during the machine's set-up.