Open Automation Software
Moving Data From Anywhere to Anywhere
1-303-679-0898

Programming Reference – Web Alarm

Overview and Features

The OAS Web HMI provides a flexible, platform-independent way to integrate with Open Automation Software Servers. The addition of the Alarm Control allows you to retrieve and interact with real time and historical alarms from the OPC Server. Included in this release are:

  • A configuration interface for specifying Alarms to monitor and be displayed
  • A client-side Javascript API for interacting with Alarm data and extending functionality

Requirements

OAS Web HMI Alarm Control requires the following:

  • an instance of anOpen Automation Software Serveraccessible over an internal or external network
  • working knowledge of HTML
  • working knowledge of Javascript
  • working knowledge of OAS Web HMI configuration

Installation and Configuration

Configuration of OAS Web HMI will not be covered in this document. Once you have a working installation of OAS Web HMI, adding Alarm Control configuration is fairly simple. As with OAS Web HMI, the following are required for Alarm Control operation:

  • jQuery v1.8.3 or later, found at jquery.com and is also distributed with the Web HMI product
  • The OAS Web HMI Script Library
  • The OAS Web HMI Stylesheet, which is used for styling modal dialogs and can be modified to fit your web design
  • A small block of Javascript containing an authentication token and URL location of the Open Automation Software Server
  • The OAS Web Alarm Stylesheet, which is used for styling alarm colors and fonts to fit your web design
  • DataTables jQuery plugin, included with the Web HMI distribution
  • FontAwesome web font, included with the Web HMI distribution, and used for high quality inline icons

The following is an example of a properly configured, minimal HTML page:

Of course, this example does not contain any bindings to OPC Server Tags, but contains all elements necessary to connect to a server located at http://localhost:58725 using an authentication token of 7e61b230-481d-4551-b24b-ba9046e3d8f2.

Alarm Control description and options

After defining the Alarm Control bindings, or Alarm Bindings, the OAS Web HMI library will continually poll the server for realtime data, or Historical Data, depending on the context.

The Javascript OPC_config variable contains several options for determining the behavior of the Script Library. This variable is a standard JSON construct. The minimal definition with defaults displayed is:

To add Alarm Bindings to this configuration, you will add the following node to your OPC_config construct. The alarm_bindings node is an array of Alarm Binding objects, each representing data to be displayed in a single table.

  • alarmid: string
    A unique identifier for the alarm which is used to bind to an HTML element of the same id. When the page is rendered, the script library will fill the designated element with the alarm control.
  • callback: function(ab, data)
    This optional callback will be executed after each call to the server, passing in a reference to the Alarm Binding object, and the raw data returned by the server.
  • rowClickCallback: function(data)
    This optional callback will be executed after a row in the alarm control is clicked, passing in the data for the selected row.
  • showDelete: bool
    If set to true, a delete icon will be displayed on each alarm row. Clicking the icon will cause the alarm to be deleted on the server and in the web interface. If the current user does not have rights to delete the alarm, this icon will be displayed in a disabled state. The showDelete option defaults to true if omitted.
  • showHistory: bool
    If set to true, fields will be displayed in the header of the alarm control allowing users to select a date range to display historical alarms. The showHistory option defaults to false if omitted.
  • dateTimeFormat: string
    Format for the alarm date and time

yyyy : 4-digit year

yy: 2-digit year

mm: 2-digit month

dd: 2-digit day

hh: hours (12)

HH: hours (24)

MM: minutes

ss: seconds

aa: am/pm.

  • showComment: bool
    If set to true, a comment icon will be displayed on each alarm row. Clicking the icon will allow users to add a comment to the alarm. If the current user does not have rights to comment on the alarm, this icon will be displayed in a disabled state. The showComment option defaults to true if omitted.
  • showSearch: bool
    If set to true, a search field will be displayed in the header of the alarm control allowing users to quickly filter alarms by any free text. The showSearch option defaults to true if omitted.
  • showInfo: bool
    If set to true, a brief summary will be displayed in the footer of the alarm control, describing the number of records being displayed. The showInfo option defaults to true if omitted.
  • pagination: bool
    If set to true, alarms will be paginated within the view based on the number of alarms allowed per page (defaults to 10). The pagination option defaults to true if omitted.
  • pageLength: number
    This optional value determines the maximum number of alarms to display on each page. This setting defaults to 10 and has no effect if pagination is disabled.
  • height: number
    This optional value indicates the fixed height in pixels that the alarm control will be rendered. If alarms exceed the rendered height, they will be scrollable within the alarm control window. If the height setting is omitted, the alarm control will expand to fit the number of controls it contains.
  • filter: object
    This filter object partially determines which alarms are pulled from the server to be displayed. If the filter object is omitted, the default setting are as follows:

  • networkNodes: array of strings
    This optional value will pull alarms for specific network nodes. If omitted, it will pull only alarms for the Open Automation Software Server to which the client is connected, or effectively ‘localhost’.
  • columns: array of column objects
    By default, the alarm control will display the following columns in the following order:

    • Alarm Date/Time
    • Active
    • Alarm Value
    • Text
    • Alarm Type
    • Group
    • Priority
    • Document

If you would like to alter the order, hide any of these columns, or include others, you will need to include a full definition and settings for all data fields exposed by the alarm interface. The default array is as follows:

  • name: string : the unique column identifier. These must be written as is, since each column name corresponds to an alarm field.
  • text: string: the column header label.
  • type: string: string|datetime : determines how the field is rendered.
  • visible: bool: determines if the column is rendered. All columns must be defined, but not all columns must be displayed.
  • width: string: optional pixel width for the column written in the format ’00px’. By default the column will expand to fit.
  • align: string: left|right|center : optional text alignment, defaults to left
  • searchable: bool: values included when using the inline search box, defaults to true.
  • sortable: bool: allows the user to sort all alarms by clicking the column header, defaults to true.

grouping: bool
Enable or disable grouping by alarms. You must also supply a list of columns used for grouping alarms in the groupingColumns property.

groupingColumns: string
A comma-delimited list of columns used for grouping alarms. The order in which the columns are listed will be the order in which they will be grouped. Also, columns listed in the groupingColumns will not be displayed in alarm table columns.

Acknowledging Alarms

While the alarm control is active, users can acknowledge alarms by double-clicking an alarm row. Once acknowledged, the alarm will change appearance based on the configured styling.

Styling the Alarm Control

The alarm control is styled with an external stylesheet. This stylesheet is included with the distribution and can be seen in the example. If you are comfortable manipulating CSS for styling your web applications, altering these styles is fairly straightforward.

With this stylesheet, you will be able to set the colors, fonts, backgrounds and more for each type of alarm as well as their current state, and combinations thereof.

Miscellaneous

OPC.init()

Use OPC.init() after making any changes to OPC_config. For example, when altering any alarm features, you can then call OPC.init() to force the OPC_config to reload with the new settings.