## 4 Implementation and Validation DT in AS Ecosystem
This approach is particularly feasible for cylinders with a full stroke, as their motion is more easily observed and compared between the real robot and the DT. In the first three captures from Figure 10, good alignment and synchronisation between the real robot and its digital twin can be observed. However, in the last capture at t = 57 s, it can be noticed that the cylinder in the simulation is lagging behind the real one. This discrepancy indicates that there may be some differences in the parameters or timing between the digital twin and the real system that need to be addressed in order to improve the accuracy of the DT's representation. The first action to be taken is to modify the air flow rate entering the  
Figure 10: Snapshots at various moments during the execution of the working scenario. (**a**) t = 12 s; (**b**) t = 23 s; (**c**) t = 32 s; and (**d**) t = 57 s.  
Figure 3.0 Working scenario implemented for testing. cylinder, as it is known that the cylinder's speed primarily depends on the airflow rate. By adjusting the airflow rate in the DT's parameters, the simulation can more accurately represent the real system's behaviour, leading to better synchronisation and alignment between the real robot and its DT. This adjustment should be made based on the observed discrepancy and the known relationship between the air flow rate and cylinder speed to minimise the motion difference between the real system and its digital twin. AS provides access to the internal parameters of the flow control valves, as shown in Figure 3.1 This feature allows users to easily adjust the airflow rate and the other characteristics of the components within the pneumatic system, ensuring that the digital twin's behaviour more closely matches that of the real robot. By fine-tuning these parameters, the user can adjust the speed cylinder. Considering the proposed KPIs, a more detailed and quantitative analysis follows to ensure the accurate alignment of the DT with real-world robot performance. During the scenario execution, data are extracted into a graphical format to analyse the real robot's behaviour and DT. This visualisation allows for a more comprehensive understanding of their performance, allowing the comparison and identification of any discrepancies between the two systems. In Figure 12, the behaviour of the U/D cylinder is represented for both the actual robot (derived from monitoring the PLC programming software for the values received from the ultrasonic distance sensor) and its DT (taken from the position graph specific to the cylinder in AS) for various reference values imposed in the working scenario. This comparison directly assesses the DT's accuracy in replicating the robot's behaviour. It helps identify potential areas for improvement and calibration to ensure a more faithful representation of the natural system. Figure 3.2 The screenshot from AS—unidirectional flow regulator properties. Figure 3.3 The real and mirrored behaviour of the U/D cylinder. The refinement and analysis of the two graphs can be conducted within a dedicated computational environment tailored for data processing and visualisation. Widely utilised tools for this purpose include MATLAB or Python and spreadsheet applications such as Microsoft Excel or Google Sheets. Importing the data from both graphs into the selected software allows a comprehensive examination, comparison, and visualisation of the robot's behaviour and DT. Communication delay, also known as latency, between the DT and the real system is an important aspect affecting the system's performance. Low latency can be a key issue for achieving real-time performance in a HiL simulation. High latency, on the other hand, may lead to a time lag between the execution of control actions on the DT and their implementation on the existing system, potentially affecting the overall system performance and accuracy. The performance of the host computer where the DT from AS is implemented can significantly influence the communication delay or latency.