AlarmGenerate (statement)

About this task

Syntax AlarmGenerate Project$ , AlarmId$ , ResourceId$ , Message$, [ , UserId$ [ , RefId$ [ , Master]]]
Description To generate an alarm on a local or remote CIMPLICITY project.
Parameter Description
Project$ String. The project to generate the alarm on. An empty string "" indicates the current project.
AlarmId$ String. The ID of the Alarm. Must be a valid alarm of type $CIMBASIC.
ResourceId$ String. The Resource ID to generate the alarm against. Used to control routing of the alarm.
Message$ String. The update alarm message to display.

Note: This string is substituted into the first variable field of the Alarm's message. For a user-defined alarm message, this will be the first %s field in the message. For a point alarm message, it will be the first variable field (%VAL, %ID, etc.) in the alarm message. For this reason, it is not recommended that you use the AlarmMessage$ field when updating point alarms.

UserId$ String (optional). The User ID that generated the alarm.
RefId$ String (optional). A Reference ID used to distinguish identical alarms.
Master BOOLEAN (optional). By default on a computer with Server Redundancy, alarms sent by the standby computer's Event Manager are ignored. To allow an alarm to be generated from a script on a standby computer, set Master to True.
Alarm Message Length

Important: The following use of AlarmGenerate requires extra configuration for projects created before CIMPLICITY version 6.1.

An alarm is triggered from a BCE script using AlarmGenerate. The alarm is a $CIMBASIC type. The alarm message contains 80 characters. Example:

Sub Main()
 AlarmGenerate "TEST_AMV","TEST_AMV_ALARM_SCRIPT","$SYSTEM","123456789012345678
90123456789012345678901234567890123456789012345678901234567890"
End Sub

For projects created before CIMPLICITY version 6.1:

Problem

If BASIC generates an alarm that is greater than 72 characters to a project that does not have the following solution: The project will log an error indicating there were too many fields. The alarm will be displayed with 72 characters.

Solution

Allow 80 characters in a BASIC alarm message. Idtpop the alarm_field record. Edit the alarm_field.idt file. Change the field_len to 80 in the $CIMBASIC record. For projects created in CIMPLICITY version 6.1 and later 80 characters are supported automatically.

Example
sub main()
   ' Generate a single alarm with no reference Id.
   AlarmGenerate "BCEDEMO","MY_ALARM_1","$SYSTEM",_
                 "Electrical Bus 1 Failure"
   ' Generate three of the same alarm for different resources.
   AlarmGenerate "BCEDEMO","MY_ALARM_2","RESOURCE_1",_
                "Multiple Instance for each resource"
   AlarmGenerate "BCEDEMO","MY_ALARM_2","RESOURCE_2",_
                "Multiple Instance for each resource"
   AlarmGenerate "BCEDEMO","MY_ALARM_2","RESOURCE_3",_
                "Multiple Instance for each resource"
   ' Generate three of the same alarm for the same resource
   ' but use a different reference id.
   AlarmGenerate "BCEDEMO","MY_ALARM_3","RESOURCE_1",_
                "Multiple Instances for RefId","","1"
   AlarmGenerate "BCEDEMO","MY_ALARM_3","RESOURCE_1",_
                "Multiple Instances for RefId","","2"
   AlarmGenerate "BCEDEMO","MY_ALARM_3","RESOURCE_1",_
                "Multiple Instances for RefId","","3"
end sub
See Also AlarmUpdate (statement)
Notes The Alarm ID must have an Alarm Type of $CIMBASIC otherwise the alarm message may not be displayed correctly.

A unique alarm in CIMPLICITY is defined by the Alarm ID, Resource ID and Reference ID combination. Each unique alarm can be displayed as a distinct entry in the Alarm Viewer. Non-unique alarms are stacked, so that the user only sees the most recent occurrence. In general, the Resource ID is used to control the routing of alarms to users. The Reference ID is used by an application to distinguish between different instances of the same alarm.

Guidelines for AlarmGenerateEx (statement) also apply to AlarmGenerate.