Set up alarm receiver
BACnet allows alarm receivers (e.g. the MBE) to register in one or more Notification Class objects in the recipient list (Recipientlist).
If the receivers are already defined at the time of PLC programming, they can also be specified by the PLC program.
Either the Device instance number can be used as a reference to the receiver. In this case TwinCAT resolves the actual address with a Who-Is telegram (the response I-Am of the receiver contains the actual address).
Alternatively, this address can be specified directly in the recipient list, but this option is rarely used in practice.
The following example shows a Notification Class NC1 without receiver specifications (i.e. the receivers register themselves via BACnet). Notification Class 2 contains an example of a receiver referenced by the Device instance number as well as a receiver referenced by the IP address, UDP port and BACnet network number.
The order of the alarm types in the arrays aEventEnable
and aEventMessageTextsConfig
as well as aAckRequired
and aPriority
corresponds to the order in the BACnet standard:
TO_OFFNORMAL: Coming alarm / event
TO_FAULT: Sensor error, encoder malfunction
TO_NORMAL: Return to normal range
Variables
// simple Notification class object with empty recipient list
fbBV1 : FB_BACnet_BV := (
nNotificationClass := 1,
aEventEnable := [TRUE,TRUE,TRUE],
bAlarmValue := TRUE,
aEventMessageTextsConfig := [ 'ALARM', 'FAULT', 'NORMAL' ]
);
fbNC01_Standard : FB_BACnet_NC := (
nObjectInstance := 1,
nNotificationClass := 1,
sDescription := 'NC01 Standard',
aAckRequired := [ TRUE, TRUE, FALSE ],
aPriority := [ 10, 11, 12 ]
);
// Notification class object with pre-defined recipient (Notification Sink module)
fbBV2 : FB_BACnet_BV := (
nNotificationClass := 2,
aEventEnable := [TRUE,TRUE,TRUE],
bAlarmValue := TRUE
);
fbNC02_Recipient : FB_BACnet_NC := (
nObjectInstance := 2,
nNotificationClass := 2,
sDescription := 'NC02 RecipientTest',
aAckRequired := [ TRUE, TRUE, TRUE ],
aPriority := [ 224, 223, 222 ],
aRecipientList := [
(
stValidDays := (bMonday:=TRUE, bTuesday:=TRUE, bWednesday:=TRUE, bThursday:=TRUE, bFriday:=TRUE),
stFromTime := F_BA_ToSTTime(T#0H),
stToTime := F_BA_ToSTTime(T#23H59M59S),
stRecipient := F_BACnet_DeviceRecipient(nDeviceInstance:=42),
nProcessId := 10000, // Notification Sink module
bIssueConfirmed := FALSE,
stEventTransitions := (bToOffNormal:=TRUE, bToFault:=TRUE, bToNormal:=TRUE )
),
(
stValidDays := (bSunday:=TRUE, bSaturday:=TRUE),
stFromTime := F_BA_ToSTTime(T#7H),
stToTime := F_BA_ToSTTime(T#15H30M),
stRecipient := F_BACnet_EthernetRecipient(
nIPAddress1:=192,168,10,200,
nPort:=47808,
nNetworkNr:=444
),
nProcessId := 30100,
bIssueConfirmed := TRUE,
stEventTransitions := (bToOffNormal:=TRUE)
)
]
);
Code
fbBV1();
fbNC01_Standard();
fbBV2();
fbNC02_Recipient();