Recently, I found the need to create customizable text for some alarms in a TIA Portal project. In this particular case, I needed to include the name of the operator that was monitoring the machine for traceability, as well as some specific machine information (process tag value) when the alarm occurred. Knowing this must be possible, I set off to Google, the Siemens forums, and the TIA Portal help files. Surprisingly, I was not able to find very good documentation or examples online. However, the answer turned out to be incredibly simple so I thought it would be worth sharing in case anyone else is ever looking for the same information.
For my example, I will demonstrate on a TP700 Comfort Panel, although the same basic procedure can be used for a Basic Panel or an Advanced Runtime system. To start things off, I've created three internal HMI tags: An alarm word (UInt) for triggering of my example alarm, a string to contain the name of the logged in user, and a real tag for my process value example.
First, I've written a short script to capture the name of the logged in user and created a task to call my script on any user change event. Obviously, this part of the demo is specific to WinCC Comfort or Advanced as the Basic panel will not support scripting, but it will not affect our alarm text demo. Next, I've created several users to allow myself to log in to our example HMI.
Now I've created a single discrete alarm, triggered off of Bit 0 of my alarm word with some simple static text, "Max Speed Limit Exceeded."
Let's pretend for the moment, though, that we would like to include the actual limit in the alarm text for both display and posterity, as well as the operator that forced the system to exceed that limit. If the limit was not configurable, we could hard code it in the message. And if there were only a few users, we could potentially create an alarm for each user. However, if users can be created dynamically and the limit is a configurable parameter, there is no way of creating all of the possible alarm messages that may occur. Luckily, we can create dynamic alarm text.
To create dynamic alarm text, select the alarm from the alarm list and view alarm properties. Now, right-click in the "Alarm Text" field and you will see two options: "Insert tag field..." and "Insert text list field..."
I'm going to use "Tag Field." Notice that when you select it, a dialog will open allowing you to configure the field. In this example, I will use the process value tag I previously created, and configure it to display as a decimal with length three. As you can see, it is also possible to use Text Lists directly within an alarm, which allows you to create even more dynamic alarms.
Next, I added in an additional tag to display the name of the operator.
That's it. Now I'm going to set up a quick example screen with an alarm viewer and controls for setting my process tag and triggering my alarm, as well as displaying the currently logged in user. Now if I trigger my alarm, you can see that my alarm text is dynamically generated.
I hope this is helpful!
Learn more about DMC's PLC Programming services and contact us to get started on your next PLC Programming project.