Condition, Logic, and Calculation Nodes

About Condition, Logic, and Calculation Nodes in Family Policies

Condition Nodes

You can use the following nodes to apply a variety of conditions, calculations, and logic to the values represented by Input nodes in the policy model.

Logic Nodes

Calculation Nodes

The following Calculation nodes perform calculations on single values:

The following Calculation nodes perform calculations on a collection of data:

The Baseline Rule node performs calculations based on the corresponding rule.

Add, Subtract, Multiply, Divide, Exponent and Remainder Nodes in Family Policies

The following Calculation nodes represent basic mathematical calculations:

NodeDescription
AddAdds one value to another value.
SubtractSubtracts one value from another value.
MultiplyMultiplies one value by another value.
DivideDivides one value by another value.
ExponentDetermines the number of times a value is multiplied by itself.
RemainderDetermines the remainder after a division operation.

Each math node has two inputs. Input requirements differ depending on the type of math node.

  • Input for Add, Subtract, Multiply, Divide, and Remainder nodes may be numeric values or certain time-based values.
  • Inputs for Exponent nodes must be numeric values.

A math node has only one output. The output of a math node is the result of the mathematical calculation.

Node Properties

The Properties window for each math node contains the items that are described in the following table.

ItemDescriptionNotes
First valueThe first input value that will be used in the calculation.None.
Calculation symbolThe symbol that corresponds with the mathematical calculation that is performed by the node.None.
Second valueThe second input value that will be used in the calculation.None.
Display listDetermines the label that appears on the node in the policy model.This list does not appear if you enter a constant in the corresponding section.

Add Node

The following example illustrates how you can use an Add node to add a constant value to a value that is defined by a predecessor node. Consider the following nodes and connection.

In this example, the Add node adds 1 to the value in the Alert Level field of a Health Indicator record. The following image shows the Properties window for the Add node.

Remainder and Subtract Nodes

Suppose that you want to add reading values to a Health Indicator, but you know that the accuracy of the reading values is +/-10%. Before adding the reading values to a Health Indicator, use a policy to round down the reading values.

Tip: You can use the Round node to round values to the nearest number. This example describes how you can consistently round down to a nearest number.

Consider the following nodes and connections. In the policy shown in the following image, the Remainder node is used in conjunction with a Subtract node to round down to the nearest ten the last reading value associated with a Measurement Location.



The following image shows the Properties window of a Remainder node. You can use the Remainder node to calculate the amount remaining after the Last Reading value is divided by 10. For example, if the last reading value is 87, the result of the remainder node is 7 (87/10=8 with a remainder of 7).

The following image shows the Properties window of a Subtract node. You can then subtract the remainder from the reading value. The result of this calculation is the reading value rounded down to the nearest ten. Continuing with the previous example, the result of this node is 80 (87-7=80).

Finally, the result of the Subtract node (80) is added to a Health Indicator Value record that is linked to a Health Indicator.

How Input Values Correspond to Calculations

The following table illustrates how the input values that you define for each node correspond to the mathematical calculations performed by the node. This table includes the mathematical calculation and output for each type of node when the first input value is 3 and the second input value is 2, as shown in the following image:

Node TypeMathematical CalculationOutput Value
Add3+25
Subtract3-21
Multiply3x26
Divide3/21.5
Exponent3^29
Remainder3%21

Using Time-Based Values

The following tables summarize the possible combinations of time-based input values that you can use with Add, Subtract, Multiply, Divide, and Remainder nodes.

Table 1. Add Node
First Value Second Value Output Example
Time stamp Time span Time stamp 1/11/2000 + 10 Days = 1/21/2000
Time stamp Number Time stamp 1/11/2000 + 10 = 1/21/2000 00:00:10
Time span Time stamp Time stamp 10 Days + 1/11/2000 = 1/21/2000
Time span Time span Time span 12 Days + 10 Days = 22 Days
Time span Number Time span 12 Days + 10 = 12.00:00:10
Number Time stamp Time stamp 10 + 1/11/2000 = 1/21/2000 00:00:10
Number Time span Time span 10 + 12 Days = 12.00:00:10
Time stamp Time stamp Invalid N/A
Table 2. Subtract Node
First Value Second Value Output Example
Time stamp Time span Time stamp 1/11/2000 - 10 Days = 1/1/2000
Time stamp Number Time stamp 1/11/2000 - 10 = 1/10/2000 23:59:50
Time span Time stamp Invalid N/A
Time span Time span Time span 12 Days - 10 Days = 2 Days
Time span Number Time span 12 Days - 10 = 11.23:59:50
Number Time span Time span 10 - 12 Days = 11.23:59:50
Time stamp Time stamp Time span 1/11/2000 - 1/1/2000 = 10 Days
Table 3. Multiply Node
First Value Second Value Output Example
Time span Time span Invalid N/A
Time span Number Time span 10 Days x 5 = 50 Days
Number Time span Time span 5 x 10 Days = 50 Days
Table 4. Divide Node
First ValueSecond ValueOutputExample
Time spanTime spanNumber1 day / 8 hours = 3
Time spanNumberTime span1 day / 2 = 12 hours
Number Time spanInvalidN/A
Table 5. Remainder Node
First ValueSecond ValueOutputExample
Time spanTime spanTime span15 Days % 10 Days = 5 Days
Time spanNumberInvalidN/A
Number Time spanInvalidN/A

And and Or Nodes in Family Policies

And and Or nodes are Logic nodes that you can use in a policy model to specify whether or not policy execution should continue based on the results of the incoming logic paths.

Specifically:

  • The And node evaluates whether or not all incoming logic paths result in a value of true passed to the And node.
  • The Or node evaluates whether or not at least one incoming logic path results in a value of true passed to the Or node.

    Note: Unlike other nodes which require all immediate predecessor nodes to be executed in order for the node to be, the Or node requires only one immediate predecessor node to be executed in order for the Or node to be executed.

In a policy model, Logic nodes must be preceded immediately by comparison or other Logic nodes. A value of true is passed to the Logic node when the logical result of the preceding node matches the logic path configured for the corresponding connection. For example, if the logical result of an immediately preceding condition node is no and the logic path configured for the corresponding connection is no, a value of true is passed to the Logic node.

The output of a Logic node is the logical result of the node. Specifically, when a Logic node is executed:

  • If the Logic node's criteria is met, the output (that is, logical result) of the node will be yes.
  • If the Logic node's criteria is not met, the output (that is, logical result) of the node will be no.

The logical results of Logic nodes are used by connections to successor nodes in order to determine if the successor node will be executed. You can use the Properties window for a connection starting at a Logic node to configure a logic path for the connection. If you do not configure a logic path for a connection, a Yes path is assumed but does not appear on the model. The APM system will execute only the branches of a policy model where the logical result of the Logic node matches the logic path defined for the corresponding connection.

More Information: Logical Results

The following table summarizes what the result of each Logic node will be for various input combinations.

Input A

Input B

And Node Result

Or Node Result

True

True

Yes

Yes

False

False

No

No

True

False

No

Yes

Note: For Or nodes, any input value that is not true is considered false. This means that if a preceding node is not executed or if errors occur during execution, the input from the corresponding path will be false.

And Node

The following example illustrates how you can use the And node to monitor policy execution. To simplify this example, only constant values are used in the policy model. Consider the following nodes and connections, which are shown after validation has been run.

In this example, you can see that each node executed successfully. The logical result of the And node is yes because all incoming logic paths result in a value of true passed to the And node (that is, the logical result of each preceding condition node matches the logic path of the corresponding connection). Therefore, policy execution continues past the And node.

Or Node

The following example illustrates how you can use the Or node to monitor policy execution. To simplify this example, only constant values are used in the policy model. Consider the following nodes and connections, which are shown after validation has been run.

In this example, you can see that each node executed successfully. The logical result of the Or node is yes because the logical result of at least one incoming logic path results in a value of true passed to the Or node (that is, the result of the 5 > 3 Condition node is yes, which matches the logic path of the corresponding connection). Therefore, policy execution continues past the Or node.

Average Nodes in Family Policies

An Average node is a Calculation node that you can use in a policy model to calculate the average value of data in a specified column of a collection.

The input for an Average node must be a collection with a column containing numeric or time-based values. The output of an Average node, Value, contains the average value of data in the specified column.

Node Properties

The Properties window for an Average node contains the items that are described in the following table.

Item

Description

Notes

Collection section

Specifies the collection that contains the values that you want to average.

You can select to specify the output of a predecessor node in this section.

Collection Column section

Specifies the column that contains that values that you want to average.

This list contains the columns that are available in the selected collection.

The column that you select must contain numeric or time-based values.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Baseline Rule Nodes in Family Policies

A Baseline Rule node represents an action to execute baseline family-level rules in APM. You can use the Baseline Rule node in a family policy to run any existing APM baseline rules that correspond to the policy's family and trigger. In this way, you can use both family policies and APM baseline family-level rules.
Note: The Baseline Rule node executes only APM baseline rules, not any family-level rules that you have written. For a single family, you can write family-level rules or family policies, not both.

Node Properties

Other than optionally specifying a name for the node, there are no properties to configure for a Baseline Rule node.

Guidelines for using the Baseline Rule node

When working with the Baseline Rule node, consider the following behaviors and guidelines:

  • You must ensure that the policy logic is designed so that only one Baseline Rule node will execute. A notification of this requirement will appear if more than one Baseline Rule node is added to the policy.
  • When you validate a family policy that includes a Baseline Rule node, the validation will actually execute the corresponding rule. It is therefore recommended that the policy is fully tested in a development or quality assurance environment prior to implementing the policy in a production system, where testing the policy could have undesirable consequences.
  • Where a family policy executes a Baseline Rule node, you may observe a noticeable delay when updating records that trigger the policy.

Baseline Rule Node

The APM baseline rules for the Reading family includes a Before Insert rule that sets the Status field on a Reading record according to when the reading was taken. If the Reading Taken Date is before the Next Date on the related Checkpoint Task, the Status is set to 'I' (i.e. Ignored), and the Next Date on the Checkpoint Task is not updated, leaving the previously set schedule for the checkpoint intact. This might indicate either that there is a maintenance issue with the related asset which needs additional attention, or that the reading was taken ahead of schedule. In the first scenario, you might want to ensure that any required maintenance action has been planned or completed. In the second scenario, you might want to reset the checkpoint schedule to avoid repeating an inspection unnecessarily.

The following example illustrates how you can configure a set of family policies for the Reading family to notify users that an Ignored reading has been inserted.

First, in a Before Insert policy, you can use the Baseline Rule node to run the existing APM baseline rule that sets the Status of the new reading. The following image shows this basic policy. No settings are required on either of the nodes in this policy.

Then, you can configure a second family policy on the After Insert trigger to send an email to the Rounds administrator if an Ignored reading was inserted. The following image shows this policy.

As you can see in the following image of the Properties window for the Equal node, the value in the Status field is checked to determine whether it is equal to 'I', which is the stored system code (not the display value) for the field.

And, finally, as you can see in the following image of the Properties window for the Email Contact node, you can configure the email address to which to send the email notification and a message.

Case Nodes in Family Policies

A Case node is a Condition node that you can use in the policy model to set up scenarios in which the output values of the node should be changed automatically based on specific input values. Throughout this documentation, we refer to each defined scenario as a Case. Each Case within the Case node has an input value and one or more output values that the APM system will use if the value in a defined input field matches the input value of the Case.

There are two types of Cases in the Case node, which we refer to as the If Case and Else Case throughout this documentation:

If Case
The type of Case that is executed if the value in a defined input field matches a specific input value that you specify. You can define one or more If Cases for a given Case node.
Else Case
The Case that is executed by default if the value in a defined input field does not match a specific input value that you specified in an If Case. There is only one Else Case for a given Case node.

The input of a Case node must be a single value or the logical result of a comparison node. The output of a Case node is the value that you define in the Value column corresponding to the output option that you select in a successor node. Outputs may be single values or collections.

Node Properties

The Properties window for a Case node contains the items that are described in the following table.

Item

Description

Notes

Input section

Specifies the field whose value you want to compare to each If Input = value in order to determine the output(s) of the Case node.

If you select a comparison Condition node as a predecessor node, the logical result of the condition will be used automatically as the input value.

If Case section

If Input = text box

Specifies the value that must match the value that is defined in the Input section in order for the corresponding If Case to be executed.

You can use the and buttons in the If Input = row to add or delete If Cases in the Case node.

Output section

Specifies the output(s) for the corresponding If Case.

The output section contains two columns:

  • Mapping: Specifies a name for each output that you define.
  • Value: Specifies the value or collection that will be the output of the Case node if the corresponding Case is executed.

You can use the and buttons in the output section to add or delete output rows.

When you add or delete an output row in one Case, corresponding output rows in all cases are added or deleted automatically.

Else Case section

Else output section

Specifies the output(s) of the Else Case.

The Else Case will be executed if the value in the If Input = section does not match any value defined in an If Input = text box.

This output section contains the same functionality as described above.

You cannot delete the Else Case from the Case node.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Collection Filter Nodes in Family Policies

A Collection Filter node is a Calculation node that you can use to apply one or more filters to collections that are represented by nodes in the policy model. Filters may, for example, specify a range of values or dates within which readings must fall in order to be evaluated by successor nodes.

The input of a Collection Filter node must be a collection of data. The output of a Collection Filter node, Filtered Collection, includes only the rows in a collection that pass all filter criteria that are defined in the Collection Filter node's Properties window.

Node Properties

The Properties window for a Collection Filter node contains the items that are described in the following table.

Item

Description

Notes

Collection section

Specifies the collection that you want to filter.

You can select to specify the output of a predecessor node in this section.

button

Adds a new filter row to the Collection Filter node.

Each filter row consists of a column, operator, condition, and the button.

Column list

Specifies the column whose values you want to use in the filter.

This list contains the columns that are available in the selected collection.

Operator list

Specifies the comparison operator that you want to apply to the values in the selected column.

This list contains the following operators:

  • Greater than (>)
  • Greater than or equal (>=)
  • Less than (<)
  • Less than or equal (<=)
  • Equal (=)
  • Does not equal (!=)
  • Starts with
  • Contains
  • Ends with

Condition value

The value that will be compared against the values in the corresponding column to determine the output of the node.

You can select to specify the output of a predecessor node in this section.

button

Deletes the corresponding filter row from the Collection Filter node.

None

Tip: Refer to the Policy Designer documentation to see an example of this node.

Comparison Nodes in Family Policies

Comparison nodes are Condition nodes that you can use to compare two input values using the comparison operator that corresponds to the name of the node. The following comparison nodes are available:

  • Equal
  • Not Equal
  • Greater Than
  • Greater Than or Equal
  • Less Than
  • Less Than or Equal

Each comparison node requires two inputs, which must be single values. For Equal and Not Equal nodes, inputs can be any type of data. For the remaining comparison nodes, inputs must be numeric or time-based values.

The output of a comparison node is the logical result of the comparison (i.e., yes or no). The output of a comparison node can be used only as an input to Case or Logic nodes. For all other successor nodes, the output is used by the connection to the successor node in order to determine if the successor node will be executed.

You can use the Properties window for a connection starting at a comparison node to configure a logic path for the connection. If you do not configure a logic path for a connection, a Yes path is assumed but does not appear on the model. The APM system will execute only the branches of a policy model where the logical result of the comparison matches the logic path defined for the corresponding connection.

Node Properties

The Properties window for each comparison node contains the items that are described in the following table.

Item

Description

Notes

First value

The input value that will be compared to the second input value.

You can select to specify the output of a predecessor node in this section.

Operator symbol

The symbol that corresponds with the comparison operation that is performed by the node.

None

Second value

The input value that will be compared to the first input value.

You can select to specify the output of a predecessor node in this section.

Display list

Determines the label that appears on the node in the policy model.

This list does not appear if you enter a constant in the corresponding section.

Tip: Click here to see example of these nodes used within complete policy models.

Convert Type Nodes in Family Policies

You can use a Convert Type node to convert a value to another data type. The node converts the value to the corresponding value of the specified data type, and provides the converted value as its output. You can use the Convert Type node to convert a value to one of the following data types:
  • Boolean
  • Time & Date
  • Decimal
  • Integer
  • String
  • Time Span

Node Properties

The Properties window for a Convert Type node contains the items described in the following table.

FieldDescriptionNote
Output TypeSpecifies the data type to which you want to convert the value.None.
Input ValueSpecifies the value that you want to convert.If the data type of the input value is such that it cannot be converted to the data type specified in the Output Type field, the node will not be executed during the execution of the policy.

How Values Are Converted

The following table describes how the input values of different data types are converted by the Convert Type node.

Data Type of Input ValueData Type Specified for Output Value
BooleanDecimalIntegerStringTime & DateTime Span
BooleanRetained without conversion.
  • If the value is True, it is converted to 1
  • If the value is False, it is converted to 0
  • If the value is True, it is converted to 1
  • If the value is False, it is converted to 0
Converted to the string representation of the valueCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the node
DataframeCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the nodeConverted to the string representation of the valueCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the node
Time & DateCannot be converted, and results in execution failure of the nodeConverted to the number of seconds elapsed between January 1, 1970 and the valueConverted to the number of seconds elapsed between January 1, 1970 and the valueConverted to the string representation of the valueRetained without conversionCannot be converted, and results in execution failure of the node
Decimal
  • If the value is 0, it is converted to False
  • Any value other than 0 is converted to True
Retained without conversionRounded to the nearest whole numberConverted to the string representation of the valueConverted to date after considering the value as the number of seconds since January 1, 1970Converted to represent number of seconds
GUIDCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the nodeConverted to the string representation of the valueCannot be converted, and results in execution failure of the nodeCannot be converted, and results in execution failure of the node
Integer
  • If the value is 0, it is converted to False
  • Any value other than 0 is converted to True
Retained without conversionRetained without conversionConverted to the string representation of the valueConverted to the corresponding date after considering the value as the number of seconds elapsed since January 1, 1970Converted to represent number of seconds
String
  • If the value is Yes, True, No, or False, it is converted to the corresponding Boolean value.
  • Other values are first converted to the corresponding numeric values. If the numeric value is 0, the value is finally converted to False. Otherwise, the numeric value is converted to True.
Converted to the corresponding numeric value and then rounded to the nearest whole numberConverted to the corresponding numeric valueRetained without conversion
  • If the value clearly indicates a date (for example, the strings today and now-3d), it is converted to the corresponding date
  • If the value is a numeric value, it is converted to a date after considering the value as the number of seconds elapsed since January 1, 1970
  • Other values Cannot be converted, and result in execution failure of the node
  • If the value clearly indicates a time span (for example, the strings 3d and 3 days), it is converted to the corresponding time span value
  • If the value is a numeric value, it is converted to represent number of seconds
  • Other values Cannot be converted, and result in execution failure of the node
Time SpanCannot be converted, and results in execution failure of the nodeConverted to the number of seconds represented by the valueConverted to the number of seconds represented by the valueConverted to the string representation of the valueCannot be converted, and results in execution failure of the nodeRetained without conversion

Convert Type node

The following example illustrates how the Convert Type node can be used to convert the text string output of a Text node to a time span value.



In this example, the Text node is configured to create a text string that indicates a time span, using the values represented by the Point Value nodes. Because the Subtract node cannot perform any calculation on a text string, the Convert Type node converts the string to a value of the Time Span data type. The converted time span value is then used in the Subtract node to calculate the required date.

The following image illustrates the Properties window of the Convert Type node described in this example.

Count Nodes in Family Policies

A Count node is a Calculation node that you can use in a policy model to calculate the total number of rows in a collection.

The input for a Count node must be a collection. The output for a Count node, Value, contains the result of the calculation.

Node Properties

The Properties window for a Count node contains the items that are described in the following table.

Item

Description

Notes

Collection section

Specifies the collection for which you want to calculate the total number of rows.

You can select to specify the output of a predecessor node in this section.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Field Value Changing Nodes in Family Policies

A Field Value Changing node is a Condition node that you can use in a Before Update family policy to determine whether a value in a certain field is changing in the transaction that triggered the family policy.
The input of a Field Value Changing node must be a field from a Current Entity or Current Relationship node. The Field Value Changing node generates the following outputs.
  • The logical result of the node (i.e., yes if the value in the specified field is changing in the corresponding transaction or no if it is not changing).
    Note: Logical results are used by the connections to successor nodes in order to determine if the successor node will be executed. You can use the Properties window for a connection starting at a Field Value Changing node to configure a logic path for the connection.
  • Original Value, which is the value in the specified field before the change.

Node Properties

The Properties window for a Field Value Changing node contains the items that are described in the following table.

Item

Description

Notes

Field section

Specifies the field whose value will be evaluated to determine whether it is changing in the transaction that triggered the family policy.

You must specify a field from a Current Entity or Current Relationship node.

Field Value Changing node

The following example illustrates how you can use a Field Value Changing node to send an email message if the Criticality Indicator value in an Equipment record changes from A to some other value. Consider the following nodes and connections.

In this example, the Field Value Changing node first determines whether or not the value in the Criticality Indicator field is changing. The following image shows the Properties window for the Field Value Changing node.

If the value in the Criticality Indicator field is changing (i.e., the logical result of the Field Value Changing node is yes), the Equal node then evaluates whether the initial value in the field was A, as shown in the following image.

Finally, if the original Criticality Indicator value was A, an email message is sent to the specified recipient(s).

Is Null Nodes in Family Policies

An Is Null node is a Calculation node that you can use to specify a default value that should be used in subsequent calculations in the event that the input value is null. You can also use this node in combination with a logic node to specify an action to be taken in the event that an input value is null.

The input of an Is Null node must be a single value. The output of an Is Null node, Answer represents either of the following two values:
  • If the input value is not null, Answer, represents the same input value.
  • If the input value is null, Answer represents the value that you specify in the Properties window.

Node Properties

The Properties window for an Is Null node contains the items that are described in the following table.

Item

Description

Notes

Input Valuesection

Specifies the value that you want to determine whether it is null.

You can select to specify the output of a predecessor node in this section.

Value if Input is Null section

Specifies the output value of the node if the value specified in the Input Value section is null.

You can select to specify the output of a predecessor node in this section.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Last Nodes in Family Policies

A Last node is a Calculation node that you can use in a policy model to retrieve the last row in a collection, whose fields you can then use in successor nodes to perform various calculations or actions.

Note: For reading collections that are associated with Measurement Location, Health Indicator, or OPC Tag nodes, the last row is the most recent reading. For collections that are associated with Query nodes, the last row depends on the order in which the query is sorted.

The input for a Last node must be a collection. The output for the Last node is any field in the row that the Last node retrieves.

Node Properties

The Properties window for a Last node contains the items that are described in the following table.

Item

Description

Notes

Collection section

Specifies the collection from which you want to retrieve the last row.

You can select to specify the output of a predecessor node in this section.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Math Node

A Math node is a Calculation node that you can use in the policy model to perform mathematical operations on numeric input values. The node performs operations on the values represented by variables that you define for the node. It evaluates the expression that you provide (for example, a^2+b*c) based on the input values, mathematical functions, and operators used. The resulting value of the expression is returned as the output of the Math node, which can be used in another node in the policy model. The variables used in the mathematical expression defined for a Math node can be configured to represent a single value or a collection of numeric values.

Note: User-defined arguments are currently not supported in the Math node.

Comparison with R Script Node

For moderately complex calculations on numeric values, a Math node offers a simpler alternative to the R Script node in that it does not require the knowledge of the R programming language, and it runs faster than the R Script node.

Node Properties

The Properties window for a Math node contains items that are described in the following table.

Item

Description

Note

Math expressionThe mathematical expression to be evaluated.
  • For information on the supported functions and expression syntax, refer to https://github.com/mariuszgromada/MathParser.org-mXparser/blob/master/README.md documentation.
  • If the expression is invalid, a message appears in the notification bar and you cannot activate the policy.
  • If the output from a predecessor node that is used as an input to a Math node is an invalid expression, the warning messages will not appear in the notification bar. The associated error occurs during policy validation or execution.
NameThe variable name that you may have used in the Math expression.
  • You must define each variable name used in the math expression.
  • You may define variable names that are not used in the math expression.
  • The variable name is case-sensitive and must contain only alphanumeric characters without spaces.
  • You may use the reserved name of a math operation or constant value (for example, cos, pi, Beta, etc.) as a variable name, in which case it will be interpreted as an input variable, instead of the given math operation or value.
  • If the named variable represents a collection of numeric values, you can reference the individual values in the collection in the math expression by adding a number to the end of the variable name. For example, if the variable is named List the individual members of a collection of 3 input values can be referenced in the math expression as List1, List2, and List3.
ValueThe value of the named variable.This must be a numeric value or collection of numeric values.
Adds a row for Name and Value.None
Deletes the corresponding row.None.

How Input Values Correspond to Calculations

The following table describes how the input values that you define for a Math node correspond to the mathematical operations performed by the node. Here, 'a' and 'b' are variables whose values are 5 and 8, respectively.

Math expression

Output

Note

2+pi5.1415926536pi is a mathematical constant.
a!+b128This is a factorial operator.
a=b^20, if false; 1, if true.^ is an exponentiation operator.
if(a>b,100,0)0, if false; 100, if true.> is a relational operator.
sqrt(a+b)3.6055512755sqrt is a square root operator.

How Input Values Correspond to Calculations using Logical Operators

The following table describes how the input values that you define for a Math node correspond to the mathematical operations performed by the node when the mathematical expression contains logical operators. Here, A, B, and C are variables whose values are 1, 0, and 0 respectively.

Important: The order of precedence of the logical operators (namely AND, Or, and Not) during the evaluation of mathematical expressions has been modified in the Mathparser.org (V4.4.2) library. This can cause unexpected results in your policies. For example, a Math node configured with the mathematical expression A|B&C will now be evaluated as A|(B&C), whereas it was previously evaluated as (A|B)&C.

Math expression

Output

Note

A | B & C1 (that is, True)The And (&) operator takes precedence over the Or (|) operator
(A|B) & C0 (that is, False)None
A | (B&C)1 (that is, True)None

How A Collection of Input Values Represented by a Single Variable Correspond to Calculations

The following table describes how a collection of input values that are represented by a single variable defined for a Math node corresponds to the mathematical operations performed by the node. Here, 'a' is a variable that represents a collection of values 10, 20, 30, and 40, and 'b' is a variable that represents a collection of values 100, 110, 120, and 130.

Math expression

Output

Note

add(a)100add is a summation operator.
mean(a,b)70mean is an average value operator.
a1+b1110You can reference individual values in the collection by adding a number to the end of the variable name.

Math node

The following example illustrates how you can use the Math node to evaluate a Math expression.

Consider the following policy model that is designed to provide an email alert when an equipment has exhausted the threshold percentage of its life expectancy.

The threshold percentage of life used for the equipment is stored as a Technical Characteristic. The life data of the equipment (for example, hours for turbine, starts for crane, take-offs for aircraft, tonnes moved for mining equipment), is stored as Measurement Location readings.

The percentage of expected life of the equipment is calculated in the Math node using the Cumulative Distribution Function (CDF) of the Weibull Distribution, which is a mathematical function for analyzing life data.

The Math expression used for this calculation is as follows:

100*(1-e^(-((Time/Eta)^Beta)))

where:

  • e is a mathematical constant.
  • Time is the life used.
  • Eta and Beta are Weibull distribution parameters.
Note: Beta is a defined math function name, however, in this example, it is used as the name of an input variable.

The following image shows the Properties window of the Math node:

To easily identify the Measurement Location, Technical Characteristic, and Weibull Distribution parameters associated with the equipment, the Equipment Entity input node is specified as the primary node, indicating that the record specified for this node is the primary record to which all the other input records (represented by other Input nodes) will be linked.

The Weibull Distribution Entity input node provides the distribution parameters (that is, Eta and Beta), which were determined in the Reliability Analytics module by analyzing the failure data of a similar equipment.

The Life Used Measurement Location input node provides the readings to the Recent Reading Last calculation node, which retrieves the latest measurement reading (that is, Time).

The resulting value of the Math expression is passed to the Cumulative Probability Return Value action node, which will include the value in the policy execution history.

The Life Used Alert Level Entity input node provides the Technical Characteristic value to a comparison condition node, which compares it with the output of the Weibull CDF Math calculation node.

When the Weibull CDF value exceeds the Technical Characteristic value (that is, the threshold percentage) of the equipment, the message specified in the Email Text calculation node is sent via email to the user specified in the Email Contact action node.

The following image shows the Execution Details window of the Math node.

Note: You can also build this policy model without a Math node, in which case you will need seven calculation nodes to perform the function of a single Math node.

Min and Max Nodes in Family Policies

Min and Max nodes are Calculation nodes that you can use in a policy model to determine the row of a collection which contains the smallest or largest value, respectively, in a specified column.

The input for a Min or Max node must be a collection with a column containing numeric or time-based values. The output of a Min or Max node is any field in the row that the Min or Max node retrieves. If multiple rows contain the minimum or maximum value, then only the first row encountered is returned.

Node Properties

The Properties windows for Min and Max nodes contain the items that are described in the following table.

Item

Description

Notes

Collection section

Specifies the collection for which you want to determine the smallest or largest value in a certain column.

You can select to specify the output of a predecessor node in this section.

Collection Column section

Specifies the column that contains the values of which you want to determine the smallest or largest value.

This list contains the columns that are available in the selected collection.

The column that you select must contain numeric or time-based values.

Tip: Refer to the Policy Designer documentation to see examples of these nodes.

Round Nodes in Family Policies

A Round node is a Calculation node that you can use in a policy model to:

  • Round a value to a specific number of decimal places. This is called decimal rounding.

    -or-

  • Round a value to a specific number of significant figures. This is called precision rounding.

The input of a Round node must be a single, numeric value. The output of a Round node, Answer, contains the rounded value.

About Decimal and Precision Rounding

When you use decimal rounding, you can specify the number of decimal places to which you want to round the input value. For example, if the input value is 3.51 and you indicate that you want to round to the nearest tenth (by specifying the value 1 in the Digits text box on the Properties window), the input value will be rounded to 3.5.

When you use precision rounding, you can specify the number of digits that you want keep from the input value. For example, if the input value is 7,658,321 and you indicate that you want to keep the first three values (by specifying the value 3 in the Digits text box on the Properties window), the input value will be rounded to 7,660,000 (where the third digit, 5, is rounded to 6, and the remaining digits are changed to 0).

Note: The Round node always rounds values to the nearest number (i.e., you can not specify that it always round values up or down). To round values up or down, you can use a Remainder node with an Add or Subtract node.

Node Properties

The Properties window for a Round node contains the items that are described in the following table.

Item

Description

Notes

Value section

Specifies the value that will be rounded.

You can select to specify the output of a predecessor node in this section.

Digits section

The value in this section serves a different purpose depending on the option that you select in the Mode section. You can select:

  • Decimal rounding : Specifies the number of decimal places to which you want to round the input value.
  • Precision rounding : Specifies the number of digits that you want keep from the input value.

You can select to specify the output of a predecessor node in this section.

If the list in the Mode section contains the value:

  • Decimal rounding , you must enter a whole number between 0 and 15 in this text box.
  • Precision rounding , you must enter a whole number greater than zero.

Regardless of the values that you specify for the Round node, when you validate the policy logic, only two decimal places are displayed. You can see the actual values by accessing the Properties window for the appropriate node.

Mode list

Specifies the type of rounding that the node will perform.

This list contains the following options:

  • Decimal rounding

  • Precision rounding

By default, the Mode list contains the value Decimal rounding and the Digits text box is empty (this is the same as typing 0 [zero]). This means that decimal values will be rounded to the nearest whole number.

Tip: Refer to the Policy Designer documentation to see an example of this node.

R Script Nodes in Family Policies

An R Script node is a Calculation node that you can use in a policy model to return a result that is calculated by an R script created outside the policy using the R script editor.

The inputs for an R Script node must correspond to the type of inputs expected by the R Script. The outputs of an R Script node contain the values calculated by the R script.

Node Properties

The Properties window for an R Script node contains the items that are described in the following table.

ItemDescriptionNotes
Path Specifies the path to the R script that will run when the policy is executed.
Additional sections corresponding to the inputs expected by the R script.Specifies the values that will be used in the R script to calculate a result.The number of sections displayed in the Properties window is determined by the number of inputs configured in the specified R script.

In each section, you can select to display the output of a predecessor node.

The value that you specify should correspond to the type of input expected by the R Script (i.e., a Vector of Values, a Matrix of Values, Data Frame, or a single value that is Numeric, Character, Boolean, or Time & Date).

Working with R Scripts

You should account for the following behaviors when working with R scripts in policies:

  • The policy execution engine sends date inputs to the R script in UTC. If your R script performs any calculations based on dates, the date output must also be in UTC and use the standard date format yyyy-MM-dd hh:mm:ss.fff.
  • For Data Frame inputs:
    • The entire collection you specify is passed to the R script.
    • The supported data types for each column are Time & Date, Numeric, Character, and Boolean.
    • Reading values in readings collections specified directly from an input node such as the OPC Tag, Measurement Location, or Health Indicator node are untyped and therefore sent to the R script as string values.

R Script Using Multiple Inputs from Policy

The following example illustrates how you can use an R Script node to evaluate certain values in other nodes and return a particular value. Consider the following nodes and connections.

As shown in the following image, you can use the Properties window for the R Script node to select a particular R script that was created using the R script editor. The R script in this example requires three input values: LinerBaseDF, LiningConditionAdjustment, and OnlineMonitoringAdjustment. These input values correspond to variables in the specified R script.

You can see that output values from the predecessor Input nodes have been specified to supply the values required by the R script. When this policy is executed, these values will be used to calculate the result of the R script. The Return Value node then returns the value calculated by the R Script node.

Calculating Average and Standard Deviation of a Reading Collection

The following example illustrates how you can use a policy to execute an R script that calculates statistical information regarding readings related to a Measurement Location, and then send that information via email message to a designated recipient.

Consider the following R script and corresponding parameters.

This R script calculates the average reading value, count of readings, standard deviation, and most recent reading date of input values provided as a Data Frame.

The following policy is used to provide the input to the R script and to use the results of the R script in subsequent operations.

This policy first filters Measurement Location readings to only those readings recorded within the last 30 days. Then, the filtered readings are sent as a Data Frame input to the R script.

The following image shows the Properties window for the R Script node.

Next, the calculated results returned by the R script are used in a Text node to construct a message that will ultimately be sent via email to a responsible user.

The following image shows the Properties window for the Text node.

The following image shows the full text pattern specified in the Text node.

Sum Nodes in Family Policies

A Sum node is a Calculation node that you can use in a policy model to calculate the total value of data in a specified column of a collection.

The input for a Sum node must be a collection containing numeric or time span values. The output of a Sum node, Value, contains the result of the calculation for the specified column.

Node Properties

The Properties window for a Sum node contains the items that are described in the following table.

ItemDescriptionNotes
Collection sectionSpecifies the collection that contains the values for which you want to calculate the total value.

You can select to specify the output of a predecessor node in this section.

Note: If the input specified for a Sum node is an empty collection, the resulting answer from the Sum node is automatically zero (0).
Collection Column sectionSpecifies the column that contains that values for which you want to calculate the total value.This list contains the columns that are available in the selected collection.

The column that you select must contain numeric or time span values.

Tip: Refer to the Policy Designer documentation to see an example of this node.

Text Nodes in Family Policies

A Text node is a Calculation node that you can use in a policy model to create a custom text string based on constants and the values returned by other nodes in a policy execution.

The inputs for a Text node must be single values. The output of a Text node, Answer, contains the custom text string.

Node Properties

The Properties window for a Text node contains the items that are described in the following table.

Item

Description

Notes

Text Pattern box

Defines the pattern for the custom text string that will be the output of the Text node.

You must enter a valid .NET String.Format expression in this box.

When you create the text pattern, the index numbers you use must be sequential starting at zero. However, the numbers do not have to be listed sequentially within the string and each number can be used multiple times.

Index / Value section

Specifies the value that each index specified in the Text Pattern box represents.

When the node is executed, the indexes in the text string will be replaced with the corresponding values you specify in this section.

Important: You must define values for all indexes defined in the Text Pattern box.

You can select to specify the output of a predecessor node in this section.

You can use the and buttons in this section to add or delete values.

Note: Constant values to represent dates (e.g., now, today, Sunday, October, etc.) or specific values (e.g., Pi or e) are not supported in this section. To use these one of these constants, you must define it using a Constant or Point Value node with an appropriate type.

.NET String.Format Expressions

The Text node supports .NET String.Format expressions, including the formatting capabilities supported by String.Format. The following table shows various example expressions and the resulting strings.
Text PatternDefined Index ValuesResulting String
The temperature of the motor is {0} degrees Celsius.{0}=12The temperature of the motor is 12 degrees Celsius.
The temperature of the {1} is {0:F2} degrees Celsius.

{0}=23.456

{1}=pump

The temperature of the pump is 23.46 degrees Celsius.
The temperature was recorded at {0:t} on {0:d}.

{0}= 1/1/2016 05:30:00

The temperature was recorded at 5:30 AM on 1/1/2016.
The cost to repair the damaged part is {0:C2}.{0}=1600The cost to repair the damaged part is $1,600.00.
Note: For further explanation of valid expressions and formatting capabilities, refer to the String.Format documentation provided by the Microsoft Developer Network (MSDN).
Tip: Refer to the Policy Designer documentation to see an example of this node.

Threshold Statistics Nodes in Family Policies

A Threshold Statistics node is a Calculation node that you can use in a policy model to determine the frequency and duration over which input values cross a defined threshold (i.e., meet a defined condition).

The input for a Threshold Statistics node must be a collection with columns containing timestamps and numeric values. A Threshold Statistics node generates the following outputs:

  • Count, which represents the number of times that input values crossed the defined threshold.
  • Accumulated Time, which represents the amount of time over which input values crossed the defined threshold.

Node Properties

The Properties window for a Threshold Statistics node contains the items that are described in the following table.

ItemDescriptionNotes
Collection sectionSpecifies the collection for which you want to calculate a threshold statistic.

You can select to specify the output of a predecessor node in this section.

Timestamp Column listSpecifies the column that contains the timestamps that you want to use to calculate the accumulated time during which the input values cross the defined threshold. This list contains the columns that are available in the selected collection.
Value Column list

Specifies the column that contains the input values that will be compared to the threshold value.

This list contains the columns that are available in the selected collection.

Threshold sectionSpecifies the threshold value that will be compared to the values that are defined in the Value Column list.

You can select to specify the output of a predecessor node in this section.

Operator listSpecifies the comparison operator that will be used to compare inputs values to the threshold value.This list contains the following operators:
  • Less than (<)
  • Less than or equal (<=)
  • Equal (=)
  • Greater than or equal (>=)
  • Greater than (>)
Tip: Refer to the Policy Designer documentation to see an example of this node.