Before we start, I want to say that the off the shelf TIA Portal’s library management features are not ideal compared to other more open source style brands like B&R’s Automation Studio. But given the history of the SIMATIC controllers, I can accept this imperfection. Hopefully in the future SIEMENS will fix the issue.
This article is a part of a series of articles that introduces various ways to manage the TIA Portal library.
Introduction
The concept of library in the Industrial Automation can vary from the source management to the project “template” management. I am not going to define what TIA Portal Library is, but will focus on different methods that we can use and their scope of management.
In this article, I’ll introduce the library management method by using the import and export feature of TIA Portal. I’ll start by introducing the scope of management this method covers and then provide an application example. At the end of this article I’ll provide a short conclusion and a comparison of the various library management methods which will be the same part of the other articles of this blog series.
You can also check out the other articles via the links below.
- TIA Portal Library Management Methods 2: Global Library
- TIA Portal Library Management Methods 3: Version Control Interface
Let’s start.
Scope of Management
The import / export method can manage text based programs (STL and SCL), data block and UDT.
The export process doesn’t allow mix programs so if the program uses STL and SCL at the same time, all STL programs can be exported together in one file as are SCL programs but SCL and STL programs must be separated.
Additionally, know-how protected blocks can’t be managed by this method.
Application Example
Though the import / export method is quite limited, there are companies that like to use it because it’s free and extremely easy to use. You will understand why by looking at the below example.
Export Process
When a PLC library has been finished, it can be easily exported by below actions.
The export process is the same for SCL or STL programs. The only difference is SCL source is saved in a .scl file while STL source is saved in a .awl file.
Modify Library Outside of TIA Portal
Since the SCL / STL programs are text based, the exported file can be modified outside of TIA Portal if necessary. The exported SCL programs are presented below.
ORGANIZATION_BLOCK "SCL_Cyclic_OB"
TITLE = "Main Program Sweep (Cycle)"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
(*
Program in the OB
*)
(*
Some program
*)
(*
Some other program
*)
END_ORGANIZATION_BLOCK
FUNCTION "SCL_FC" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
(*
Program in the FC
*)
(*
Some program
*)
(*
Some other program
*)
END_FUNCTION
FUNCTION_BLOCK "SCL_FB"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
(*
Program in the FB
*)
(*
Some program
*)
(*
Some other program
*)
END_FUNCTION_BLOCK
DATA_BLOCK "ExampleDB_for_SCL"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
NON_RETAIN
VAR
data1 : Bool;
data2 : Byte;
data3 : Word;
data4 : DWord;
data5 : LWord;
END_VAR
BEGIN
END_DATA_BLOCK
If I make some changes like below, the modifications can be easily imported.
Import Process
The import process is very simple, too.
Simply open source file that you want to import via the PLC’s external source files folder.
The modification made outside of TIA Portal has been imported.
Using “Including All Dependent Blocks” Feature
In some cases, we want to update some FCs or FBs but they use multiple other FCs / FBs, to assure the consistency, we want to export and import them together. This can be done manually but may induce human error. Instead, we can use the “Including all dependent blocks” feature.
For example, the below FC calls a dependent block in it. Instead of selecting both of them, we can use the “Including all dependent blocks” option to bring all blocks used into the exported .scl file.
The generated source is below.
FUNCTION "DependentBlock" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
(*
Dependent block's program
*)
END_FUNCTION
FUNCTION "Block" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
"DependentBlock"();
(*
Some other program
*)
END_FUNCTION
The generated source will automatically include the dependent blocks. The generated source can also be edited outside of TIA Portal and importing will bring all the changes back into TIA Portal.
Managing UDTs
The approach to manage UDTs is exactly the same as the program. I will not spend time repeating the same procedure.
Conclusion
The import / export method is very limited. But it covers a big chunk of the companies and their way of using TIA Portal. The procedure to use this method is simple enough for anyone involving the automation work and the library files are text based so using modern version control tools are very easy.
Comparison of Various TIA Portal Library Management Methods
Method | Cost | Scope | Git Compatibility | Extra Development |
---|---|---|---|---|
Import / Export | Free | Text based programs and UDTs | Use Git independently | No |
Global Library | Free | Entire TIA Portal project | No | No |
VCI | Free | Software, UDTs, TOs, tag tables | Yes | No |
Openness | Free | Entire TIA Portal project | Yes | Yes |