How to create instance specific alarms inside a function block

0
I am trying to create alarms from inside a function block. I am using 2504.2.0   First, I need to know the instance name of the FB inside the FB, to be able to distinguish from which instance the alarm is raised. Is the best solution (workaround) to pass the name as VAR_INPUT like:   VAR_INPUT         instanceNumber : UINT; // Use an UINT, because strings cannot be passed as Associated values END_VAR   ? Or is there a better solution? Is it true that strings cannot be used as Associated values yet?   Second, inside the FB I have to pass the instanceNumber to the alarm using associated values:   USING Siemens.Simatic.S71500.Alarming; // ...     VAR_OUTPUT         {S7.Alarm = WithAck, "Timeout error for valve: @1%u@"}         alarmTimeout: ProgramAlarm;     END_VAR // ... {S7.extern=ReadWrite} FUNCTION_BLOCK Valve // ...     IF outputs.errorTimeout THEN         alarmTimeout(SIG := TRUE, SD_1 := pass(instanceNumber));     ELSE         alarmTimeout(SIG := FALSE, SD_1 := pass(instanceNumber));     END_IF; END_FUNCTION_BLOCK   The alarms are generated, but the Associated values are not handled correctly. The alarm text shown in the OPC UA Client is simply: Timeout error for valve: @1%u@   Am I doing something wrong?    
asked
4 answers
2

Hi Klaus,

you are not doing something wrong, but seeing the associated values in UaExpert takes a couple of additional steps.

There is a helpful section in the TIA documentation about this: AssocValues in UaExpert

 

In the "Event View" tab of UaExpert, you need select and apply the "SimaticEventType"

SimaticEventType.png

You can than see the passed associated value in the "Details" view when selecting the raised alarm:

Details.png

 

These additional steps to see the value are not necessary when using the SIMATIC Webserver or the SIMATIC AX PLC Control Tool to read the alarm message. There, your passed instance number should be visible without further action:

PlcControlToolAlarm.png

 

To your other questions:

Yes, currently Strings are not supported as Associated Values (AX Documentation)

GetInstanceName is also not yet available as a system function in SIMATIC AX LC.

answered
0

Thx Christof ... 

 

yeah, that's right.

For further clarification : 

 

Unfortunately, the full-text alarming capabilities of the S7-1500 PLC do not send out alarm texts with the placeholders already populated by their associated values from the alarm declaration. This behavior is by design.

However, appropriate Siemens alarm clients will conveniently handle this within their client functionality after receiving the alarm. Examples include the Alarm Viewer in Unified RT, the Alarm View in TIA Portal, the PLC control tool for receiving alarms in AX, or simply the web server, as previously mentioned.

 

What you see in UaExpert is the unedited/uncensored alarm information that a client will receive.

answered
0

Thx, I can see the additional values in the UA expert.

 

I thought the S7 sends full text alarms, but that does not seem to be the case. So the client has to do the formatting on its own.

 

Is there a way to tell the OPC server to do the formatting on its own, and to send "ready-made" texts to the alarm client?

answered
0

Sorry Stefan, I did not see your answer before I wrote mine, so I think you have already answered my questions ...

answered