Reader small image

You're reading from  PLC and HMI Development with Siemens TIA Portal

Product typeBook
Published inApr 2022
PublisherPackt
ISBN-139781801817226
Edition1st Edition
Right arrow
Author (1)
Liam Bee
Liam Bee
author image
Liam Bee

Liam Bee has worked in automation for over 16 years, after starting his career at 16 years old as an instrument technician in the water industry. He began his automation journey by maintaining PLCs and the instruments connected to them. He found very early on that he had an interest in PLCs and automation, taking the time to learn PLC programming in his own time, as well as exposing himself as much as possible to automation while working. After 8 years of working in maintenance, Liam started his own side business, providing bespoke controls using lower-range PLC solutions. This experience proved invaluable to his progression; he learned quickly, often through failure, and his knowledge of control design improved significantly. 12 years into his career, he moved roles again; this time, he was looking for something to fill knowledge gaps and target Siemens as he was yet to use Siemens extensively. Liam started at Aquabio Ltd and quickly found himself immersed in Siemens SIMATIC Manager and TIA Portal. Over the next 3 years, he worked hard to understand Siemens' tools and development environments, calling on knowledge from other PLC environments that he had previously worked with. Over his years working with automation, he has learned many different languages and development environments. He has worked with Siemens, Allen Bradley, Schneider, Mitsubishi, and a host of other PLC platforms, all of which have helped shape the design concepts that he uses today. Liam has also taught himself computer programming languages such as VBA, VBS, VB.NET, C#, Java, and more. Closing the space between IT and industrial automation is important as time moves forwards and he has always tried his hardest to be at the forefront of innovation.
Read more about Liam Bee

Right arrow

Chapter 15: Programming Tips and Additional Support

The final chapter covers programming tips for different areas of TIA Portal. These are items that are useful to know and that may help advance knowledge and writing styles for programmers.

The items described in this chapter serve as a good starting point for any programmer to adapt and modify to suit their individual writing style. This chapter also covers additional support information and where programmers can find more resources to help continue their learning.

This chapter covers the following areas:

  • Simplifying logic tips
  • Managing sequences
  • Naming conventions and commenting
  • Additional Siemens support
  • Further support

Simplifying logic tips

There are hundreds of different ways of completing the same task when it comes to logic writing. There is no clear approach that is the perfect way to achieve the desired logic output; all that should matter is that it is easy to read, easy to modify, and well documented. In addition to this, programmers should write logic code with their own style that is comfortable to them but be considerate of the fact that it is likely that other programmers will also work on the project.

Good logic will be simple and easy to follow without much deciphering required by those that find themselves working on it.

Delay timers

When using timers, such as the Timer On Delay (TON) timer, it is important to understand why that timer is being used. Consider a scenario where an output is required to be delayed both before and after a signal is set to True. This may look something like Figure 15.1:

Figure 15.1 – Example of start and stop delay...

Sequences – best practices

Sequences in PLC control are extremely common and are used for many different application types and use cases. Controlling sequences correctly, efficiently, and retaining an easy method by which they can be modified is important.

There are many ways to control a sequence, from custom-built sequence management logic to using the GRAPH language. Sequences are inherently application-specific, but their management does not have to be and can be standardized to some degree.

Note

TIA Portal's GRAPH has a pre-built method to create advanced sequences. However, in many circumstances, GRAPH may not be suitable or desired, especially for sequences that interact with other proprietary code. GRAPH is flexible enough to be programmed to do what needs to be done, but it comes with additional functions that may not be desired.

Using constants instead of numerical values

It's very common to see sequences that use numerical values to manage...

Naming conventions and commenting

TIA Portal offers a huge 128 characters per symbolic name for a variable across eight available nesting depths. This means that variables can have a combined maximum length of 1,024 characters. To visualize this, the following would be a perfectly acceptable variable name:

#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...

Additional Siemens support

Siemens has a wealth of support for programmers using TIA Portal. These come in many different forms, from internal TIA Portal help to dedicated forums and websites.

These resources can be a great place to find information quickly, and nearly all help topics have been covered by Siemens or the wider TIA Portal user community.

Using TIA Portal's help system

TIA Portal has an extremely well-documented help system. This is accessible by pressing F1 or by selecting Help and then Show help. The Information System home screen gives some suggestions for generic help, as shown in Figure 15.26:

Figure 15.26 – Information System home screen

This is a good place to start for finding items such as generic help, training, and application examples. Most buttons link to the same version of the home page, but on the Siemens website, the buttons link to its relative pages.

Note

Clicking the buttons on the screen will launch...

Further support – Liam Bee

Connect with the author of this book via LinkedIn. Liam is open to questions and discussions on topics of this book and always helps those that want to be helped.

Figure 15.30 – Connect with Liam Bee on LinkedIn

Figure 15.30 – Connect with Liam Bee on LinkedIn

Summary

This chapter has ended the book with some additional information regarding programming tips, some best practices for sequence control, and considerations regarding commenting and naming conventions.

This book has explored many different aspects of TIA Portal and PLC programming in general, as well as HMI development. By covering all topics in this book, you should now have the confidence to apply the learning to projects and help tailor your own personal development. As TIA Portal and the world of automation improves, many of the learned aspects covered in this book will still be valid.

TIA Portal is a very powerful development platform, and when a programmer understands all of the tools that TIA Portal has to offer, almost any automation solution can be developed directly within TIA Portal itself.

Please continue to use this book as a reference document, returning to chapters and content when needed. Use the support content from Siemens, such as the information system...

Why subscribe?

  • Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
  • Improve your learning with Skill Plans built especially for you
  • Get a free eBook or video every month
  • Fully searchable for easy access to vital information
  • Copy and paste, print, and bookmark content

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
PLC and HMI Development with Siemens TIA Portal
Published in: Apr 2022Publisher: PacktISBN-13: 9781801817226
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Liam Bee

Liam Bee has worked in automation for over 16 years, after starting his career at 16 years old as an instrument technician in the water industry. He began his automation journey by maintaining PLCs and the instruments connected to them. He found very early on that he had an interest in PLCs and automation, taking the time to learn PLC programming in his own time, as well as exposing himself as much as possible to automation while working. After 8 years of working in maintenance, Liam started his own side business, providing bespoke controls using lower-range PLC solutions. This experience proved invaluable to his progression; he learned quickly, often through failure, and his knowledge of control design improved significantly. 12 years into his career, he moved roles again; this time, he was looking for something to fill knowledge gaps and target Siemens as he was yet to use Siemens extensively. Liam started at Aquabio Ltd and quickly found himself immersed in Siemens SIMATIC Manager and TIA Portal. Over the next 3 years, he worked hard to understand Siemens' tools and development environments, calling on knowledge from other PLC environments that he had previously worked with. Over his years working with automation, he has learned many different languages and development environments. He has worked with Siemens, Allen Bradley, Schneider, Mitsubishi, and a host of other PLC platforms, all of which have helped shape the design concepts that he uses today. Liam has also taught himself computer programming languages such as VBA, VBS, VB.NET, C#, Java, and more. Closing the space between IT and industrial automation is important as time moves forwards and he has always tried his hardest to be at the forefront of innovation.
Read more about Liam Bee