The powerful new way to use Openness functions directly in TIA Portal
Add-Ins, which were introduced in TIA Portal v16, allow users to extend the functionality of TIA Portal to meet their requirements.
In this post, we’ll look at;
Add-Ins use the Openness API to interact with TIA Portal. Before we dive into the topic of Add-Ins, let’s do a quick refresh about what the Openness API is.
Openness is an API (Application Programming Interface) that allows external software tools to access TIA Portal functions.
TIA Portal Openness allows users to use TIA Portal functions in their own applications. These functions include;
Companies and developers can use the Openness API to create software applications like code generators to create PLC software and HMI applications. For more information about what's possible with the Openness API, you can check this post, which explains how Openness can be used to automate your engineering processes.
Available in TIA Portal version 16, TIA Portal Add-Ins provide users with a new way to use the Openness API within TIA Portal. Add-Ins are a powerful new way to extend the user interface of TIA Portal with context-sensitive functions and features.
In the example image above, you can see that an Add-In has been created to convert FCs to FBs in a project.
The new Add-ins task card in TIA Portal allows a user to view the Add-Ins which have been added to TIA Portal. In the task card, important information about an Add-In is displayed including the author, the version of the Add-In, and the permissions that are required by the Add-In.
Add-Ins can also be enabled and disabled from this task card as required using the ‘Status’ dropdown menu.
The introduction and use of Add-Ins has many advantages for TIA Portal users. The most important advantages are;
Users can access and run add-ins directly from TIA Portal. This eliminates the need to create separate applications that perform small functions using the Openness interface.
Since Add-Ins are context-dependent, they can only be run in the correct context. This prevents misuse of Add-Ins by users.
For example, an Add-In that runs on Function Blocks cannot be run in the hardware configuration.
Since Add-Ins are written in an external IDE, they can contain Windows functions. This means than Add-In can execute file or network operations and interact with other applications.
With other solutions, like Openness Scripter Scripts, this is not possible.
To integrate an Add-In into TIA Portal, you must copy the .addin file to the ‘addins’ folder in the TIA Portal installation directory. If you installed TIA Portal in the default location, the addins directory will be located here:
C:\Program Files\Siemens\Automation\Portal V16\AddIns
In this example, I’ll be using the FC-FB Converter Add-In provided by Siemens. You can download that Add-In here to follow along.
In TIA Portal, the contents of the AddIns folder are visible in the Add-ins task card.
When you select an Add-In from the list (1), the Details pane is populated with details about the Add-In (2). The most important details here are;
An Add-In must be activated by the user before it can be executed in TIA Portal. You can activate an Add-In by changing the ‘Status’ dropdown in the Details panel for the Add-In.
When you activate an Add-In, a pop-up menu prompts you to check and accept the security permissions that the Add-In is requesting.
Since Add-Ins can use Windows functions, they may require permission to access the file system or other applications on your machine. For example, the FC-FB Converter Add-In requires the File.IO permission to read and write files on the local machine.
If you do not accept the permissions requested by an Add-In, then the Add-In cannot be activated.
After granting permissions to an Add-In, it is activated and can be used in TIA Portal.
You can execute Add-Ins in TIA Portal by right-clicking on project elements and selecting an Add-In to run in the context menu.
For example, we can use the FC-FB Converter Add-In to convert a simple FC into an FB. In this example, we will convert the function, FC_Addition, to an FB.
FC_Addition adds two input integers together (i_Integer_1 and i_Integer_2) and returns the result via the return value.
To run the FC-FB Converter on FC_Addition, we can right-click on FC_Additon in the project tree and choose ‘Convert to FB’.
The Add-In runs and we can see in the project tree the FC_Addition is now an FB.
TIA Portal Add-Ins are written as .NET applications in external IDEs like Visual Studio.
To help you get started with developing Add-Ins, Siemens has made a template Add-In project for Visual Studio available to download. You can download the Visual Studio project here and use it as a base to start developing your own Add-Ins.
An Add-In project consists of three main elements: the AddIn.cs class file, the AddInProvider.cs class file, and the Config.xml configuration file.
In AddInProvider.cs, you tell your application where in TIA Portal your Add-In can be used. This location is defined by a so-called ‘provider’.
In the example below, you can see that the application is using the ProjectTreeAddInProvider. This means that the Add-In is attached to elements in the project tree in TIA Portal.
There are Add-In providers available for other parts of TIA Portal including,
In AddIn.cs, you define which TIA Portal elements an Add-In can be executed on and the functionality of the Add-In itself.
In the method, BuildContextMenuItems, you define the structure of the Add-Ins context menu. This includes the ActionItem which is clicked to run the Add-In. Your context menu may also include submenus, checkboxes, and radio buttons.
The OnClick method contains the code that is executed when you run the Add-In.
Finally, the Config.xml contains configuration data about the Add-In. This data is used to populate the ‘Details’ view of the Add-In in TIA Portal.
Most importantly, Config.xml contains information about what permissions are required for the Add-In to run:
Add-Ins are a convenient way to extend the functionality of TIA Portal to meet your requirements from TIA Portal version 16 onwards.
Add-Ins are developed as .NET applications in Visual Studio, which means that they can use all of the Openness API functions as well as Windows functions. This is an advantage over other automation solutions like the Openness Scripter.
Add-Ins are executed directly on user-selected elements in TIA Portal. You can run an Add-In by right-clicking on an element and running the Add-In from the context menu.
In this introduction to Add-Ins, we’ve looked at,
Learn Logix Part 4.5. In this article, we learn about the various operating modes available for Logix 5000 controllers and the programming operations available in each mode.
Learn Logix Part 4.4. In this article, we learn how to understand and fix abnormal device states in RSLinx Classic.