# Improving Deep Learning Anomaly Diagnostics with a Physics-Based Simulation Model
## 3 Physics-Based Simulation Modeling and Anomaly Detection
### Modeling of Torque Signal  
The detection process was initiated by replicating the peripheral milling machine's behavior in terms of a torque signal. The spindle torque was precalculated and constructed in the Matlab-Simulink environment. The mathematical foundation for the simulation-model-torque calculations is formed in [17], where the detailed torque (\(M_{c}\)) calculations are explained. The motor-torque formula used in the simulation model construction is according to [18], as presented in Equation (1):  
\[M_{c}=\frac{P_{c}\times 30\times 10^{3}}{\pi\times RPM} \tag{1}\]  
Figure 3: Description of the Simulation-Enhanced Anomaly Diagnostics (SEAD) method. The method operates in three distinct stages, each thoroughly explained in the subsequent chapters. The net power (\(P_{c}\)) calculation is formed from the peripheral milling machine static parameters representing specification-related input parameters, such as feed material properties and physical dimensions of the spindle. The dynamic variables consist of the condition-monitoring-originated variables, including specific cutting force (\(k_{c}\)), table feed (\(v_{f}\)), axial depth of cut (\(a_{p}\)), and radial depth of cut (\(a_{e}\)). The spindle rotational speed (\(RPM\)) is derived from the cutting speed (\(v_{c}\)) received from the PLC system, with the relation explained in [19]. Individually recorded data sets in the condition-monitoring data contain data from five manufacturing-process variables, subsequently named variables x1...x5 in Table 2. Data set-variable annotations for the variables x1...x5 are acquired from the milling machine's PLC system, with a data-collection frequency of 5 Hz. The variables x1...x4 are: table feed, cutting speed, axial depth of cut, and radial depth of cut, respectively. The x5 variable is the measured real-torque (%) value and x6 is the simulated-torque (%) excitation, with the latter constructed based on the inputs x1...x4. Both of the torque values are described as percentual use of the electric motor's nominal torque. The simulation model input variables x1...x4 in data set 1 (DS1) are used in the model testing and refinement. DS1 inputs are visualized in Figure 4, which shows individual signal variation in the manufacturing process, especially in the radial depth of cut-input variable x4. The variables are annotated in the data set description Equation (2) in a vector format with double indexing. The first index annotates the data set-specific data point number and the second index illustrates the individual variable index, which is due to the variable usage in multiple data sets. To demonstrate, the x1,1 specifies the table-feed variable's first data point in the DS1 data set. The DS1 output data consists of x5 excitation as a comparative value as well as the x6 variable excitation from the simulation-model output. \[\text{DS1}_{\text{output}}= \begin{bmatrix}x1_{1,1}&x2_{1,1}&x3_{1,1}&x4_{1,1} &x5_{1,1}&x6_{1,1}\\ \ldots&\ldots&\ldots&\ldots&\ldots&\ldots\\ x1_{11708,1}&x2_{11708,1}&x3_{11708,1}&x4_{11708,1}&x5_{11708,1}&x6_{11708,1} \\ \end{bmatrix}  \tag{2}\] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Variable** & **Description** & **Unit** \\ \hline x1 & Table feed & (mm/min) \\ x2 & Cutting speed & (m/min) \\ x3 & Axial depth of cut & (mm) \\ x4 & Radial depth of cut & (mm) \\ x5 & Real measured torque & (\%) \\ x6 & Simulated torque & (\%) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Data set-variable annotations. Figure 4: Dynamic input signals x1...x4 allocated to the simulation model in the DS1 data set. The \(\text{DS1}_{\text{output}}\) data set is used for verifying the simulated-signal-replication capability by comparing the simulated-torque excitation to the real signal. The temporal-simulation-model results are presented in Figure 5, where the raw signal of the real torque (x5) and simulated torque (x6) trends are presented with the tested moving-average trend of 50 for x5.