# Research on a Real-Time Control System for Discrete Factories Based on Digital Twin Technology
## 2 Methods
### Development of System Software
#### 2.3.4 Data Communication Design  
After building a virtual factory, in order to achieve the real-time driving and system data integration of the virtual factory, communication technology is needed to achieve system data interconnection and interoperability. By analyzing the current status of factory communication and the characteristics of digital twin technology, the OPC UA technology and REST (Representational State Transfer) architecture are used to achieve unified data exchange between physical factories and control systems [23]. The OPC UA technology, which is a unified architecture based on object linking and embedding for process control, can be applied to achieve data transmission between the physical factory and the digital factory, or rather between different devices and operating systems, simultaneously in order to integrate multisource heterogeneous data and enhance the availability of the digital  
Figure 9: A kind of data analyzing system for the dual gear factory. factory. The process of constructing OPC UA communication can largely be divided into two steps. The first step is to treat factory elements as objects, abstract attributes, and behaviors, and to establish an information model. The OPC UA technology uses a unified information model to describe objects, which is represented by an address space, and the nodes are the basic units of the address space. The OPC UA identifies the connection semantics between nodes through different types of references, forming network association relationships within the address space. The second step is to convert the information model description file into programming code, and then use the OPC UA server to adapt the transmission protocol to complete data access for different types of devices. External applications can access the data interface provided by the OPC UA server, and data reading and writing can be achieved by manipulating variable node attribute values through node addresses. Drawing on object-oriented thinking, the physical factory is divided into categories and is encapsulated into nodes, with each node referencing each other. For example, mapping properties, such as data and activities, to objects, variables, and methods, by referencing types through different components and properties, and by using XML files to describe the information model of static resources, the information communication can be achieved based on the OPC UA technology. REST is the abbreviation for representational state transfer. The REST architecture is a new style of internet software architecture, which enables software or applications to transmit information in different environments. It has excellent compatibility and is suitable for applications in multi-system complex service invocation environments. The methods of interface definition and data representation are unified based on REST architecture specifications to implement system management. The REST architecture drives interfaces using the HTTP protocol, providing a unified semantic operating standard for all resource interfaces. The HTTP protocol is not only a data transfer protocol, but also a state transition protocol. The REST architecture uses HTTP verbs to distinguish resource operation types, and uses GET, POST, PUT, and Delete to represent resource acquisition, addition, modification, and deletion operations, respectively. This allows a data interface to have four operation types, thus greatly reducing the number of interfaces and making interface calls more concise. The REST architecture uses a JSON data format to unify data representation and avoid data parsing errors [23]. When compared with other forms of data representation, it displays the characteristics of simple data formats, easy parsing, and cross programming languages, especially the cross programming language characteristics, which are very suitable for use in complex system environments.