Siemens’ TIA Openness is an API that allows you to interact with TIA Portal using a custom application. Although it is included with TIA Portal, Openness has not seen wide usage, as many programmers don’t see the use of learning a new programming language (C# .NET) on top of knowing PLC programming.
However, Openness offers many advantages that can lead to more efficient code creation. One of the best uses of Openness is for creating modular code that can be used across many devices, with application-specific changes being made automatically. By defining some base templates, you can allow users to generate entire projects without any knowledge of PLC and HMI programming.
How does Openness Work?
There are two main parts of any Openness project:
- The C# .NET application that provides the interface to TIA Portal
- The XML files that are used to create code in TIA Portal
I’ll cover the details of the XML files in a later blog post; for now, we’ll focus on the C# .NET application. All you need to get started is to add the two .dll files that Siemens provides as references to your C# .NET project. These files provide the variable types and methods needed to work with TIA Portal.
The API provides a wide range of functions; from simple actions like compiling a project to creating and configuring technology objects on a PLC. While there are some functions that cannot be done through Openness, most common operations are available, and more are added with every new release.
In order to see what functions are available and how to use them, open up the Help Viewer (shown below) within TIA Portal, and find the section titled “Automating projects with scripts”. This section contains documentation on the various methods available. Each entry also includes simple code examples. The “Public API” and “Export/Import” sections are where the majority of these examples are located.
Advantages of Openness
At this point, you might be thinking “That sounds pretty nice, but how is this more useful than just programming in TIA Portal?” The main answer is scalability. Using Openness allows a user to automate time-consuming and tedious processes when working on a project. For example, your company may require a standardized code architecture for PLC projects. If that standard is replicated in Openness, one click could create the project, set up the architecture, add standard blocks from custom libraries, and add all the necessary GSD files.
If a project is being created for multiple, mostly identical machines, Openness can simplify creating each specific project. Openness can create a base project, and then only the individual differences need to be implemented. If the differences between the machines are well defined, Openness can further simplify development. A custom application can provide the user with a list of different modules that are assigned to a specific machine. Openness would then be able to create the base project and add in any extra modules that have been defined. With this custom application, any changes to the code are only made in one place and can be easily redeployed.
Disadvantages of Openness
Openness is a very powerful tool and opens up many possibilities for custom applications. However, there are some cases where it does not make sense to use Openness. Since Openness uses XML files to generate objects and code, it requires becoming familiar with the Openness XML tags and structures.
As we will discuss later, these XML files quickly become very large and complicated and require extensive expertise to be able to create and read them. Creating the XML from scratch is a long and difficult process, so it is generally preferred to create your necessary elements in TIA Portal, export them to XML, and use that as a starting point.
As I explained, Openness is a great tool for creating scalable and module code for TIA Portal. While it has a steeper learning curve than working exclusively in TIA Portal, it offers a large amount of flexibility and customization. If you find yourself creating similar projects on a regular basis, it is worth taking a look at how Openness can help you automate your process. In my next blog post, we’ll look at how to make sense of Openness’s XML files.
Learn more about DMC's PLC Programming Services and TIA Portal Development Services. Contact us for help with your next project.