Creating Alarm Type Custom Functions

Alarm expressions can be complex. You can create alarm type functions to store complex expressions for reuse within the expression editor. Hyper Alarm Server supports two custom function types that differ in how the function is implemented—you can define by expression text or invoke custom .NET Framework code. This procedure also includes adding a folder and subfolder for those defined functions and is recommended when creating multiple-type functions.

Creating an alarm type function:

  1. From Workbench Project Explorer, select the Alarms and Notifications > Hyper Alarm Server > Type Functions.
  2. Right-click on Type Functions and select Add Type Folder to create a parent folder.

    Give the parent folder a unique name that helps identify any configured function within subfolders.

    1. Type the parent folder name in the Name text box.
    2. (Recommended) Describe the alarm type function in the Description text box.
    3. Click Apply.
  3. Right-click the parent folder and select Add Type Function to create a subfolder to store the alarm logic.
    1. Type a unique name for the subfolder function. The assigned name becomes the expression identifier.
  4. Complete the General tab information. ClosedView functions
    • Enable. Select the checkbox to activate the function.
    • (Optional) Description. Describe the function (informational only.)
    • Result Description, Remark Description, and Short Description. Type a brief description in the text boxes. This information is available in the calculation function menu and appears as function tooltips.
    • Returned Type. Select the data type value from the drop-down box, and then select one of the following checkboxes:
      • Is Array gets combined with the Returned Type specifying the value of the returned function. This combo function evaluation will fail if the returned value cannot be converted. The only exception is if the Return Type data type selection is Void.
      • Dynamic Params allow the function to accept any number of input parameters to get passed as an array for the specified parameter data types. The dynamic parameter data type always takes from the last configured function parameter.
      • Dispatch Value Status automatically dispatches the worst value quality of an input parameter to return the function value. For example, when an input parameter has an Uncertain value quality, the returned function value quality can only be Uncertain or Bad.
  5. Click the Parameters tab to configure parameters functions. ClosedView steps
    1. Click the Add button in the left pane to create a new parameter.
    2. Type the new parameter identifier in the Name text box.
    3. (Optional) Type the parameter function in the Description text box. Information entered becomes a tooltip in the Expression Editor.
    4. Select the Parameter Type from the drop-down menu and select the appropriate checkboxes.
      • Is Array gets combined with the Returned Type to specify the parameter value type.
      • Allow Bad Quality indicates bad quality parameter values get passed to the expression for further processing. If the checkbox remains clear (default state), the function fails before being evaluated by the function evaluator.
      • Optional indicates that the parameter is optional, and the Default Value needs to be defined based on the parameter type selection.
    5. Click Apply.
  6. Click the Expression tab to define the expression for the designated function type. Expressions differ depending on the function type. For example, you can use expression functions and .Net framework functions.
  7. When finished, click Apply or Apply & Close.

Once the Type Function is configured, the unique function name appears in the expression editor and becomes available to use for each alarm type. ClosedView image

The configuration of a expression-based custom functions is similar to the standard alarm type expressions. Unlike expressions used when adding an new alarm type, the custom function uses the configured input parameters. A list of available parameters appears on the left-hand expression pane. Double-click the parameter to insert into expression text area. ClosedView image

To prevent circular function references, the evaluation engine limits the maximum number of nested functions calls to 20.