The following system blocks are available for working with alarms:
b READ_SI Read system resources (SFC 105) b DEL_SI Delete system resources (SFC 106)
b ALARM_SC Determine acknowledgment status (SFC 19) b DIS_MSG Disable PLC alarms (SFC 10)
b EN_MSG Enable PLC alarms (SFC 9) b AR_SEND Send archive data (SFB 37)
Fig. 5.44 shows the graphic representation of the block calls.
Handling of system resources
If the message blocks are deleted or reloaded (“overloaded”) during operation, it is possible that the occupied system resources will remain occupied. These occupied system resources are only released by a cold restart or a warm restart. If you use the message blocks ALARM_D and ALARM_DQ, you can manage the system resources with READ_SI and DEL_SI.
READ_SI reads the system resources of the ALARM_D and ALARM_DQ alarms. You set the operating mode of READ_SI at the MODE parameter (Table 5.13). Depending on the operating mode, you assign zero, the alarm number, or the group ID CMP_ID Fig. 5.44 Blocks for working with alarms
READ_SI
AR_SEND DEL_SI
DIS_MSG
Instance data ALARM_SC
EN_MSG SFC 105
Read system resources
SFB 37
Send archive data SFC 106
Delete system resources
SFC 10
Disable PLC alarms
SFC 19 Determine
acknowledgment status
SFC 9
Enable PLC alarms Blocks for working with alarms
SI_ID
R ID AR_ID SD_1 LEN MODE
REQ SI_ID
MODE MESGN
MODE
REQ
EV_ID
REQ MODE MESGN
RET_VAL
RET_VAL
STATE
BUSY
Q_STATE N_SI
ERROR RET_VAL
DONE RET_VAL
RET_VAL BUSY SYS_INST
STATUS
to the parameter SI_ID. The RET_VAL parameter contains the error detection. The number of output system resources is displayed at parameter N_SI. The destination area for the output system resources is located in a data block and is defined at parameter SYS_INST with an ANY pointer. A system resource has the data structure specified in Table 5.14.
DEL_SI deletes the system resources of the ALARM_D and ALARM_DQ alarms. You set the operating mode at the MODE parameter (Table 5.13). Depending on the op- erating mode, you assign zero, the alarm number, or the group ID CMP_ID to the parameter SI_ID. The RET_VAL parameter contains the error detection.
Determine acknowledgment status
ALARM_SC determines the signal state of the alarm-triggering signal at parameter SIG of the message block and, if it is a message block ALARM_SQ or ALARM_DQ, the acknowledgement status of the “incoming” alarm.
Assign the alarm number to the parameter EV_ID.
Table 5.13 Operating modes of READ_SI and DEL_SI Block MODE Description of the operating mode
READ_SI 1 All occupied system resources are read. The parameter SI_ID is occupied with zero.
2 The system resource whose alarm number is specified at parameter SI_ID is read.
3 All of the system resources whose assignment of the parameter CMP_ID (group ID) agrees with the assignment at parameter SI_ID are read.
0 Additional system resources which could not be read during preceding calls because the destination area was too small are read.
DEL_SI 1 All system resources are deleted. The parameter SI_ID is occupied with zero.
2 The system resource whose alarm number is specified at parameter SI_ID is deleted.
3 All of the system resources whose assignment of the parameter CMP_ID (group ID) agrees with the assignment at parameter SI_ID are deleted.
Table 5.14 Data structure of a system resource of ALARM_D or ALARM_DQ Name of the component Data type Description
SFC_NO WORD SFC number of the message block
LEN BYTE Length of the structure in bytes: B#16#0C
SIG_STAT BOOL Signal state of the alarm-triggering signal
ACK_STAT BOOL Acknowledgement status of the incoming alarm event
EV_ID DWORD Alarm number
CMP_ID DWORD Group identification
The RET_VAL parameter contains the error information. The status of the alarm- triggering signal at the last call of the message block is output at the parameter STATE. At the parameter Q_STATE, the acknowledgement status of the last “incom- ing” alarm is output (“0” = not acknowledged, “1” = acknowledged) or, if it is a mes- sage block ALARM_S or ALARM_D, the signal state “1”.
Disabling and enabling alarms
DIS_MSG disables block-related alarms which are generated with the message blocks with instance data. Alarms that are already being processed are still sent. Active dis- abling is indicated at the STATUS parameter of the message blocks NOTIFY, NOTI- FY_8P, ALARM, ALARM_8, and ALARM_8P. You set the operating mode at the MODE parameter: The values 0 and 1 block all alarms. The value 6 blocks an individual alarm whose alarm number is displayed at parameter MESGN. Disabling is started if the signal state at parameter REQ is “1”. If parameter BUSY has signal state “0” again, the execution of the disabling is completed. The RET_VAL parameter contains the er- ror information.
EN_MSG clears the disabling of the alarms that was activated with DIS_MSG. You set the operating mode at the MODE parameter: The values 0 and 1 enable all alarms.
The value 6 enables an individual alarm whose alarm number is specified at param- eter MESGN.
Enabling is started if the signal state at parameter REQ is “1”. If parameter BUSY has signal state “0” again, the execution of the enabling is completed. The RET_VAL pa- rameter contains the error information.
Send archive data
AR_SEND sends archive data to an HMI station that is registered for this. The ar- chive number and the structure of the archive data are defined by the HMI station used. Figure 5.44 on page 246 shows the graphic representation of the block call.
You program AR_SEND as local instance in a function block. You can define an input parameter of this function block as an archive number with the data type C_AR_SEND, which you select from the drop-down menu. You provide the parame- ter AR_ID from AR_SEND with this input parameter.
The parameter ID contains the data channel for the alarms; it is occupied with the constant W#16#EEEE. An ANY pointer to the archive data to be sent is created at the SD_1 parameter. The length of the data to be sent is not determined by this ANY pointer but by the specification at parameter LEN.
The send procedure starts with a rising edge at parameter REQ. If the parameter DONE has signal state “1”, the send procedure is completed. The ERROR and STATUS parameters provide information on an error that occurred. The send procedure is canceled with a rising edge at parameter R.