## 4 Digital Twin and Control System Design
### Logic Behaviour Model  
The behaviour model simulates the logical and temporal behaviour of real system components in relation to their connected control units. It consists of simulation components that replicate real-world devices, such as valves and actuators, ensuring accurate system representation. Depending on the standardization level within a given company, these components may be available as library elements in the selected virtual commissioning software. The number and type of resources required for the behaviour model are typically documented in planning materials, such as electrical or pneumatic schematics. Software tools with automated modelling capabilities can streamline the process of creating logical behaviour models. To develop a PLC-based control model, an interaction simulation model must be established in the form of operations. These operations define interactions between production resources (Resources) and workpieces (Parts), such as material flow during assembly. In Process Simulate, the ability to define specific operations depends on the assigned component type. In this study, the system allows for \"Object Flow Operation\", where the device can be moved within the simulation, and \"Device Operation\", where motion follows predefined kinematics. Two operations were created: the extension and retraction of the feeding mechanism, as shown in Figure 10.  
These operations are added to the operation tree and interconnected to ensure sequential execution. In this case, the operations can be simulated since the simulation is executed in Time-Based Simulation Mode, allowing for realistic timing and process validation. Logical blocks are specialized resources with input and output connections for signal integration. They can be controlled using logical commands, Boolean operations, and mathematical functions (Figure 11), enabling dynamic interaction within the simulation environment. Figure 11: Generation and visualization of input and output signals for the feeding mechanism in the Signal Viewer window. Figure 10: Definition of device operations in Process Simulate. “Object Flow Operation” enables movement within the simulation, while “Device Operation” follows predefined kinematics. Two operations were created: extension and retraction of the feeding mechanism. Position sensors can be manually created for each actuator using the \"Sensor Command\" function, with two available types: \"Joint Value Sensor\" and \"Joint Distance Sensor\". The \"Joint Value Sensor\" provides binary position detection, while the \"Joint Distance Sensor\" continuously measures the actuator's position throughout its movement. Each sensor can be assigned multiple attributes, including detection type and tolerance, as shown in Figure 12.  
A key aspect of the simulation is the definition and placement of sensors for object detection and position tracking. A general proximity sensor can be selected, which does not correspond to a specific physical sensing principle (inductive, capacitive, optical, ultrasonic, or magnetic) but can interact with assigned objects. Additionally, specialized sensors such as barcode scanners, cameras, or temperature sensors can be defined with specific properties. In this study, a presence sensor was required to detect cylinders in the gravity feeder, which was also modelled. An optoelectronic sensor, functioning as a light barrier, was implemented, with the transmitter and receiver diodes routed into the feeder via optical fibres (Figure 13). The sensor parameters, including beam diameter, width, and length, were adjustable to ensure proper object detection during the simulation. Once all motion control and automation signals were defined and assigned, they were verified in the \"Signal Viewer\" window. This tool allows for adding and adjusting signals that control devices, material flow, and simulation execution. A total of seven signals were generated, with five signals assigned to the PLC (three input and two output signals) and linked to their respective sources.