# A Five-Step Approach to Planning Data-Driven Digital Twins for Discrete Manufacturing Systems
## 2 Materials and Methods
### Step 4  
In this step, the connection between the digital model and the real system is presented. The digital model collects and analyzes data from sensors installed in the real manufacturing system and performs the simulation run, for example, to optimize the sequence of manufacturing orders. The results of the simulation are then transferred back to the real system via the feedback control loop in the form of control sequences. The real system adapts while the digital model again collects and analyzes sensor data and, if necessary, corrects the input parameters of the simulation [49]. With such connectivity, a digital twin is created. Figure 9 shows the idea of the connection between the physical and digital worlds. The physical world shows the evolution of the manufacturing system through time, as its state changes through the process from \"State of manufacturing system at time t\" to \"State of manufacturing system at time t + 1\". Monitoring these states enables the development of \"Digital model of the manufacturing system at time t\". Due to the constant changes in the real system, monitoring must be possible in realtime. That way the model always reflects the actual state of the real system. To make this possible, simulations are performed continuously. The result of the simulation and analysis is \"Digital model of the manufacturing system at time t + 1\". This ensures the adaptation of the process of the existing real manufacturing system \"State of manufacturing system at time t + 1\" to the new form \"State of manufacturing system at time t + 2\". Appropriate interfaces are included to connect the digital and physical worlds. Simple logical dependencies of processes are enumerated with the software tool's built-in functions, and digital agents are used for more complex logical dependencies (mathematical algorithms). Each digital agent performs a specific task and operates with local data. Digital agents upgrade and enrich the digital twin and increase performance by using local data. Digital agents receive data from the digital twin and suggest the best solution based on the received data. Here is the list of digital agents that have been developed to upgrade the digital model to the digital twin (all agents are thoroughly described in the PhD thesis [50]):  
* Digital Agent of Initial state (D.A.I) is a digital agent that sets the correct initial state of the manufacturing system in the digital twin (e.g., warehouse has 20 locations for base parts and 25 locations for finished products; there are 3 base parts and 7 finished products in the warehouse at specific locations). * Digital Agent of Orders (D.A.O.) is a digital agent that determines which orders can be manufactured based on the current state of the system checks. Figure 9: Position of the model and the connections between the physical and digital worlds. * Digital Agent of Manufacturing (D.A.M.) is a digital agent, which determines the sub-optimal manufacturing plan i.e., the sequence of assembly operations for each order and which building blocks will perform assembly operations. * Digital Agents of Jobs (D.A.J.) is a digital agent that generates all jobs for the robots and coordinates the sequence of jobs. * Digital Agent of Disturbance (D.A.D.) is a digital agent responsible for verifying and resolving unplanned disturbances; the agent detects the disturbance, checks for possible solutions, and, if possible, offers a solution to resolve it. * Digital Agent of the Intelligent Algorithm (D.A.A.) is a digital agent with an expert system designed to optimize the schedule using an intelligent algorithm. * Global Digital Agent (G.D.A.) is a global digital agent that coordinates and monitors the operation of all digital agents and ensures the correct flow of communication. A substantial advantage of a connected real and virtual world is the constant exchange of information and the adaptation of a real system based on the digital twin. To achieve such connectivity, various sensors need to be installed in the real manufacturing system.