Matlab/Simulink
This section describes how to configure the namespace of the TwinCAT OPC UA Server in order to obtain access to the symbols of a TwinCAT 3 Matlab/Simulink module. This requires the following steps to be carried out:
- Activating the symbol file
- Enabling symbols
- Configuration of the server
These steps are described in more detail below.
Activating the symbol file
To configure certain symbols contained in an instance of a C++ module so that they become accessible via OPC UA, you must first activate the download of the symbol file for the module instance. This copies the symbol file to the boot directory of the target device when the configuration is activated.
Activate the download of the symbol file by setting the following option in the properties of the module instance:
The generated symbol file (TMI) is always named after the ObjectId of the module instance and is now copied to the boot directory of the target device when activated, for example:
%TwinCATInstallDir%\3.1\Boot\Tmi\Obj_01010010.tmi
Enabling symbols
The TE1400 Target for Simulink product offers various setting options for selecting variables that are to be enabled via OPC UA. These settings are described in the corresponding TE1400 product documentation.
Configuration of the server
You can now use the TwinCAT OPC UA Configurator to configure the TwinCAT OPC UA Server so that it reads the generated symbol file and makes the Matlab/Simulink module instance available as a data access device in its address space.
To do this, add a new device in the Data Access tab of the TwinCAT OPC UA Configurator. Select the AMS Net ID of your device and enter the ADS port of the TwinCAT 3 Matlab/Simulink module instance. You can find the ADS port in the properties of the task connected to the module instance:
Now select the entry "TwinCAT 3 C++ (TMI) - Filtered" from the selection list in the "Type" field. In the "SymbolFile" field, select the symbol file (TMI) that was created after activating the TwinCAT 3 C++ project and should now be located in the boot directory. Alternatively, you can also use the online symbolism.
You can leave all other settings at their default values.