# Edge Computing Based on Federated Learning for Machine Monitoring
## 3 System Design for Edge Computing in IoT
### Fog and Cloud Computing  
The purpose of high-level deep learning is to build a cloud architecture that can train machine learning models on the premise of protecting user privacy. The specific method for training the model is that each fog node uses the same model definition and initialization parameters. Let {F1, F2,..., FN} be the set of fog nodes, where N is the number of fog nodes. {D1, D2,..., DN} is the set of the corresponding data from fog nodes. Fog Fi trains the model with local data Di, calculates the gradient, and then encrypts and uploads it to the cloud server. Cloud server integrates the gradients from each fog and updates the model. Then, the server returns the updated parameters of the new model to each fog. Fogs update their local model individually according to the updated parameters. Then, the above steps are iterated until the model reaches the convergence criteria.  
Figure 8 shows the mapping of the proposed models in IoT to real production process. From the upper left corner, low-level features of machine temperature were extracted by  
Figure 6: Array camera of the end device in IoT.  
Figure 7: The algorithm of feature extraction on TensorFlow Lite with a simple logistic regression structure.  
the model in edge devices. They will be integrated into mid-level features, corresponding to machine status and have confidential considerations. The right part of Figure 8 is the result of fog and cloud computing, which indicates if there is an abnormal event, which will happen in the near future. At the same time, some adjustment suggestions are returned to the operator and manager of the factory.  
By conducting the analysis of abnormal events in this research, it is found that the state characteristics of key components, such as peak injection pressure of the machine, are obtained by comparing the time series data of the relevant parameter settings with the actual value of the production process. There is an opportunity to diagnose abnormal events of the machine equipment and even the aging index. We summarized those to be the static training data. The IoT will continue to collect dynamic data when the system is running. Table 1 shows the relationship between PLC panel features and the corresponding events. The symbol, I/3 (R/1), denotes increasing (reducing) the parameter setting in priority 3 (1), respectively. For example, the intersection of row 1 and column 1 in Table 1 represents the fact that the injection pressure has to increase in priority 2 when underfilling events are detected. These were stored in the local database of the factory. When the local system obtains a notification received from the cloud, the corresponding adjustment suggestion will send to the operator and manager to make a quick decision about the production process. Only features and parameters are communicated in the IoT outside of the factory such that each factory can keep its own confidential information for production.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**FeatureEvent** & **Underfilling** & **Shrinkage** & **Overflow** & **Rupture** & **Sticky** & **Matt** & **Spots** & **Embrittlement** \\ \hline Injection pressure & I/2 & I/2 & R/1 & R/1 & R/1 & I/2 & I/2 & \\ Injection Speed & I/3 & I/3 & R/3 & R/3 & I/3 & I/3 & \\ Injection time & I/3 & I/3 & R/3 & R/3 & I/3 & I/4 & \\ Injection amount & I/1 & I/1 & R/2 & R/2 & R/2 & R/2 & I/4 & \\ Second Injection P & I/4 & I/4 & R/4 & R/4 & R/4 & R/4 & I/4 & \\ Second Injection T & I/4 & I/4 & R/4 & R/4 & R/4 & R/4 & I/5 & \\ Mold temperature & I/2 & R/5 & R/1 & R/4 & R/5 & R/5 & I/1 & \\ Nozzle temperature & & & & & & & R/1 \\ Material temperature & I/5 & R/6 & & & & & R/1 \\ \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: The relationship between PLC panel features and corresponding events.  
Figure 8: The mapping of the proposed IoT to real production process.