Basic principles

The TwinCAT 3 CAD Simulation Interface connects TwinCAT with 3D CAD software. The goal of this coupling is "software-in-the-loop simulation" (SiL simulation, abbreviated as SiL in the following). In virtual commissioning or in an SiL, a closed loop is essential. I.e. values are written from the controller to the CAD model (axis positions) and at the same time values are fed back from the model to the controller/PLC (sensor values). In this context, the visualization or simulation helps the programmer to better understand the behavior of the controller and to detect possible problems in this loop.

The TwinCAT 3 CAD Simulation Interface uses the design data from the CAD tool and the position values and other values from the TwinCAT project for the SiL. The axes to be moved, which must be configured in the CAD system, are imported into this TwinCAT project. The CAD software parameters are linked to the TwinCAT symbols for the simulation of motion.

The 3D simulation is not real-time capable because most CAD programs run on standard Windows systems or do not have a real-time simulation environment.

Operating principle

To run a simulation with the TwinCAT 3 CAD Simulation Interface, a 3D model and a PLC project are required as a basis. When a 3D model is being designed in CAD software, the assemblies and axes that should be mobile later on must be configured accordingly. In addition, a PLC project is required in TwinCAT to control the machine's movement. In the TwinCAT 3 CAD Simulation Interface, the 3D model's mobile simulation axes are connected to the PLC. When running the simulation, the values are copied from the controller to the model as axis positions and values are simultaneously fed back from the model to the controller as sensor values. The movement that occurs due to the commands from the controller is displayed in the 3D model.

For the application of the TwinCAT 3 CAD Simulation Interface, TwinCAT is triggered by an external CAD program. The TwinCAT 3 Usermode Runtime enables synchronous integration of the execution for this purpose. The TwinCAT 3 Usermode Runtime offers an interface for this, whereby the ticks for the runtime are specified externally. The TwinCAT Usermode Runtime is initialized and started in the respective CAD tool via the CAD-specific add-in. After initializing the Usermode Runtime, the target can be selected in TwinCAT. After starting the runtime, values can be exchanged between CAD tool and TwinCAT. The Usermode Runtime used for coupling the TwinCAT project and the CAD tool is tasked with ensuring synchronous execution of the non-real-time capable CAD tool and the real-time capable PLC code.