Blog

Multiplexing Arrays of UDTs in TIA Portal V14

Multiplexing Arrays of UDTs in TIA Portal V14

It's back!

When V13 SP1 was first released, one of the features I was most excited about was the ability to multiplex arrays of custom UDTs on a PLC using a simple index tag on an HMI. This feature allowed me to use a single faceplate or screen to display or modify data from multiple objects by simply changing a single tag. I was so excited, I even wrote a blog post about it then! Unfortunately, it was a feature to be short lived and, due to some unexpected consequences, mysteriously disappeared with the release of Update 3.

Now that TIA Portal V14 has been released, the very first thing I did was look to see if it was back. And I'm in luck!

While I've gone into some detail in my previous blog, and all of the same information is relevant, here's a really quick demo to set up multiplexing of an array of UDTs from your HMI.

First, I've created a really simple project with a S7-1200 (FW v4.0) and a TP700 Comfort panel (Version 14.0.0.0). To make things simple, I've grabbed a UDT (udtHMI_VFD_Control) from the Siemens Open Library, and added it as a type to my Project Library (this will allow me to use it within a faceplate later), and then copied from my Project Library to my PLC (under PLC Data Types). Next, create a new data block on your PLC - I've called mine "dbDemo." Inside of my Data Block I've created a single array of VFD's.

Multiplexing PLC Data Types

Next, open up the Default Tag Table on the HMI. Add a new internal tag called "Index" of type "UINT." Now, in your project tree, select the DB you previously created, and from the details view, drag any one item from your array of VFDs into your tag table to create a new tag of type "udtHMI_VFD_Control" - you can use the blue 'tag' icon that shows up in the detail view to grab the tag. I've named mine "Indexed_VFD."

Multiplex Array of UDTs

Note that as of right now, this tag is linked directly to a fixed item within your array - in my case, "dbDemo.VFD[1]." We want to modify this so that our "Index" tag will change which item in the array we want the tag to link to so we can multiplex this tag across multiple VFDs from our HMI. To do this, select the "Address" dropdown under the properties of the tag. For "Index Tag," change the selection to "HMI Tag" and choose the "Index" tag we created earlier.

Notice that in your tag table the address has changed to indicate the position in the array is defined by our"Index" tag.  And that's it! Now, we can change "Index," either through a script or by a control on the HMI, and our multiplexed tag will look at a different item in our array. In the screenshot below, note that our "Indexed_VFD" is now linked to any VFD in our array using the "Index" tag.

To take this a step further in your quest for object oriented programming, take another look at my previous blog. It will take you through linking your multiplexed tag to faceplates and popups - which is where this feature will really help you develop better, more powerful, HMIs.

One more helpful hint - you will find that your index on the HMI will be zero based, regardless of the way you define your array on the PLC. For example, if I defined my array (on the PLC) to be [1 .. 20], an "Index" of 0 will actually access the first element, [1], in my array.

Enjoy!

Learn more about DMC's PLC Programming services and contact us to get started on your next PLC Programming project.

Comments

kambiz
# kambiz
Dear Jason,
I use comfort HMI and Wincc V16 but I think this functionality isn't working with the S7-300 series plc! do you have any suggestions for it?
Miguel Tavares
# Miguel Tavares
V15 professional runtime has no possible tag index addressing...How can we address an array of UDT data type dynamically to a faceplate without index? Siemens make things dificult, have no sense.
Seems that its only available to panels and wincc advanced, professional don't have this funcionality...
Samson
# Samson
Multiplexing arrays of udts in tia portal v14. To know more visit https://quickbooksupports.co/.
Omer
# Omer
Jason,
Thanks for your blog post, I use WinccProfessional V14+Sp1, and I would like to follow your way to open faceplate, but I'm not clear about the two scripts and how do you use them, can you show an example?
Omer
James
# James
@Jason

On further investigation it seems like the functionality you describe is not available in WinCC Pro.

I achieved my goal through 2 VB Scripts.

I defined a UDT "param" with all of the parameters on an instance of the pop-up/faceplate. I created an array of type "param" in a DB, for each different use of the pop-up. I was able to index through each element of the array using a script.

The button that opened the pop-up ran the first script which read the current values from the DB and displayed them in the internal HMI tags (which were in I/O fields) on the pop-up and set the index (the VB scripts were set with a Parameter Index of type By Ref)

I put an "update" button on the pop-up, this ran the second script that wrote new values, entered in the I/O field on the pop-up, to the DB.

The scripts used the SmartTags function. I created an intermediate local string made up of the value to be written to's address and the index: mystr= "DB_address{"&(Index)&"}.param". Which I passed to the SmartTags function.
Jason Mayes
# Jason Mayes
@James I'm not sure the same information above is relevant for WinCC Professional, which is what it sounds like you're using. But there should be other ways of accomplishing the same thing - such as using Tag Prefixing and Picture Windows. If you find out, let us know!
Olgierd
# Olgierd
@ James
Is your connection between PLC and HMI defined as HMI or PLC connection? It has to be defined as PLC connection with symbolic access for multiplexing to work.

Olgierd
James
# James
Jason,
Thanks for your blog post. It gives a clear explanation of a function I am trying to implement.However, I am using TIA V14 and I am trying to index/address an array using another tag but running into a bit of difficulty.

I have followed the instructions in the above and previous post. But when I get to the stage of: "Select the empty drop-down box for "Address" and choose "HMI Tag". Now, navigate to your HMI tags and select "Index,", that field is greyed out and not accessible.

The only real difference I can see between your project and mine is that I am developing a HMI runtime server to be accessed by thin clients compared to your project that has a regular TP Comfort HMI. DO you know if this is the reason that I cannot access that functionality? Anything you could add would be greatly appreciated.

Kind regards,
James
Gerco
# Gerco
@ Pepijn,

I also get that message. A colleague of my told me to update the firmware version of the PLC and HMI and after that, it should work.

Good luck.

Gerco
Gerco
# Gerco
Hello Jason,

I read your previous post about multilplexing UDT's in TIA portal V13. I'm really interested and I now installed TIA portal V14 SP1 to give it a try. But I get the same message as Pepijn: "User data types are not permitted".

I'm using TIA portal V14 SP1 with WinCC Advanced V14 SP1. I've also checked the help, but I don't understand why it is not working. Maybe Upd1 is needed?

Greets
Jason Mayes
# Jason Mayes
Jan - as Olgierd mentioned, if you're using TIA Portal it sounds like this may be non-issue. However, if you've not yet met the update, there are still a few ways around it. One thing I've done in the past is adding a string tag to the type and used this to track the name of the object. This has the added benefit of being usable on the HMI to display the name of an object dynamically. Good luck!
Olgierd
# Olgierd
#Jan:

Siemens has released TIA Portal V14 SP1 which addresses this issue. It is possible to make comments for each individual element in the array.

Olgierd
Jan
# Jan
Hey Jason,

thank you for your brief, yet comprehensive example. I would like to use multiplexing very much, but I can see one major dealbreaker when using arrays: Single elements of an array cannot be named, thus making it really difficult using them in the PLC code. For example we might name one instance DB of FB_Valve "iDB_blowOffValve_4Y1" and another one "iDB_waterValve_3Y3". If I were to name them "valve[1]" and "valve[2]" I'd have to keep a separate record of which valve is which. Do you have any solution for this problem?

Cheers, Jan
Jason Mayes
# Jason Mayes
Pepijn,

I originally used v14, but I just tried opening the project with Update 2 and do not have any issues. I am able to recreate it, with no issues, using the method at this link: https://www.dmcinfo.com/latest-thinking/blog/id/9136/linking-plc-udt-tags-to-hmi-faceplates-and-pop-ups-in-tia-portal-v13-sp1

As a starting point, try dragging and dropping one element of your array from the PLC DB to the HMI Tag list. Then, in the tag properties under "Address", change the selection for Index Tag to HMI_Tag. Now you can choose an index tag to multiplex the array on the PLC. Hope this helps!
pepijn
# pepijn
Hello Jason,

Today I installed TIA Portal V14 Update 2.

I have tried to create indexed valves, but at the adress field I get the message "User data types are not permitted"

Can you tell me which vesion you have used for this topic.

Thanks
Olgierd
# Olgierd
I didn't realize that there's need of adding UDT to the library in order to use it in WinCC faceplate. have Thanks for pointing it out - I've learned something new. Also it seems that in V14 limits can be set for the UDT elements (per tag). It is still issue with simple arrays (like array of INTs). Thanks again for explanation.
Jason
Olgierd,

For your first point, I believe that is incorrect. By adding the UDT to the project library as I did in the example above, you can use the UDT as the interface for a Faceplate - so you only need to link a single tag instead of each element. Please see the other post I linked showing you exactly how to do this. On your second point, yes, I can see this being a drawback. However, you can set dynamic limits (linked to another tag). This dynamic limit could easily be linked to another multiplexed tag which gives you limits depending on the index selected. In short, I don't think either of your points being deal breakers.
Olgierd
# Olgierd
There are two major drawbacks to this:

1. Such UDT can't be feed directly to the faceplate (each element must be passed as individual property).
2. Such UDT elements can't have lower/upper limits set neither on tag nor on I/O fields (at least not in WinCC Advanced)
There's work around limits by making separate tag for each of PLC UDT element in HMI and then calling it with same index tag, but then what's the point of UDT?

Olgierd

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts