Cite this asMusungate BN, Ercan T (2023) A simple Node-RED implementation for digital twins in the area of manufacturing. Trends Comput Sci Inf Technol 8(2): 050-054. DOI: 10.17352/tcsit.000068
Copyright License© 2023 Musungate BN, et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Interest in digital twins continues to strengthen with technological advancements in Industrial IoT. A digital twin is a virtual representation that models a physical object and effectively provides a two-way interaction with the real system. Digital twin models can be set up to test or analyze industrial applications before deployment thereby improving the efficiency of industries. In this work, a Node-RED implementation for digital twins in the manufacturing sector is developed. Plastic injection molding is the chosen case study for the implementation of this digital twin. Node-RED is a platform that allows developers to quickly build Internet of Things applications using a simple web browser interface. The digital twin uses the Random Forest Classifier algorithm to do predictive maintenance tasks including classification of quality of products. An easy-to-use dashboard is developed to enable the user to interact with the digital twin. Important modules such as communication with the real environment, SMS, and email notifications are successfully implemented in the digital twin. The findings show that it is feasible to build a Node-RED digital twin. The flexibility of Node-RED makes it suitable for building architecture of varying complexity.
In the past decade, there has been an increase in interest in the digital twin concept. The recent COVID-19 pandemic has encouraged industries to focus on more innovative ways such as digital twins to minimize the negative impact of operational disruptions. According to a 2022 report by Capgemini Research Institute, digital twin implementations are set to increase by 36% over the next few years .
A digital twin is a virtual representation that models a physical object. There is a bidirectional connection between the virtual representation and its physical counterpart. It is widely accepted that the concept of digital twins was publicly introduced by Michael Grieves in 2002 . Digital twins can be used in many industries, including manufacturing, aerospace, battery technology, and robotics . There are many benefits associated with digital twins. These include fast prototyping, safer testing, lower cost of testing, and more optimized solutions . This is because the virtual environment of the digital twin makes it easier and faster to carry out operations that can improve the product. Digital twin is a promising technology and is expected to continue improving as the Industrial Internet of Things develops.
Figure 1 shows an example of a Node-RED interface displayed on a Chrome browser. The interface can be divided into three sections: left, center, and right. The left section of the interface is the palette from which installed nodes can be dragged and dropped onto the central part. The central part is the work area in Node-RED. This is where the nodes are connected. The right side shows information about the configuration and execution of the application. Logs and deployment information can be shown in this part.
Plastic Injection Molding (PIM) is the chosen case study for the implementation of a Node-RED digital twin in a manufacturing scenario. Because it enables the production of complex plastic objects with high precision and productivity, PIM is a manufacturing process that is widely used in industry. Around 110,000 new injection molding machines are put into operation worldwide every year . PIM is a sequential process where the plastic is melted, pressed into the mold, cooled to solidify, and removed from the mold as a three-dimensional shape . Figure 2 shows a pictorial view of a plastic injection molding machine with its important parts labeled  and Figure 3 shows its cross-section . There are sensors that collect data in the different parts of the plastic molding injection machine. Such readings, called process parameters, include mold temperature, melt temperature, specific back pressure, and cycle time. Analyzing these values can give helpful information about a system.
The purpose of this work is to develop a simple Node-RED implementation of a digital twin that can be used on an industrial manufacturing site with plastic injection molding as the chosen case study. The digital twin is used to make various predictive maintenance analyses such as quality prediction and anomaly detection based on the received machine process data. The effect of quality due to changes in parameters is monitored. Also, a notification system is set up to notify the factory manager in the event of the products reaching undesirable standards.
The Node-RED digital twin connects to the physical twin using the MQTT protocol. Figure 4 shows the general structure of the system. An MQTTX Windows application has been used to mimic the real object. This application sends and receives data from the Node-RED digital twin. Features of the MQTTX application include subscription, publishing, and logging of messages . The communication between the two environments was done using MQTT. MQTT is a lightweight publish/subscribe messaging transport communication protocol that is widely used in IoT systems. In the publish/subscription model of MQTT nodes subscribe to a particular topic. These nodes get the data once a node publishes data on the topic subscripted. An MQTT broker manages the communication flow in this system ensuring that nodes can connect, publish, and subscribe without any issues. In this work, the MQTT broker was set up in the Node-RED application. The node-red-contrib-aedes module from the online Node-RED library was used as the broker. Figure 5 shows the implementation of the MQTT modules in Node-RED.
This is an easy-to-build dashboard layout provided by the node-red-dashboard module (available from the online Node-RED library) that provides the users with a simple way to interact with the Node-RED digital twin. Figure 6 shows the Node-RED dashboard home tab. This tab provides an overview of the system, and the user can quickly see the status of the digital twin. A pictorial representation of the plastic injection molding machine is shown in the display section of the home tab. This representation was built using a special library called “node-red-contrib-ui-svg” available from the online Node-RED library. An animation of a product is run in the representation whenever a prediction result is made by the digital twin to mimic the production process.
The digital twin needs to have at least one machine learning algorithm implemented to carry out predictive maintenance tasks. For this implementation, the Random Forest (RF) classifier was chosen for the digital twin because it performed better than the “Decision Tree” and “Support Vector Machine” in our previous work . The RF algorithm is trained with the dataset, provided by this research paper , which contains plastic injection molding data for the quality prediction of the products. Hence, the main predictive maintenance task examined in this work is the quality prediction of products based on the machine process parameters.
The dataset used for quality prediction had 1457 samples and contained actual readings from a plastic injection molding company taken from a plastic injection molding machine  The dataset classified products into four different classes based on quality. Quality is the target class label that can take values 1, 2, 3, and 4. Table 1 shows part of the dataset used in the experiment. The meaning of each possible target class value is explained below:
Using the dashboard, parameter inputs can be changed, and prediction results of the digital twin can be seen immediately. The parameter values entered are fed to the ML model that predicts the quality of the product. This approach can be used to optimize the parameters so that they produce products of high quality.
Notifications can be sent to a system user when certain conditions happen. For example, if the mold temperature exceeds a certain value, or if the product quality is very low a notification can be sent. In this work, there are two types of notifications sent: SMS and email. SMS notifications are sent using the “node-red-node-twilio” package found in the Node-RED online library. The email notifications are sent using the “node-red-node-email” package, also available on the Node-RED online library.
80% of the dataset was used to train the digital twin and the rest of the data was used for testing. The RF algorithm used in the digital twin had an accuracy of 92.76%. Accuracy shows the percentage of correct predictions made by the algorithm. The obtained precision, recall, and f-score values for each of the four quality classes are shown in Table 2.
Email and SMS notifications were sent whenever the predicted value reached one. The connection between the Windows MQTT application and the Node-RED digital twin was successful and data was transferred in a bidirectional manner.
The work in this section shows that it is feasible to develop a Node-RED digital twin representation for an industrial use case. Important modules like machine learning, notifications, display, and communications were all successfully implemented in this work. The flexibility of the Node-RED platform makes it suitable for the implementation of various architectures.
Node-RED has been used in a number of works related to digital twins. The authors in  Node-RED model as a digital twin and the Carla simulator to mimic the real smart physical environment. The authors use a Car-as-a-Service (CaaS) use case to demonstrate that the proposed solution can work. This example is consistent with the work discussed in this paper. Some works have used Node-RED with other software in the digital twin to improve database connections and visualizations [17,18].
On the other hand, there are some works where Node-RED acts as a bridge between the digital twin and the physical object. For example, some authors in  develop a digital twin system that uses AutoCAD for simulation and Node-RED as a transport medium. In this scenario data is sent from the actual sensors of the machines to Node-RED, then Node-RED sends the data to AutoCAD. This process is done vice-versa to send data from the digital twin to the actual devices.
In this work, a simple Node-RED digital twin was developed. This digital twin contained a Random Forest classification algorithm and was used to perform predictive maintenance tasks mainly classification of the quality of the plastic injection molding products. The digital twin had other important modules such as a dashboard, notifications, and communication working properly. Hence, it was concluded that the development of a digital twin in Node-RED is feasible.
The flexibility of the Node-RED makes it possible to make many development enhancements to the digital twin model in this work. More animation work can be added to make the model more interactive. Research can be made into appropriate performance metrics for Node-RED in this specific model. Instead of using the MQTTX application, a real device can be connected to the Node-RED platform.
Subscribe to our articles alerts and stay tuned.
PTZ: We're glad you're here. Please click "create a new query" if you are a new visitor to our website and need further information from us.
If you are already a member of our network and need to keep track of any developments regarding a question you have already submitted, click "take me to my Query."