WinCC Unified UDInt to DWord for alarm config

Thomas4598

Member
Join Date
Jun 2023
Location
BanskaBystrica
Posts
2
Hello,

I am provided with PLC tags with PLC_UDT datatype via symbolic connection.

The structure of PLC_UDT (DI_hmi) is:
DI_hmi.stat (UDINT),
DI_hmi.alm (UDINT),
DI_hmi.cmd (UDINT)

I have to configure discrete alarms, however discrete alarms can be triggered by bits in DWORD only.

Is there easy way to convert DI_hmi.alm (UDINT) from plc connection to DWORD?
 
Hello,

I am provided with PLC tags with PLC_UDT datatype via symbolic connection.

The structure of PLC_UDT (DI_hmi) is:
DI_hmi.stat (UDINT),
DI_hmi.alm (UDINT),
DI_hmi.cmd (UDINT)

I have to configure discrete alarms, however discrete alarms can be triggered by bits in DWORD only.

Is there easy way to convert DI_hmi.alm (UDINT) from plc connection to DWORD?


Can you ask the PLC programmer to change the data type?
 
Then I guess if you want to do it in the HMI you'd have to write a script to copy the data from the UDINT PLC tag to a DWORD internal tag. Set up a Scheduled Task with a trigger of the alarm word. Downside is you need to do it for all of them.


Could be simpler to configure if you add a DI_HMI.alm2 tag, or similar, in the PLC, if there are many FB instances doing all the processing for you. Downside is that involves reinitializing all the instances.
 
WinCC Unified: Convert DINT to DWORD

Hi,

A customer of mine selected a Siemens WinCC Unified RT (PC) with a Rockwell 5380 processor. I can understand your issue. Siemens discrete alarm only works with BOOL or WORD/DWORD (ANY_BIT data type).

My Rockwell PLC programs publishes faults as DINT (32 faults).
Since WORD/DWORD does not exists (as a native type) either faults are publish as BOOL or the WinCC unified converts them.

As indicated by mk42, a scheduled task is a good start. Each DINT needs a scheduled task (tag changed). I don't see that as an issue; it's fast to setup and there are no WinCC Unified performance issues.

Alarm/Fault have a very slow hit rate and depending on the machine size, 10 DINT would give 320 faults.

As you mentionned, the problem is how to convert DINT to DWORD on WinCC Unified? There are no WinCC helper function and, as far as I know, JS will not be of any help.

Solution: On PLC tag change (DINT), bit shift the DINT and Set/Reset a mirror target DWORD.

Here are the steps:
1- Add the same number of DWORD internal tags (a DWORD for each DINT, 1:1).

2- Create a Global script (DINT_TO_DWORD) with the following code:

export function DINT_TO_DWORD(dintValue, tagNameToWrite) {
/*
Set DWORD tag bit that mirrors the DINT bit field values
Useful to set alarms according to a DINT tag (typ. for Rockwell processor)
param:
dintValue : tag value to parse
tagNameToWrite : string name of the tag to be written to (typ. DWORD tag)
*/
let tag = Tags(tagNameToWrite);
for (let i = 0; i < 32; i++) {
let value = dintValue >> i & 0x0001;
if (value != 0)
tag.SetBit(i);
else
tag.ResetBit(i);
}
}

3- Setup a Task Schedule for each DINT (PLC tags).
For each task, set in the "Events/Update" a call to the DINT_TO_DWORD global script.

Ex. GlobalModule.DINT_TO_DWORD
dintValue: CONTROLLERTAGS\Cell\fault // DINT, PLC Tag
tagNameToWrite: cellFault // DWORD, alarm tag name

4- Setup discrete alarms in WinCC Unified using the mirror DWORDs.

Voilà.
 

Similar Topics

Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
52
Does anyone happen to know how to install the graphic picture in HMI when I go into blower selection there are no graphics shown not only blower...
Replies
1
Views
73
I have created a project in TIA Portal v16 Upd6 with S7-1200 (6ES7214-1AG40-0XB0) and WinCC Unified (PC station). The communication between the...
Replies
4
Views
147
I am creating a project with WinCC Unified v16 Upd6 (PC runtime) with an S7-1200. The communication is good between the PC and the PLC as I can...
Replies
6
Views
205
I was looking for this function, so that i doesn´t need to do it in the PLC. If there are an alarm in the alarm list, i want to flash the...
Replies
2
Views
537
Back
Top Bottom