Introducing Add-Ins in TIA Portal

The powerful new way to use Openness functions directly in TIA Portal

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;

  • What Add-Ins are
  • The advantages of using Add-Ins in TIA Portal
  • How to use Add-Ins in TIA Portal
  • How to develop Add-Ins in an external IDE like Visual Studio

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.

TIA Portal Openness

TIA Portal Openness
TIA Portal Openness

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;

  • Reading and writing parameters in the hardware configuration of TIA Portal
  • Uploading and downloading to PLCs and drives
  • Import and export of project data and blocks as XML
  • Import and export of CAx data as AML

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.

TIA Portal Add-Ins

TIA Portal Add-In Example
TIA Portal Add-In Example

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.

Add-Ins are written as .NET programs in an external IDE like Visual Studio. Once created, Add-Ins can be easily distributed as a .addin file.

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.

Add-Ins can be enabled and disabled using the ‘Status’ dropdown
Add-Ins can be enabled and disabled using the ‘Status’ dropdown

Advantages of Add-Ins

The introduction and use of Add-Ins has many advantages for TIA Portal users. The most important advantages are;

Add-Ins are integrated as part of the TIA Portal interface

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.

Add-Ins are context-dependent

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.

Add-Ins can contain Windows functions

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.

Integrating Add-Ins in TIA Portal

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.

Drop the .addin file in the addins directory

In TIA Portal, the contents of the AddIns folder are visible in the Add-ins task card.

AddIns are visible in the Add-ins task card in TIA Portal
AddIns are visible in the Add-ins task card in TIA Portal

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;

  • The name of the Add-In
  • The author of the Add-In
  • The version information for the Add-In
  • The description of what the Add-In does
Select an Add-In from the list to view the details of the Add-In
Select an Add-In from the list to view the details of the Add-In

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.

Activate an Add-In with the ‘Status’ dropdown menu

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.

An Add-In must be granted permissions to run

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.

Using Add-Ins 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.

Contents of FC_Addition

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’.

Run the FC-FB Converter Add-In

The Add-In runs and we can see in the project tree the FC_Addition is now an FB.

FC_Addition has been converted to an FB
FC_Addition has been converted to an FB

Developing Add-Ins for TIA Portal

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.

The main elements of an Add-In Project
The main elements of an Add-In Project

AddInProvider.cs

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.

The ProjectTreeAddInProvider is used in this example
The ProjectTreeAddInProvider is used in this example

There are Add-In providers available for other parts of TIA Portal including,

  • The Project Library (ProjectLibraryTreeAddInProvider)
  • Global Libraries (GlobalLibraryTreeAddInProvider)
  • The Devices and Network Editor (DevicesAndNetworksAddInProvider)
  • The Version Control Interface (VciRepositoryAddInProvider, VciWorkspaceViewAddinProvider, VciEditorAddinProvider)

AddIn.cs

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.

BuildContextMenuItems defines the context menu for your AddIn
BuildContextMenuItems defines the context menu for your AddIn

The OnClick method contains the code that is executed when you run the Add-In.

The OnClick method contains the code that is executed when the Add-In is run
The OnClick method contains the code that is executed when the Add-In is run

Config.xml

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.

Config.xml contains configuration data about the Add-In
Config.xml contains configuration data about the Add-In

Most importantly, Config.xml contains information about what permissions are required for the Add-In to run:

Config.xml contains information about permissions
Config.xml contains information about permissions

Wrap Up

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,

  • What Add-Ins are
  • How to use Add-Ins in TIA Portal
  • How to develop Add-Ins in Visual Studio

KB Controls

We help OEMs to get the most out of their engineering teams using systems, standards and automation.

See how you can reduce costs and increase quality by working with us:

Learn More

Learn Something New Every Week

Get informative, insightful content delivered to your inbox every week

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form

Keep Reading

Learn how to optimize your team's performance

Optimize Your Team's Performance

As teams grow, they become chaotic. Different team members have different needs, knowledge is tribal, and everyone has their own ideas about best practices and processes.

How can you get everyone to follow the same playbook and ensure that best practices are being used?

Learn how to reduce your engineering effort

Reduce Your Engineering Effort

End users are becoming more sophisticated. They expect increasingly complex machines delivered faster and with less mistakes.

How can your team meet and exceed the demands of your customers?

Learn how to reduce your engineering effort

Automate the Boring Stuff

Your most expensive resource is under-utilized. Engineers waste countless hours on projects doing repetitive, low-value add tasks.

Learn how to automate the boring stuff to reduce your costs and reclaim your team's time.