📖HomeBack It is possible to log your own custom events to the Event Journal and alarms to the alarm list.
Every item in the database has a LogInterfaceEvent method that can be called by a program (ST Logic program, VB Script etc.) The LogInterfaceEvent method logs a custom event, with a special category, to the Event Journal and has 3 parameters:
The timestamp for the event.
The severity for the event, range 1 to 1000. We recommend that you use a value that corresponds with one of the severities that are configured on your system (see the Database Configuration\Severities section on the Server Configuration Tool). For example, with the default settings in place, you could enter 667 for the High severity.
A string value that defines the message for the event. This is the message that will be shown in the Event List.
So, the following code (taken from an ST program), logs a High severity event for the item called 'Outstation1' (where 667 is the low boundary for the High severity range). The event is logged for 15.25.56 on February 12th 2007. The message for the event is: Outstation in Normal Mode.
METHOD LogEvent AT %M(.Outstation1.LogInterfaceEvent) : DT, INT, STRING;END_METHODLogEvent (DT#2007-02-12-15:25:56,667,'Outstation in Normal Mode');
There are also methods to find, display, edit and delete these custom event messages.
The root group (system item) also has a SetInterfaceAlarm method that can be used to generate a custom alarm for a system. As with the LogInterfaceEvent method, the SetInterfaceAlarm method can be called by a program such as an ST program or VBScript. When the SetInterfaceAlarm method is called, a text alarm is generated. This alarm is associated with the system.
The SetInterfaceAlarm method has 4 parameters:
The timestamp for the alarm.
The severity for the alarm, range 1 to 1000.
A string value that describes the origin of the alarm. This is displayed in the Source column of the Alarm Banner.
A string value that defines the message for the alarm. This is the message that will be shown in the Alarm Banner.
The following code (taken from an ST program), generates a Low severity alarm for the system (where 1 is the boundary for the Low severity range). The alarm is generated at 10.04.12 on February 19th 2007, and the source of the alarm (the item to which the alarm relates) is defined as Outstation 2A. Note that this is a string entry and can be any description of the alarm source. The message for the alarm is: Outstation is in Test Mode.
METHOD SetAlarm AT %M($Root.SetInterfaceAlarm) : DT, INT, STRING, STRING;END_METHODSetAlarm (DT#2007-02-19-10:04:12,1,'Outstation 2A','Outstation is in Test Mode');
If Area of Interest is enabled a fifth parameter is used, a string specifying the Area of Interest.
The LogInterfaceEvent and SetInterfaceAlarm methods can be used during outstation testing on a system.
A program is written that sets an outstation into test mode for a specific amount of time, for example, an hour. During that time, only a select group of users will be able to view the Low severity alarms and events for the outstation. Normally, an engineer will set the outstation back to normal mode within the hour, and this allows all users to see all alarms on the outstation again. When the engineer sets the outstation to normal mode, the program calls the LogInterfaceEvent method for the database item that represents the outstation, and the event indicates that the outstation is no longer in test mode.
However, if the engineer forgets to set the outstation to normal mode, the program will call the SetInterfaceAlarm method when the test time period expires. When the SetInterfaceAlarm method is called, an alarm is raised for the system. This alarm indicates that an outstation is in test mode and needs to be set to normal mode.