get_ranges()
Return the Border, Alarm1, and Alarm2 range settings for a PATROL parameter.
Syntax
Parameter
Parameter | Definition |
---|---|
param | name of the PATROL parameter whose Border, Alarm1, and Alarm2 range settings are returned |
enhanced | optional flag that requests additional information When the enhanced parameter is set to 1, theget_ranges() function returns the state associated with the parameter's border and alarm ranges. Currently, the value of 1 for the enhanced parameter is only a place holder and any value is valid, but it is recommended that you use a 1 to specify this parameter to accommodate future enhancements to this function. |
Description
The get_ranges() function returns the current settings of the Border, Alarm1, and Alarm2 ranges for param. The current settings of these alarm ranges are based on one of the following values:
- values set by set_alarm_ranges() function
- the default KM alarm ranges
The get_ranges() function is used in one of the following ways:
- get_ranges( param )--displays the numeric range information. If you do not want the state information, do not specify a second parameter.
- get_ranges( param, 1)--displays the numeric range information and the state associated with the parameter's border and alarm ranges as one of the following:
- OK
- WARN
ALARM
The return value of get_ranges() consists of three lines, each of which defines the range for Border, Alarm1, and Alarm2, respectively. Each line is a space-separated list of six integers and an optional associated state:active minimum maximum trigger occurrences recoveryactions [state]Field
Definition
active
integer state of the range Active flag This corresponds to the Active button on the Border or Alarm dialog. Valid Values
0 parameter inactive
1 parameter activeminimum
integer value of the range minimum This value corresponds to the position of the Minimum slide bar on the Border or Alarm dialog.
maximum
integer value of the alarm range maximum This value corresponds to the position of the Maximum slide bar on the Border or Alarm dialog.
trigger
integer value of the range trigger selection This value corresponds to the Trigger Alarm field on the Border or Alarm dialog.
Valid Values
0 Immediately on alarm
1 After alarm has occurred n times
2 After all recovery actions failoccurrences
integer value of the range n occurrences This value corresponds to the position of the ntimes slide bar and is only valid when trigger = 1 (after alarm has occurred n times).
Valid Values
0 - 99recovery-actions
integer count of the number of recovery actions defined for the range This value corresponds to the number of entries in the List of Recovery Actions for the range.
state
the state associated with the border or alarm range This value is only displayed when the state parameter is specified for the get_ranges() function.
Valid Values
- OK
- WARN
- ALARM
Example
The following example uses the get_ranges() function to return the ranges of a parameter (A user-defined function PrintRangeInfo() is called to print the returned alarm range information.):
local is_active,minimum,maximum,trigger,occurences,
recovery_actions;
print("Range information for ",name,".\n");
is_active = ntharg(range,"1");
minimum = ntharg(range,"2");
maximum = ntharg(range,"3");
trigger = ntharg(range,"4");
occurences = ntharg(range,"5");
recovery_actions = ntharg(range,"6");
if (is_active) {
print("Alarm is active.\n");
} else {
print("Alarm is not active.\n");
}
print("Lower value is ",minimum,".\n");
print("Upper value is ",maximum,".\n");
if (trigger == 0) {
print("Alarm will trigger immediately.\n");
} elsif (trigger == 1) {
print("Alarm will trigger after ",occurences,"
occurences.\n");
} elsif (trigger == 2) {
print("Alarm will trigger after all recovery actions fail.\n");
}
print("There are ",recovery_actions," recovery actions.\n");
}
function main() {
ranges = get_ranges("/MEMORY/MEMORY/MEMPageOut");
border = nthlinef(ranges,"1");
alarm1 = nthlinef(ranges,"2");
alarm2 = nthlinef(ranges,"3");
PrintRangeInfo("Border Alarm",border);
PrintRangeInfo("Alarm One", alarm1);
PrintRangeInfo("Alarm Two", alarm2);
}