Blog

Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1

Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1

PLEASE NOTE: This blog was written using features available in TIA Portal V13 SP1 Update 1. Some of the functionality shown was removed in Update 3, specifically the ability to multiplex UDTs. Hopefully the rest of the information will be still be helpful to you!

Here at DMC, we spend a lot of time programming PLCs and HMIs. While we program systems of all types and flavors, I'm personally most experienced with Siemens (TIA Portal) and Rockwell (RSLogix5000/FactoryTalk View). There are a few new features included in TIA Portal V13 SP1 that I have found to be incredibly useful in the past few months and have allowed me to be even more efficient in my programming. I'm going to focus today on a series of updates that were added in SP1 that make it even simpler to take advantage of the nested data structures we can create in our Data Blocks - specifically, the ability to share UDTs between a PLC and HMI, link UDTs to Faceplates, multiplex arrays of UDTs, and create simple, powerful pop-ups.

Before we get started, let me say that if you're not already taking advantage of PLC data types and Global DBs to build rich data structures in your project, you're missing out. Having come from an object-oriented programming background, I really appreciate what the Function Block/Data Block paradigm will allow you to do in a PLC - it really does push PLC programming towards object-oriented programming. And let's face it, the less time we all spend on repeating tasks and minutiae, the more time we can spend actually programming.

As an exercise, let's pretend we have a project with a large number of simple valves. Of course we like to save time, so we're going to develop a special FB to handle our valves: auto/manual control, alarms, etc. In addition to eliminating the amount of code to be written, this allows us the additional advantage of keeping our future valve logic updates to a single place. Our FB has a few inputs including the feeback signals for open/close, an in-out for our 'valve' data type, and an output for the open/close command.

So, what is in our 'valve' data type? For this simple example, let's create the following PLC data type, udtValve:

We've broken our data type into three structures: configuration, status, and control. The configuration group of parameters defines the valve's physical behavior and its unique name. The status group contains all status information about the valve and is used both within the PLC and the HMI. The control group has the open/close and fault reset requests. I find breaking things up like this makes it much easier to find the right tag you're looking for when programming.

For our valve Function Block, fbValve, let's say we have something like this:

Now that we've developed a re-usable function block for our valves, let's create a DB to contain all of our valve data. I'm going to create a Global DB and name it dbValves. In it, I am going to create an array of udtValve. Within this data block, I can set configuration values, including valve names, for each of the valves I am going to use. Let's imagine we'll be using 10 valves. As you can see below, I've entered configuration values in each valve's data structure.

The final step on our PLC is to add our newly written code. I've created a FB (fbValves) to contain all of my valves, instantiated 10 valves (multi-instanced versions of fbValve) within it, and dropped fBValves into OB1.

Now, let's move to the HMI. Let's say we want to put together a simple P&ID of our system showing each of the valves and their status. Let's also imagine we want to allow a user to click on a valve and open a pop-up so that they can get more information as well as control it manually.

Let's start with the first task - our simple P&ID. I'm going to grab a simple valve from the toolbox (under "Elements - Symbol Library") and add an indicator for the valve name. Under "Properties - Appearance" for the symbol, I'm going to change the "Fill Style" to "Shaded". This will allow me to add some color animation to the valve: Orange/flashing when the valve state is not known, Grey when the valve is closed, and Green when the valve is open. Additionally, I would like the valve's name to change to Red and flash when the valve is faulted.

I could start adding in my animations now, but I don't want to have to redo that process for each valve. Instead, I'm going to create a faceplate so I can write the logic once and reuse it several times. To do this, select both the valve symbol and the valve name indicator, right-click, choose "Create Faceplate", and name it 'ValveIndicator'.

Inside the faceplate editor, I could create new properties for the fault status, the valve state, and the valve name, then tie each to the appropriate item/animation. However, this would require linking each of these properties back to the appropriate tag inside of my data structure. With a lot of valves, this could take a lot of work. This is where one of the new TIA Portal V13 SP1 updates will come in handy: the ability to use PLC UDTs (PLC data types) in the HMI.

To have access to a PLC data type on the HMI, we will first need to add it to our project library as a type. To do so, just drag udtValve from the PLC project tree into the "Project Library - Types" folder:

Now, back to our Faceplate. Let's add a new property of type udtValve. Now when we use this Faceplate, we will only need to link a single tag: all of the individual animations and properties will be internally linked, within the Faceplate, to the appropriate tag within our UDT. Below is my Faceplate and the animation for the valve color. Notice in the Properties window that there is only a single property of type udtValve.

When you're finished editing your Faceplate, release the version and let's go back to editing our HMI screen. Select the new Faceplate object and view the Interface tab. Link it back to dbValves.Valve[0] by navigating to "Program Blocks - dbValves".

That's it! Now we can add more instances of our Faceplate to the screen and simply link a new valve instance to each - nothing to it!

So, getting back to our original goal - we've succeeded in creating a simple Faceplate that can be linked directly to a single tag (UDT).

The second task we set out to accomplish was to create a pop-up that can show more detailed information for any given valve. In this case, we want to create our pop-up so that it is capable of being opened to display any one valve at a time. To do this, we will need to set up a 'multiplexing' tag to look at different valve instances in our array of udtValve. If you've tried this before, you may have run into issues. Luckily, there have been a few updates in V13 SP1!

First, let's set up our 'multiplexing' tag. We'll need to create an 'index' tag locally on the HMI that can be used to choose the active valve. In my default tag table, let's first create a local Index tag (with type of "UInt"). Next, in your project tree and while still looking at your HMI tag table, select dbValves. From the "Details View" (see screenshot below), drag Valve[1] over to your HMI's default tag table and change the name to IndexedValve:

At this point, notice that the HMI Tag is linked to a specific valve within our array of udtValves, dbValves.Valve[1]. Now, select your new IndexedValve tag and open up the property pane below. Select the empty drop-down box for "Address" and choose "HMI Tag". Now, navigate to your HMI tags and select "Index," the internal tag we created a few moments ago. At this point you will notice that the PLC Tag name shows "<Multiplex Tag>" (instead of dbValves.Valve[1]), and the 'address' now shows you a dynamic link to array. By setting our Index tag, we can now vary where our IndexedValve is pointed.

Great! Now, let's create another faceplate to show whatever information you would like. I've created the faceplate below and configured a single "udtValve" property to link it. It will give the user the ability to switch control modes, open and close the valve, and see status information.

The last piece of our puzzle is the pop-up. This is another great addition to TIA Portal V13 SP1 (for more info, see this). To create a pop-up, navigate in the project tree under your HMI to "Screen Management/Pop-up Screens". Add a new pop-up screen and add your new faceplate to it. Select your faceplate and view the "Interface" tab under Properties. Now, link your IndexedValve to the faceplate.

Finally - our last step. Add an invisible button and place it over one of the valves on your P&ID screen. You can do this by using a button from your HMI toolbox and configuring it to be 'Invisible' from within the properties. On the button's Click Event, add the following:

Now, when a user clicks on a valve from the P&ID, the triggered event will first update the index of the valve that is chosen, and then show the pop-up screen.

There you have it! We've taken advantage of several really great features that were added in TIA Portal V13 SP1: the ability to use PLC data types (UDTs) on an HMI, the ability to link a faceplate to a single UDT, the ability to multiplex an array of UDTs, and the ability to add a simple pop-up. As I'm sure you can imagine, there are many potential uses for these new features and this example is just one possible application. Good luck programming and let me know if there are any new features you've found that can help me be more efficient in the future! Contact us today for help on your next programming project.

Learn more about DMC's Siemens TIA Portal and Siemens SCADA solutions.

Comments

Mojtaba
# Mojtaba
Hello all.i have two question. How can put the button in faceplate for close and move faceplate to any point of screen such as faceplates in PCS7?????
And How can put several buttons for travel to any faceplate :for example trends,alarms,setting,.... such as PCS7 faceplates.
thanks and best regards.
Anatoliy
# Anatoliy
Dear Jason Mayes,

Your post is very helpful for my project.
I create udtActuator and then database dbActuators. But when i start to write networks in fbActuator (simple actuator) the tags aren't recognized by TIA and appears red underlined. So its look like a don't link tags from db and fb. I think that this should be done in declaration table. But i don't know how to link them each other.
Can you explain me please how to declare db tags with fb addresses so they can work together.

Thank you in advance.

P.S. If you prefer you can sens me this project to anatoliy dot miev at gmail.

Thank You!
Ryan Quantum
# Ryan Quantum
Jason, you are the man. This is such a helpful write up!

Thank you. All the way from Australia!
mehdi
# mehdi
Hi jason
i have a problem for index multiplexing tag
when i drag valve[1] from db1 to hmi default tags table this tag created and when in address field i call index tag
this area of address change to red and this massage is appear :the address for tag indexed valve is invalid
please help me
may you send me this example file
thanks regard
Jason Mayes
# Jason Mayes
#Greg - It should certainly work for WinCC Professional in V14/V14 SP1. What kind of application are you developing? I believe the screenshots should be relevant for Comfort Panels or WinCC Advanced applications. If using a Comfort Panel, make sure you're using at least version 14.0. As for the "Address" being grayed out... make sure the HMI tag you are trying to 'multiplex' is only an element of the array on the PLC - not the array itself. You can do this by expanding the array on the PLC and dragging a single element to the HMI tag list. Then select the Address dropdown and change the "Index tag" selection to be "HMI_Tag" - now you should be able to browse to and select the index tag you want.
Greg
# Greg
Has anyone tried this with Wincc Professional V14? I get to the point where the Index tag is to be added to the ndexedValve but the address area is grayed out.
Jason Mayes
# Jason Mayes
anchi - sure, there are certainly ways to handle what you want to do. I would suggest looking at the Siemens Open Library (http://openplclibrary.com/) for how we typically handle this situation. Furthermore, there are ready made blocks, UDTs and faceplates for your HMI to do exactly what you're talking about.
anchi
# anchi
Thank you! It`s good example. But keeping all signals in one DB uncomfortable. In my project, i have 30 analog signals. I have one FB named Scaler. This FB called in different places (Main FBs). On each analog signal i have the Data block derived from my UDT. Data from each of theese data blocks binds to the corresponding FB "Scaler".
If i use this structure, i cannot use array of UDT DB.
Maybe u (or anybody) suggest me any solution.
Sorry maybe my english is bad
Sandeep Bakoliya
Dear Sir
Can you send me the sample project of this topic

"Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1"

my mail id is-sandeep.kumar@foxindia.net
Fernando
Hello Jason,
I am using TIA Portal SP1 and WinCC TIA Portal Advance V13 SP1.
Could you please share the sample project?

Many thanks,
Wim
# Wim
Thanks for this posting, big downer that this functionality was removed from the latest release.
Hope Siemens will fix this and bring back the functionality, combined logic and HMI OOP is the way forward!
Thanks none the less for this interesting post.
Satheesh P
# Satheesh P
This is what exactly I want.
Can you please share me the example project, i am very interested.

This would save my time a lot.

Phong
# Phong
Hi..I not see Popup Screen in Screen Management. I use Tia V13 sp1. Please help me. Thanks
Stefan
This is exactly what I need and have been trying to do, but with Comfort panels.
Any idea on how to do this without the multiplexing of UDT's?

Thank you in advance.

Stefan
geert
# geert
Can i download this example project, i am very intrested.

Thanks in advandce
Bendik
# Bendik
The release notes for TIA portal V13 SP1 Update 3 state that:
"When multiplexing symbolic addresses, user data types cannot be used as multiplex tags."

So this method does not work, and that is also documented. Prior to update 3, I was allowed to configure tags this way, however, they did not work as expected. Now it will simply not compile.
Jason
# Jason
Bert and Stephen, I don't think that is correct. I was using a Comfort panel (TP700) for this demo. Make sure you're on SP1?
stephen
# stephen
thanks for that Bert. I was trying to figure out why it would not allow it for me.
Bert Schuite
# Bert Schuite
Hello all: Just a note. I think this only will work with WINCC Professional.
The users of the Comfort/Advanced version of WINCC do not have the possibility to have the faceplate udt data indexed.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts