DIGITAL TWIN MODEL IN CONTROL AUTOMATION WITH AUTOMATION STUDIO™ SIMULATION SOFTWARE Luigi Mazza (*), Dario Lizzio (**) (*) Department of Mechanical and Aerospace Engineering, Politecnico di Torino, TORINO, Italy (**) Thesis student of the MSc in Mechatronic Engineering, Politecnico di Torino, TORINO, Italy 1. INTRODUCTION In the industrial sector, the digitalization and simulation of automated systems are becoming increasingly important due to the growing need to develop systems that are more complex and efficient. In this context, the concept of Digital Twin has gained significant relevance in the fields of industrial automation and process digitalization. A Digital Twin is generally defined as a dynamic, virtual representation of a physical system that enables monitoring, analysis, and prediction of system behaviour through simulation tools. This technology is a pillar of Industry 4.0, providing new opportunities for process optimization, predictive maintenance, and the design of complex automated systems. There exist different types of digital twins based on the level of process or system digitalization [1]: Component/Part twin: It represents an individual part, permitting the analysis of properties such as efficiency, durability and performance; Asset Twin: It models a set of interacting components, focusing on functional relationships and performance optimization; System Twin: It encompasses multiple assets working together, allowing for comprehensive evaluation and optimization of system-level behaviour; Process Twin: It enables the observation of how multiple systems operate together to form the entire process. Moreover, according to the classification proposed in [2], a digital twin can model a system on the base of specific purposes; to cite only few: digital twin models for monitoring, for diagnosis, for prediction and for control automation. In the first, the models provide a “virtual replica” of a physical system and by continuously monitoring its state allow inefficiencies to be identified. Digital twin for diagnosis is used to reduce maintenance costs and improve system reliability. Similarly, digital twin model for prediction can accurately predict when a component may fail thus enabling proactive maintenance. Digital twin models for control automation allow for more efficient automation systems; thanks to feedback sensor signals, real time monitoring and supervision are allowed with adjustment of the system parameters to keep constant the performance. Automation StudioTM fits perfectly into the field of digital twin, indeed the software allow you to model, simulate and comprehensively analyze entire systems [3, 4, 5, 6], enabling the evaluation of interactions among individual components and across the various technologies employed in the real machine, such as hydraulic, electrical, pneumatic subsystems, etc. Moreover, once the “virtual replica” of the real system is developed in Automation StudioTM a Failure Mode and Effects Analysis (FMEA) can also be performed. FMEA is a systematic and proactive method for evaluating a product or process to identify where and how it might fail, and to assess the relative impact of different failure modes. The use of Automation StudioTM greatly simplifies the analysis by allowing the integration of multiple failure modes directly into the components and by providing automated performance estimations under fault conditions. In this paper a preliminary digital twin of an automatic system was developed by means of Automation StudioTM simulation software. The model of the system falls into the category “digital twin models for control and automation” by pursuing the aim of creating a “virtual replica” of the automation. In particular a PLC-based control design was performed by wiring the controller and writing the ladder logic code as close as possible to physical automation. 2. METHODOLOGY AND TOOLS A crucial step in the implementation of a digital twin is the development of a “virtual model” that accurately reflects the physical actual machine. For this reason, the model must be developed in an advanced simulation software that enables replication of the machine’s component behaviours, including electrical, mechanical, and pneumatic elements. The precision with which these elements are reproduced allows for a detailed assessment of the machine’s performance across different operational scenarios, identifying potential areas for improvement and testing modifications to operating conditions without intervention on the physical machinery. The tool used for developing the simulated model is Automation StudioTM, a software by Famic Technologies Inc. designed for the creation and simulation of multi domain systems. Automation StudioTM allows for the creation of integrated electrical, pneumatic, hydraulic, and automation schematics within a unified development environment. Its interface supports the modelling of complex processes through the use of standard component libraries, ensuring compliance with current industrial standards. Virtual simulation of the designed models’ operation, providing performance and diagnostic analyses can be carried out. Moreover, Automation StudioTM supports automatic generation of technical documentation and integrates with IEC, NEMA and ISO standards, making it suitable for process control and engineering optimization. Additionally, the software can connect with other devices or software through OPC UA and TCP/IP connections, a feature that is very useful for a full-scale digital twin implementation. 3. VIRTUALIZATION AND SIMULATION OF THE AUTOMATIC SYSTEM The system under study is an automatic flanging plant consisting of electropneumatic actuations with PLC-based control. The plant schematics is shown in Fig.1, consisting of 4 pneumatic actuators, A, B, C, and D to clamp the pipe, stop the pipe and apply flanging to one of the sides of the pipe; the flanging is applied in two steps thanks to the switching cylinder D driving along a linear guide the cylinders C position. The control panel of the automatic station is schematically shown in Fig.1 and consists of a PLC, push buttons, pilot lights and an HMI touch panel. The automatic cycle follows the letter sequence A+/B-/C+/C-/D+/C+/C-/A- B+ D-. Currently the displacement-step sequence is modelled with on-off electrovalves with PLC-based control design. However, proportional pneumatic actuations are envisaged in future developments for better control of the clamping and flange of the pipe. Figure 1 – Plant schematics representation Initially, the cylinder B is extended to act as a stop for the advancing pipe. Then, cylinder A extends and clamps the pipe (step 1) and subsequently, cylinder B retracts (step 2). The cylinder C extends (step 3) for the first time to make the preliminary flanging operation and then retracts (step 4). Cylinder D performs the tool switchover (step 5) and the flanging cylinder C make the second flanging operation (step 6) and then retracts (step 7). After that, cylinders A, D retract and cylinder B starts the forward motion to return to the initial position (step 8). In the implemented ladder code, steps 3,6 and steps 4,7 are considered as two steps performed two times in the cycle instead of four different steps since they are the repetition of the same movements. 3.1 Pneumatic and electric schemes The pneumatic circuit of the system was modeled (Fig. 2) thanks to the large variety of components available in the General Library of Automation StudioTM. To further enhance the system modeling, actual manufacturer components could be employed, as these are available in the extensive online manufacturers catalogues provided by Automation StudioTM. Another possible approach would have been to adjust the parameters and characteristic curves of the generic components based on the data provided in the datasheets of the actual components used in the system. Figure 2 – Pneumatic scheme The electrical scheme (Fig. 3) is composed by a PLC Siemens SIMATIC S7-1200 exploiting the Illustrated Components library which provides a very realistic virtual representation of the physical S7-1200 controller. Start, Stop, Reset and the emergency push buttons are wired to their respectively pin of the PLC digital input card. Emergency push button is connected as normally closed contact for safety reasons. The inputs also include the limit switches of the actuators, which are essential components for the development of the automatic system. At the outputs side there are the solenoids of the directional valves. Figure 3 – Electrical scheme 3.2 Brief insight into the ladder code (Siemens ladder) The control logic was developed in ladder; the same language used in the real machine. This approach allows the code to be tested within the virtualized environment in Automation StudioTM, enabling its subsequent deployment to the real system. Moreover, Automation StudioTM provides support for OPC connectivity, enabling integration with the real system. Through this connection, PLC variables can be mapped to their counterparts in Automation StudioTM, allowing data exchange between the virtual system and the PLC. The ladder code was designed using FC subroutines. Therefore, the system includes a main ladder rung that activates all the created subroutines. The use of subroutine n PLC programming is useful to perform specific functions so that each subroutine can be tested individually for functionality, with great advantages in trouble shooting and debugging the code. A Start/Stop subroutine responsible for starting and stopping the system was developed; the “Start” and “System_is_running” memories were implemented for monitoring start condition and monitoring the “run” of the system. An Emergency subroutine has also been implemented, which manages all emergency-related functions and machine safety. These functions include the activation of the emergency lamp and the sounding of an alarm. In the event of an emergency condition, the actuators are immediately stopped by deactivating the 2/2-way valves. In their stable (deactivated) position, these valves block the passage of pressurized air to the actuators. Consequently, during normal system operation, these valves must remain activated to allow the flow of pressurized air. Specific subroutines were designed to manage the pilot light and the animation of the pneumatic actuations. By this way the operator can detect and monitor all the states of the automation and visualize the actuators movements in the HMI. Automation StudioTM provides each kind of sensors (reeds, proximities, pressure sensors, linear displacement sensors, encoders, flowmeters, …) and for each of them bool, integer o real datatype are available to be sent to the HMI for visualization and monitoring aims. The main algorithm of the control logic is included in Fig.4a subroutine. This subroutine exploits the general rule of the step-transition method: a new step is set if the current step is set and if the condition established by the transition is true. When the new step is set, the previous step is reset. In the developed ladder code, there is a slight modification due to the inclusion of the Loop_memory coil. Since the two flanging operations are identical from the perspective of cylinder C, this memory coil was added to enable steps 3 and 4 of the automatic sequence to be performed twice. Then, in another subroutine (Figure 4b), each step of the method was associated to a PLC output port. Figure 4 – Step/Transition (a) and actions (b) subroutines 3.3 HMI for system monitoring and supervision The HMI is shown in Fig. 5. Thanks to the HMI & Control Panels from the Automation StudioTM library, an extensive visual representation of the system was created. This library contains several components that meet the system's requirements. A particularly useful feature that was leveraged is the ability to add animations to images. This functionality enabled the creation of animations for the cylinder rods, pipe movement, and other dynamic elements of the system. As shown in Fig.5, the operator can input the number of pipes to be flanged via the HMI and can continuously monitor the status of the system and the number of pipes already flanged. When the system is in initial condition all actuators are in fully instroke position except for Cylinder B which is fully out stroked and the "System Ready" light indicator is turned on. Figure 5 – Human Machine Interface (HMI) and initial condition of the automatic system Upon system startup, all actuators perform the cycle according to the sequence described above. The HMI in Fig. 6 shows the automatic system while the preliminary flanging operation on the pipe is performed. Thereafter, cylinder D extends to change the flanging tool, and Cylinder C performs the final flanging operation (Fig.7). Figure 6 – Preliminary flanging operation Figure 7 – Final flanging operation Subsequently the system returns to its initial state, and the counter for flanged pipes will be incremented by one and the system is again ready for a new cycle repetition (Fig. 8). Figure 8 – Final step of the cycle 4. CONCLUSIONS The virtualization of an automatic system was presented in this paper as a first step for a digital twin implementation. Automation StudioTM software was employed as an extensive and comprehensive tool to develop and accurate digital model of the automation. As a case study an automated flanging pipes station was analyzed and a PLC-based control design was performed in the digital twin by “virtually” wiring the PLC and writing the ladder logic exactly as in the physical actual automation. By this way a “virtual replica” of the automatic station and of the PLC was developed. The “virtual replica” of the automatic system is now ready for Failure Mode and Effects Analysis (FMEA) and for the implementation of the OPC connectivity and integration with the real system. REFERENCES [1] A. V. Volosova, P. F. Yurchik, V. B. Golubkova, B. S. Subbotin and A. V. Vasiliev, "Using a Digital Twin in Ultra-Large-Scale System," 2023 Intelligent Technologies and Electronic Devices in Vehicle and Road Transport Complex (TIRVED), Moscow, Russian Federation, 2023, pp. 1-5, doi: 10.1109/TIRVED58506.2023.10332708 [2] R. Rayhana, L. Bai, G. Xiao, M. Liao and Z. Liu, "Digital Twin Models: Functions, Challenges, and Industry Applications," in IEEE Journal of Radio Frequency Identification, vol. 8, pp. 282-321, 2024, doi: 10.1109/JRFID.2024.338799 [3] A.P. Moreira, H.A. Lepikson, L. Schnitman, and G.L. Bezerra Ramalho, “Designing a new artificial lift method using computational simulation and evolutionary optimization, IEEE Access, 8, 2019, doi: 10.1109/ACCESS.2019.2938992 [4] N. Hodzic, E. Ekinovic and M. Redzic, “The application of software automation studio in design and work simulation of hydraulic systems,'' Proc. 18th Int. Res./Expert Conf., Budapest, Hungary, 2014, pp. 357_36. [5] R. B. Pandhare and R. M. Metkar, “Design of semi-automatic hydraulic broaching machine - A review,'' Int. J. Eng. Res. Technol., 5 (2), pp. 1-6, 2017 [6] C. He, G. Jingnan, and S. Guangbin, “Application of automation studio in hydraulic system design,'' Mach. Tool Hydraul., 18, pp. 53-55, 2010