Professional Documents
Culture Documents
5 Best Practices For Structuring Your PLC Application in TIA Portal
5 Best Practices For Structuring Your PLC Application in TIA Portal
Hans Schrynemakers
Hey there!
Thanks for downloading this free guide. Here are 5 best practices when structuring your PLC
application in TIA Portal. Happy reading!
1. Create groups to structure Program blocks, PLC tags, and PLC data types
Please take a look at Fig.1 to the right.
Finally, the Global Data group contains the data (DBs) used
globally for this application. G roups
For PLC tags, and PLC data types, we have created the same Fig.1 Creating groups
The actual module functions are then created under a separate Ma in Call
‘Functions’ group for each Machine/Equipment group.
Functions
related to
equipment logic
PLCSKILLTREE
www.plcskilltree.com
3. Use multi-instances to prevent over-usage of DBs
When a function block (FB) is called in TIA Portal, an instance is created. This instance contains the
data of the block interface (Input,Output,InOut,Static,Temp,Constant) of the called function block.
If the instance is created as a single-instance -> the instance is created as a separate, new
datablock (DB) that will appear under your Program blocks.
If the instance is created as a multi-instance -> the instance is created in the Static area of the block
interface of the higher-level function (where the function with multi-instance is called). No new DB
will be created.
In our example (Fig.3 below) we are calling the main function calls ‘FB - Machine Modules’ and ‘FB -
Equipment Modules’ in our OB1 with single-instances (OB1 does not have a Static area so the only
option here is single-instance).
The functions inside our main functions calls are then called using multi-instances. In our example
below, we are calling 3 functions inside the ‘FB - Equipment Modules’ - Supply, Refill process 1 and
refill process 2. All 3 of those calls are created with multi-instances.
Multi-instance
Single-instance
PLCSKILLTREE
www.plcskilltree.com
4. Build tag-structures for optimized data usage and coherency
One way to create tags for your application is by using single data-types like bool, int, real,...
What if I told you there is a much more gracious way to organize your data in 2 easy steps?
In Fig.4.1 below, we have created UDTs for each module of our machine and equipment modules. If
we take UDT_Refill for example, you can see that a tag structure has been created using status tags
(Sts), command tags (Cmd), parameter tags (Par), configuration tags (Cfg) and fault tags (Flt).
Going over to Fig.4.2, we have then used those UDTs to created tag data-structures in our global
Status structure
Command structure
Parameter structure
Fault structure
Global data-blocks
PLCSKILLTREE
www.plcskilltree.com
5. Clarify you logic using comments and descriptions
So you´ve done all the previous steps, and your application is starting to look sleek, coherent, and
structured. Great work so far!
But before we call it a day, there is one final step that we can take to give our application that extra
layer of polish - adding comments and descriptions.
Clarifying your logic becomes extremely important if you´re not the only one working with an
application. If someone for example takes over your PLC application, why not give that person a
fighting chance by explaining what you´ve programmed? :-D
In Fig.5 below, we have clarified our ‘FB - Supply’ block by adding a block title and a description.
Furthermore, we have added a short description to each network title with a comment below each
title to share more details about the network.
Keep your titles short and to the point (less clutter) - use the comment section below
TIP each title to write a more detailed description of the block or the network
Want to learn even more about creating structured PLC applications in TIA Portal?
Then click the
button below. Hope to see you on the inside!
...Hans
PLCSKILLTREE
www.plcskilltree.com