## 4 Digital Twin and Control System Design
### Material Flow of the Simulation Model of Digital Twin  
A virtual commissioning study should include the movement of components, assembled subunits, and final products to enhance simulation realism. While this aspect is less critical for PLC system testing, it is essential for the accurate visualization of the assembly process. According to this process implemented in the MPS (Figure 19), the material flow was analyzed, and the PLC operational program was developed to manage the sequential manufacturing operations. The process includes key steps, from the entry of the semi-finished product into the system to data writing and retrieval, component assembly, quality control, and final product expedition. Based on this sequence, the PLC program defines logical operations, control sequences, and decision mechanisms, ensuring precise coordination of manufacturing steps and optimizing the overall production process. To integrate these elements, parts and assembled products must be created as \"Parts\" and imported similarly to other devices in JT format within a COJT folder. These components must be assigned to the \"Part Prototype\" category to function as assembly elements rather than system devices. Importing, editing, and defining movement operations for individual parts is only possible in Time-Based Simulation Mode, ensuring proper synchronization within the simulation environment. \begin{table}
\begin{tabular}{c c c} \hline
**IDENTIFICATION** & **PLC ADDRESS** & **PLC VARIABLE** \\ \hline
1B1 & I0.0 & 5072920\_podavac\_valec\_at\_push\_home \\
1B2 & I0.1 & 5072920\_podavac\_valec\_at\_push\_extract \\ B4 & I0.2 & Light\_sensor\_valec \\ START & I0.4 & START \\
1 MB1 & Q0.0 & 5072920\_podavac\_valec\_to\_push\_home \\
1 MB2 & Q0.1 & 5072920\_podavac\_valec\_to\_push\_extract \\ \hline \end{tabular} For signal monitoring and control, the appropriate signals are assigned to the simulation panel before starting the simulation. This panel allows for real-time signal tracking, control, and the definition of initial conditions (Figure 18), ensuring proper system behaviour during the simulation process.  
\end{table} 
Table 3: Mapping of identification components to PLC addresses and corresponding PLC variables for the pneumatic feeding mechanism. Figure 18: Simulation panel for monitoring and controlling individual signals. In the Simulation Panel, green (1) indicates an active signal, while red (0) represents an inactive signal, showing the current state of inputs or outputs in the simulation. The square represents the inputs and the circle the outputs. In the project, three types of cylinders--silver, black, and red--were imported. All three types follow the same \"Object Flow Operation\", where they are placed into the gravity feeder and fall onto the feeding mechanism base. As a result, three virtual output signals were created to initiate the insertion movement of the cylinders, along with three virtual input signals to confirm the completion of these operations, as shown in Figure 20.  
Figure 19: MPS process flow, illustrating MES process planning, material flow, data handling, assembly, quality control, and final product expedition. The process serves as the basis for the PLC operational program, ensuring automation and synchronization of production tasks. Figure 20: Definition of new parts, their movement operations, and generation of virtual signals for motion. In event-based simulation, parts do not appear in the standard way but must be generated using the \"Generate Appearances\" command. This process creates the visual representation of parts, which are referenced and assigned to specific operations. These parts must be organized within the material flow, where the Material Flow Browser displays operations, parts, and material transitions between operations, as shown in Figure 21. This tool enables visualization and control of how parts move through the simulation in event-driven mode. Creating material flow is crucial for simulating the movement of assembled products.