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 8: Options to Consider When Creating PLC Blocks

This chapter explores additional options to consider when creating programmable logic controller (PLC) blocks. There are many different approaches that programmers can take when designing, creating, and then implementing logic solutions. This chapter explores how to retain standardization while offering a flexible approach.

In this chapter, the following topics are covered:

  • Extending standard functions
  • Extending standard data
  • Managing data through instance parameters
  • Asynchronous data access considerations

Extending standard functions

A well-built paradigm or design pattern should allow for the extension of standard objects without affecting the object itself. For example, standard objects should consist of other standard objects that can also be used outside of their parent object.

Have a look at the following screenshot:

Figure 8.1 – Example of an extension

Figure 8.1 shows an example of an extension whereby Standard Object Instance 3 has an additional instance of Standard Function Block 1 that is used outside of the normal parent. Because all instances of Standard Object use Standard Function Block 1, and Standard Function Block 1 is in itself a standard, it can be used outside of Standard Object, and data that would normally be passed to Standard Function Block 1 from the Standard Object interface can be passed directly instead.

If the example in Figure 8.1 were to be replicated in Totally Integrated Automation Portal (TIA Portal), the Standard...

Extending standard data

Similar to program blocks, standard data blocks that use UDTs or structs can also be easily extended without breaking standardization. For this to work, a data block needs to be structured in a particular way.

Have a look at the following screenshot:

Figure 8.4 – Example of a data block structured with UDT and bespoke data

Figure 8.4 is an example of a data block that consists of the following two areas:

  • Asset UDT Data—This is the data that standard objects will access.
  • Asset Bespoke Data—This is an extension of the standard data.

Now, have a look at the following screenshot:

Figure 8.5 – Example in TIA Portal data blocks

Figure 8.5 demonstrates this pattern in data blocks. Asset_1 has the UDT defined as a variable named Typed, and that is the only variable that appears in the data block. This means that any standard object that requires data from Asset_1 can...

Managing data through instance parameters

When creating standard objects that have multiple methods of operation, it is worth considering which resources may be shared between the methods that an object can use. Sharing resources has a positive impact on memory allocation and simplification of an object.

Principle to this approach

Consider a standard control object that can be run in one of three modes. Only one mode can be run at any one time. You can see an example of this in the following screenshot:

Figure 8.7 – Example layout of a standard control object with multiple control methods

The standard control object accepts a common data structure (UDT, for example) and contains logic to read the selected method. In Figure 8.7, the three methods contain different timers that are in use. All methods require at least one timer, with the largest method (Method 1) requiring three timers.

If a function block were written in this manner, it would...

Asynchronous data access considerations

It is important to remember that many modern human-machine interfaces (HMIs)/supervisory control and data acquisition (SCADA) systems will access PLC data asynchronously. This means that instead of waiting till the end of the PLC scan to obtain or write data, the HMI/SCADA system will interrupt the scan to update or obtain data.

Normally, this is not an issue. However, when references via InOut interfaces are in use, it can cause unexpected behavior. This can be very difficult to diagnose because the next time data is updated, it may not be updated in the same place in the scan.

Have a look at the following screenshot:

Figure 8.13 – Example of an erroneous configuration with InOut interfaces

Figure 8.13 is an example of a configuration that is valid by the compiler but introduces issues if data blocks are interfaced with an HMI.

The blue data blocks represent asset data—they are connected to InOut...

Summary

This chapter has covered the topic of extension. This is when standard control objects' standard methods are extended outside of the standard control object, usually by using a child object that already exists.

This form of extension is a solution to adding methods to a project without changing the standardization of objects.

This chapter has also covered the extension of standard data. This allows asset-oriented data to consist of standard UDT data that is extended by bespoke data. This further supports the method extension by allowing non-standard setpoints and other data.

The next chapter moves away from PLC and over to the TIA Portal WinCC environment, in which HMIs and visualizations can be created to support projects.

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 $15.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