Native Alarm and Event Functions

Important: You do not have the latest version of Historian! You are missing out on the newest capabilities and enhanced security. For information on all the latest features, see the Historian product page. For more information on upgrades, contact your GE Digital sales agent or e-mail GE Digital Sales Support. For the most up-to-date documentation, go here.

About Native Alarm and Event Functions

In addition to using the calculation wizard to create calculation formulas within your calculation tag, you can enter functions manually. The following sections list the functions available, along with their usage.

Retrieving and Setting Alarm Properties Manually

Alarm and event properties can also be set manually in the calculation collector.
  1. To retrieve alarm properties, append the property name to the alarm object, using the following syntax:
    variable = AlarmObj.Property
    Example

    The following example retrieves the alarm's severity and places it in a variable named ALM_Severity.

    ALM_Severity = AlarmObj.Severity
  2. To set alarm properties manually, append the property name to the alarm object and supply a new value for the property using the following syntax:
    AlarmObj.Propertyname = "Property Name"
    Important: The Set Alarm Property function will not save changes to the alarm database. A call to UpdateAlarm must be made after the Set Alarm Property function is called.
    Example
    The following example sets an alarm's severity to 100, then updates the alarm in the Historian archive.
    AlarmObj.Severity = 100
    AlarmObj.UpdateAlarm "Now"
    

Insert Calculation Functions Manually

In addition to using the Calculation Wizard to create your alarm and event calculations, you can also enter them manually. The following functions are available:

  • NextAlarm
  • NextAlarmForTag
  • PreviousAlarm
  • PreviousAlarmForTag
  • AddEvent
  • NewAlarm
  • GetVendorAttribute
  • SetVendorAttribute
  • UpdateAlarm
  • ReturnToNormal

NextAlarm

The NextAlarm function returns the next alarm for a tag or source on or after a given time stamp.

Syntax

set AlarmObj = NextAlarm (source, condition, timestamp)

Example Code

The following example will get the next alarm based on the properties of the current alarm object.

Set AlarmObj = NextAlarm (AlarmObj.Source, AlarmObj.ConditionName, 
DateAdd("s", 1, AlarmObj.Timestamp))

NextAlarmForTag

The NextAlarmForTag function is identical to the NextAlarm function, but takes a tag name as its input instead of a source.

Syntax

Set AlarmObj = NextAlarmForTag (tag name, condition, timestamp)

Example Code

The following example will get the next alarm for the tag SYN4450_Flow with a LevelAlarm condition on or after the current alarm's timestamp.

Set AlarmObj = NextAlarmForTag ("SYN4450_Flow", "LevelAlarm", AlarmObj.Timestamp)

PreviousAlarm

The PreviousAlarm function returns the previous alarm for a tag or source on or before a given timestamp.

Syntax

set AlarmObj = PreviousAlarm (source, condition, timestamp)

Example Code

The following example will get the previous alarm based on the properties of the current alarm object.

Set AlarmObj = NextAlarm (AlarmObj.Source, AlarmObj.ConditionName, AlarmObj.Timestamp)

PreviousAlarmForTag

The PreviousAlarmForTag function is identical to the PreviousAlarm function, but takes a tag name as its input instead of a source.

Syntax

Set AlarmObj = PreviousAlarmForTag (tag name, condition, timestamp)

Example Code

The following example will get the previous alarm for the tag SYN4450_Flow with a LevelAlarm condition on or before the current time.

Set AlarmObj = PreviousAlarmForTag ("SYN4450_Flow", "LevelAlarm", "Now")

AddEvent

The AddEvent method will create a new event with the current alarm properties.

Syntax

AlarmObj.NewAlarm source, tag, time stamp

Example Code

The following example creates a new event for the Simulation00001 tag on Simulation source with a severity of 50, a message of Test Message, and the current time.

Set AlarmObj = new Alarm
AlarmObj.Severity = 50
AlarmObj.Message = "Test Message"
AlarmObj.AddEvent "Simulation", "Simulation00001", "Now"

NewAlarm

The NewAlarm method will create a new alarm, based on the current alarm object properties.

Syntax

AlarmObj.NewAlarm source, condition, tag, time stamp

Example Code

The following example creates a new alarm for the Simulation00001 tag on Simulation source with a severity of 50, a condition of Low Fluid Levels, and the current time.

Set AlarmObj = new Alarm
AlarmObj.Severity = 50
AlarmObj.Message = "SomeMsg"
AlarmObj.NewAlarm "Simulation", "Low Fluid Levels", "Simulation00001", "Now"

NextAlarm

The NextAlarm function returns the next alarm for a tag or source on or after a given time stamp.

Syntax

set AlarmObj = NextAlarm (source, condition, timestamp)

Example Code

The following example will get the next alarm based on the properties of the current alarm object.

Set AlarmObj = NextAlarm (AlarmObj.Source, AlarmObj.ConditionName, 
DateAdd("s", 1, AlarmObj.Timestamp))

GetVendorAttribute

The GetVendorAttribute method will get the value of the given vendor attribute on the current alarm object and place it into a supplied variable.

Syntax

variable = AlarmObj.GetVendorAttribute (Vendor_Attribute)

Example Code

The following example retrieves a vendor attribute called Cause_Comment from the alarm object, and places it into the ALM_Cause_Comment variable.

ALM_Cause_Comment = AlarmObj.GetVendorAttribute ("Cause_Comment")

SetVendorAttribute

The SetVendorAttribute method sets the value of the given vendor attribute on the current alarm object.

Syntax

AlarmObj.SetVendorAttribute Vendor_Attribute, Value

Example Code

The following example sets values for the vendor attributes Cause_Comment and Status_Code, then updates the alarm in the Historian archive.

AlarmObj.SetVendorAttribute "Cause_Comment", "This alarm was caused by..." 
AlarmObj.SetVendorAttribute "Status_Code", 5032
AlarmObj.UpdateAlarm "Now"
Important: The SetVendorAttribute method will not save changes to the alarm database. A call to UpdateAlarm must be made after the SetVendorAttribute method is set.

UpdateAlarm

The UpdateAlarm function updates the current alarm with whatever changes have been made to an alarm's properties.

Syntax

AlarmObj.UpdateAlarm timestamp

Example Code

AlarmObj.UpdateAlarm "Now"

ReturnToNormal

The ReturnToNormal method sets the end time for the current alarm.

Syntax

AlarmObj.ReturnToNormal timestamp

Example Code

The following example sets the end time for the alarm to the current time.

AlarmObj.ReturnToNormal "Now"