This Add-In has been developed to streamline the creation of user-modeled interfaces for OPC UA servers. By browsing through the TIA Portal project, it incorporates all variables that are accessible via OPC UA and arranges them in a structured manner, eliminating the need for manual configuration and significantly reducing the time and effort required.
The main goals of the Add-In are:
- Enhanced performance: Replace the default SIMATIC server interface with modelled interfaces that offer improved performance. With modelled interfaces, OPC UA clients can create monitored items and access data (using read or write services) up to 6 times faster.
- Automatic interface generation for S7-1200 and S7-1500 R/H PLCs: Create server interfaces for S7-1200 and S7-1500 R/H PLCs, which do not support the default SIMATIC server interface.
- Customization to fit project needs: Provide flexibility by allowing customization of the server interface to meet specific project requirements. With the "Extend create" option, users can modify certain parameters of the server interface and adapt it to their needs.
Follow these steps to carry out the installation process:
- Download the repository to the local machine.
- Open Visual Studio, selecting the option: "Run as Administrator".
- Ensure that all necessary references are included in the project AddinOpcUaInterface. If any references are missing, select the Openness DLL files from TIA Portal version V19 as your reference source.
- Build the solution. The post-build event command will automatically transfer the .addin file to the C:\Program Files\Siemens\Automation\Portal V19\AddIn directory.
NOTE: If TIA Portal version V17 or V18 is being used, please refer to the instructions described in Chapter 4.
To use the Add-In in TIA Portal, make sure that the OpcUa-UserModelledInterface.addin file is located in the following directory: C:\Program Files\Siemens\Automation\Portal V19\AddIns.
Then, proceed with the following steps:
-
Open a TIA Portal project and navigate to the Add-Ins tab on the right of the screen.
-
Activate the Add-In with the dropdown menu.
-
Once activated, right-click on a device.
-
Place the cursor over the Add-In. The two possible actions, "Create" and "Extend create," will appear.
The "Create" option enables users to recreate the default SIMATIC server interface. This means that all configuration parameters are pre-set, and the user only needs to specify the name of the server interface, namespace URI, and a file path to store the XML file.
The "Extend create" option allows users to customize the interface according to their specific requirements. Some of the options offered by this action include:
- Setting filters to define the access levels of nodes within the server's AddressSpace.
- Optimizing the server interface: Exclude children nodes from UDTs, structs, arrays, etc. In large projects, the number of nodes can be significantly reduced to fit the server's maximum node limit. - There are currently some limitations regarding this feature.
- Choosing between strings or numeric identifiers for node identification: While the default SIMATIC server interface uses strings, numeric identifiers offer improved performance in terms of server storage and communication. - There are currently some limitations regarding this feature.
- Removing empty data blocks: This option enables the removal of data blocks that do not contain any accessible variables via OPC UA, thus reducing the number of nodes in the server's AddressSpace.
- Preserving the folder structure of the project: Folders present in the project can be included in the server interface. Maintaining the folder structure allows for easier browsing of the AddressSpace, although it increases the number of nodes.
- "Create" and "Extend create" actions have been implemented.
- Access level filters: Safety parameters are set to read-only by default.
- Optimization of the server interface: The Add-In currently operates in "optimize" mode by default, excluding children nodes from UDTs, structs, arrays, etc.
- Removal of empty data blocks: To reduce the number of nodes.
- Folder structure management: Users can choose to keep or exclude the folder structure of the project.
- Log file: Maintains a record of nodes that have not been added to the server interface.
Some of the Add-In's current limitations are listed below:
- It is not possible to use the Add-In without the "optimize" mode.
- NodeIDs cannot be configured with numeric identifiers.
- Function Blocks instantiated within other Function Blocks are modelled as "UAObjects" instead of "UAVariables". Therefore, the variables contained inside nested FBs are not accessible via the generated interface.
DISCLAIMER: This Add-In is designed to serve as a starting point for users to build upon. Users are encouraged to expand upon this basic version by implementing additional functionalities according to their specific requirements.
The Add-In utilizes the Openness API to access information stored in the TIA Portal project. To create a user-modelled interface, the Add-In follows these steps:
- Imports an XML base template of the server interface as an XDocument.
- Scans through all system and user datatypes in the project and includes them in the XDocument as UADataTypes and UAObjects.
- Browses through the project's tag tables and adds all Tags to the server interface.
- Repeats the previous step with the Global and Instance data blocks that are accessible via OPC UA.
- Finally, the program exports the XDocument as an XML file, which is imported into TIA Portal to create the server interface.
The Add-In is designed to run on TIA Portal V19, but it can be adapted to run on TIA Portal version V17 and V18. To do so:
-
Update the references of the project AddinOpcUaInterface. Use the Openness DLL files from TIA Portal versions V17 or V18 as your reference source.
NOTE: Openness has backward compatibility. This means that an Add-In built with the DLL files from TIA Portal V17 can also run on TIA Portal V18, V19 and future versions.
-
Change the post-build event command to:
copy "$(ProjectDir)AddInPublisherConfig.xml" "$(TargetDir)AddInPublisherConfig.xml" /Y "C:\Program Files\Siemens\Automation\Portal V1X\PublicAPI\V1X.AddIn\Siemens.Engineering.AddIn.Publisher.exe" -f "$(TargetDir)AddInPublisherConfig.xml" -l "$(TargetDir)PostBuildLog.txt" -v -c -o "C:\Program Files\Siemens\Automation\Portal V1X\AddIns\OpcUa-UserModelledInterface.addin"
NOTE: Replace the placeholder "Portal V1X" with the specific version of TIA Portal installed on your machine. For example, if TIA Portal V18 is installed, replace "Portal V1X" with "Portal V18". Similarly, update "V1X.AddIn" to match the version of the Openness DLL files selected in the previous step. If the selected DLL files are those from TIA Portal V17, change "V1X.AddIn" to "V17.AddIn".
-
Replace "UnrestrictedPermissions" with "SecurityPermissions" in the AddInPublisherConfig.xml file.
Before:
<RequiredPermissions> <TIAPermissions> <TIA.ReadWrite/> </TIAPermissions> <UnrestrictedPermissions> <System.UnrestrictedAccess> <JustificationComment> Needed for the execution of the "OPC UA - User Modelled Interface" Add-In </JustificationComment> </System.UnrestrictedAccess> </UnrestrictedPermissions> </RequiredPermissions>
After:
<RequiredPermissions> <TIAPermissions> <TIA.ReadOnly/> </TIAPermissions> <SecurityPermissions> <System.Security.Permissions.UIPermission/> <System.Security.Permissions.FileIOPermission/> <System.Security.Permissions.SecurityPermission.UnmanagedCode/> </SecurityPermissions> </RequiredPermissions>
OPC UA communication:
Openness API: