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 10: Placing Objects, Settings Properties, and Events

This chapter explores screen objects further, explaining how to set static properties and how to make them dynamic. Human-machine interfaces (HMIs) accept inputs from operators too. This chapter explains how to create events and how to use scripts within the Unified environment.

Properties, events, and scripts are all used to change the behavior and feel of the HMI, from how it looks to how it responds to buttons being touched.

In this chapter, the following topics are covered:

  • Setting static properties
  • Setting dynamic properties
  • Using scripts
  • Raising events

Setting static properties

Nearly all properties of a screen object have the ability to define a static value. This static value can be considered a hardcoded value or a constant. This means that it does not change during the execution of the HMI runtime.

Every screen object that can be placed from the Toolbox section has its own list of properties that affect the look and feel of the object. Most screen objects contain similar properties, such as visibility, authorization level, size, and position. You can see an overview of this in the following screenshot:

Figure 10.1 – Properties when screen object selected

The Properties list contains everything available to be changed for the selected screen object.

The General section of the Properties list contains properties that relate to the selected object only. This means that other screen objects may not have these properties—for example, a Text box object has the Text property, but a Line object...

Setting dynamic properties

Nearly all static properties can be made dynamic through the Dynamization feature built into TIA Portal and Unified HMIs. Dynamization allows the modification of property values during runtime. This means that properties such as color, visibility, and more can be modified to react to data that is being passed to a property. You can see an example of this in the following screenshot:

Figure 10.4 – Example of Visibility property set to Tag for dynamization

By setting the dynamization of a property, additional information needs to be provided to the property, as illustrated in the following screenshot:

Figure 10.5 – Tag dynamization additional properties

These additional requirements appear to the right of the Properties list when a dynamization property is selected.

Note

Depending on the type of dynamization used, the view may look different and have different options.

Assigning tags to...

Using scripts

TIA Portal's Unified system can make use of JavaScript against screen object properties. Historically, Siemens used Visual Basic Script (VBS) for dynamization in an HMI environment; however, Unified has moved to a more advanced and commonplace JavaScript language.

Scripting can be used by setting Dynamization to Script, as illustrated in the following screenshot:

Figure 10.17 – Visibility property set to Script for Dynamization, with the script shown to the right

When Script is used as the Dynamization type, a script file is displayed to the right of the window.

The script file can be used to perform more complex evaluations of data before setting the associated properties. This allows greater flexibility and customization than other dynamization options.

Construction of script files

Scripts are semi-constructed when the Script option is selected from the Dynamization list. TIA Portal will provide the necessary function...

Raising events

As well as reading tags and setting properties for the visual display of data, an HMI is commonly used to set data in a PLC via events, such as the pressing of a button. The Unified HMI platform has not changed this approach from nearly all other Siemens environments, with a simple interface for the declaration of the event. You can see an example of an event in the following screenshot:

Figure 10.22 – Example of an event

The event configuration can be accessed by clicking on a screen object and selecting Events from the Properties window at the bottom of the screen. Similar to the Properties tab, the Events tab lists possible event types on the left and then the configuration of the selected event on the right.

Figure 10.22 is an example of a SetTagValue event type, where, when the Click left mouse button trigger is raised by the HMI runtime, the Pump1_Data_StartStop_PB tag is set to the value of 1 (or True).

The Pump1_Data_StartStop_PB...

Summary

This chapter has covered the setting of properties and the dynamization of properties, as well as scripting and raising events. All of these are required in order to successfully interact with the HMI and any associated PLCs connected to the HMI.

Understanding when to use scripts over the built-in configuration menus is something unique to each programmer and application developed. It is important to remember that scripting should be used only when needed and not for the sake of it. Large scripts can cause issues if there are too many running at once.

The next chapter explores connecting structured data from a PLC to predefined faceplates in an HMI, allowing large datasets to be retrieved and utilized easily while maintaining a standardized and structured approach.

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