TC ADS Module Interface
The block "TC ADS Module Interface" provides synchronous read and write access to a special TwinCAT module. You can find this block beneath the subfolder "Synchronous" of the Beckhoff ADS Library inside the "Simulink Library Browser".
Block input and output ports
The number of ports and the data types of the ports depend on the block configuration. There are no fix input or output ports.
Block parameters
Target module | ||
---|---|---|
|
NetId |
The NetId of the target system, where the interface module instance is running. |
|
OID |
The object ID of the module instance. |
Module settings |
|
Module instance definition file |
Create or open a TMI (TwinCAT module instance) file, containing the interface module configuration. This file can be imported to the TwinCAT project. |
|
Default module sample time |
The default sample time of the interface module. |
Module in-/outputs |
Define the input and output ports of the Simulink block. These settings are saved to the selected TMI (TwinCAT module instance) file. The signals can be of any base type or a Simulink Bus Object, which is defined in the MATLAB workspace. |
General Simulink block settings |
|
Block sample time |
The Simulink block sample time, which is the ADS request interval (referred to the Simulink time but not to the real time) |
Synchronisation |
|
No synchronization / Synchronized data exchange |
The real time span from the start of the simulation is transmitted from the interface module to Simulink and can optionally be used to slow down the simulation time to the real time. |
|
Provide TwinCAT time output port |
Provide the real time span from the start of the simulation as an output port. |
Interface module configuration
- 1. Open the TwinCAT project you want to connect to
- 2. Create a new instance of the MatlabInterfaceModule at the TwinCAT projects node "System / TcCom Objects" via its context menu item "Add new item..."
- 3. Open the context menu of the newly created object node and Reload the TMI file. Open the TMI file that was configured in the Simulink block configurator.
- 4. Link the process image variables of the interface module to the desired process images of other TwinCAT modules (PLC, C++, MATLAB/Simulink, IOs). The objects input Data Area contains the Simulink block outputs and vice versa.
Code generation
Code generation from models using this block is supported for the TwinCAT Target. The generated TwinCAT module gets additional Data Areas (Process Images), which have the same structures as the Data Areas of the interface module instance.