Alarm and Event Calculations
About Alarm and Event Calculations
When building calculation formulas using the wizard, you have the option of selecting Insert an Alarm Calculation
as one of your function types. This function type incorporates a wide range of alarm and event operations, which allows you to add and update alarms and alarm properties.
Alarm Object
Unlike other functions in the calculation collector, the alarm functions make use of an alarm object to store information about alarm and event data. This object makes use of an alarm class, which contains all the information Historian needs to work with alarm and event data.
All operations for alarm and event calculations are performed on an alarm object. In the examples in this topic and related topics, the name AlarmObj
is used to signify the object. This name can be changed to suit your needs.
Creating an Alarm Object
Set AlarmObj = new Alarm
Alarm Object Properties
The following table describes the alarm object's common properties. These properties are available in the wizard when you select the Get Alarm Property or Set Alarm Property functions. Not all alarm and event servers follow the naming convention in the following table. In this instance, Historian will map the Historian alarm and event properties to the properties given by the alarm and event server.
Alarm Property | Description |
---|---|
Acked |
Acknowledgement status of the alarm. |
AckTime |
If the alarm has been acknowledged, this property will store the timestamp of the acknowledgement. |
Actor |
If the alarm has been acknowledged, or is a tracking event, the operator involved in the change of state will be recorded here. |
AlarmType |
Records the type of alarm or event as an integer. The integers map to the following values:
|
ConditionName |
Records the alarm's condition. |
DataSourceName |
Records the data source name of the alarm or event. |
Enabled |
Reserved for future use. |
EndTime |
Records the end time of the alarm. |
EventCategory |
Records the event category. |
Message |
Records the event's message. |
Quality |
Records the event's severity. |
Severity |
Records the event's severity. |
Source |
Record the event's source. |
StartTime |
Records the start time of the alarm or event. |
SubConditionName |
If the alarm contains a subcondition, it will be recorded in this property. |
Tag |
The data tag this alarm is associated with. |
Timestamp |
The timestamp of this specific event. |
VendorAttribute |
Additional vendor attributes. Additional attributes can be found by selecting the If you are entering your calculation function manually, you can use the GetVendorAttribute method to retrieve a vendor attribute. Refer to Alarm Methods and Functions for more information. |
Retrieve and Set Alarm Attributes
Retrieve Alarm Attributes
Set Alarm Attributes
Alarm Methods and Functions
Two methods are available for adding alarm and event functions and methods to the Historian calculation collector. In most cases, the calculation wizard will contain the function you need to build your alarm and event calculations. However, you may need to manually enter a function or method in the calculation pane.
You can add the following alarm and event functions to Historian calculation collector using the calculation wizard, or by entering them manually in the calculation pane:
- New Alarm
- Previous Alarm
- Next Alarm
- Get Alarm Property
- Add Event
- Set Alarm Property
- Update Alarm
- Return to Normal
New Alarm Function
The New Alarm
function will add a new alarm to the Historian archive. It will take the inputs shown in the following table.
Input | Description |
---|---|
Source | Specifies the source for the alarm. |
Condition | Specifies the alarm's condition. |
Tag Name | Specifies the tag name for the alarm. Note: If you want the new alarm to be associated with the tag passed in, ensure you have first added the tag to Historian.
|
Timestamp | Specifies a timestamp for the alarm. |
SubCondition | Specifies a sub-condition for the alarm. |
Event Category | Specifies an event category for the alarm. |
Message | Specifies a message for the alarm. |
Severity | Specifies a severity for the alarm. |
Previous Alarm Function
The Previous Alarm
function will return the previous alarm for a tag on, or before, a given timestamp. It will take the inputs shown in the following table.
Input | Description |
---|---|
Input Type | Specifies whether to manually input properties, or draw them from an existing alarm object. If Use Alarm Object Data is selected, the Source/Tag Name, Condition, and Relative Time fields will be disabled. |
Query By | Specifies whether to query by the alarm source or tag name. |
Data Source | Specifies the data source to query by. This is only used if you are querying by source. |
Source/ Tag Name | Specifies the source or tag name to query by. This field will change depending on what is selected in the Query By list box. |
Data Source | Specifies the data source to query by. This field will appear if Data Source is selected in the Query By list box. |
Condition | Specifies a condition to query by. |
Relative Time | Specifies a relative time to query by. |
Next Alarm Function
The Next Alarm
function will return the next alarm for a tag on or after a given time stamp. It will take the inputs shown in the following table.
Input | Description |
---|---|
Input Type | Specifies whether to manually input properties, or draw them from an existing alarm object. If Use Alarm Object Data is selected, the Source/Tag Name, Condition, and Relative Time fields will be disabled. |
Query By | Specifies whether to query by the alarm source or tag name. |
Source/ Tag Name | Specifies the source or tag name to query by. This field will change depending on what is selected in the Query By list box. |
Data Source | Specifies the data source to query by. This field will appear if Data Source is selected in the Query By list box. |
Condition | Specifies a condition to query by. |
Relative Time | Specifies a relative time to query by. |
Get Alarm Property Function
The Get Alarm Property
function will get the value of the selected alarm property.
Input | Description |
---|---|
Property | Specifies a property to get from the alarm object. If VendorAttribute is selected, an additional Attribute list box will appear. |
Attributes | Specifies a vendor attribute to get from the alarm object. This list box is only available if VendorAttribute is selected in the Property list box. |
Add Event Function
The Add Event
function will add an event to the Historian archive. It will take the inputs shown in the following table.
Input | Description |
---|---|
Source | Specifies the source for the event. |
Tag Name | Specifies the tag name for the event. |
Timestamp | Specifies a timestamp for the event. |
Event Category | Specifies an event category for the event. |
Message | Specifies a message for the event. |
Severity | Specifies a severity for the event. |
Set Alarm Property Function
The Set Alarm Property
function will set the value of the selected alarm property. It will take the inputs shown in the following table.
Input | Description |
---|---|
Property | Specifies a property to get from the alarm object. If VendorAttribute is selected, additional list boxes will appear. |
Value | Specifies the property's new value. |
Attribute | Specifies the vendor attribute to set. This list box will appear if you have selected VendorAttribute in the Property list box. |
Value Type | Specifies the data type for the vendor attribute. Valid data types are:
|
Set Alarm Property
function will not automatically save changes to the alarm object. To save changes to the alarm object, you must use the Update Alarm function.Update Alarm Method
The Update Alarm
method updates the current alarm with whatever changes have been made through Set Alarm Property
. It takes the following input.
Input | Description |
---|---|
Timestamp | Specifies a timestamp for the update. |
Return to Normal
Return to Normal
Use the Return To Normal
method to set the end time for the current alarm. It takes the following input:
timestamp