Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleCriteria

In general, the rule criteria are the conditions that must be met before the rule actions can be taken.  Each of the Boolean statements specified in a criteria group must be satisfied in order to consider the criteria group completely satisfied and to trigger the output actions.  This is equivalent to saying that all of the Boolean statements contained in a criteria group are AND’ed together to produce the value of the entire expression.  This includes any sub-criteria groups that are contained within a parent criteria group.

However, the rule itself may contain multiple criteria groups.  Each of these root criteria groups are OR’ed together during evaluation of the rule to produce the final result.  Because any Boolean statement can be represented in Sum-Of-Products form (the logical-OR of groups of AND’ed statements), this criteria group structure is capable of storing any Boolean statement.

Currently, the only type of criteria that may be specified in an operational rule is a VariableCondition.

VariableCondition Criteria

A VariableCondition is an expression containing variables from global common and/or constant values.  The condition is considered true if the expression evaluates to a non-zero value, otherwise the condition is considered false.  A VariableCondition expression is formatted identically to a standard Variable Operation.

Following are examples of VariableConditions:

Code Block
(mycommon.myfloat > 0)
(mycommon.mychar == ‘a’)
(mycommon.myfloat >= mycommon.myint)
(mycommon.mystring != “samplestring”)
(mycommon.myfloat > (mycommon.myint – 3.141))
((mycommon.myfloat > mycommon.myint) && (mycommon.mystring != “string”))
Expand
titleActions

In general, the rule actions are those instructions carried out when the rule criteria conditions are met.  The order of actions performed corresponds to the order in which they are specified in the rule definition.  Any action that cannot be performed due to improper formatting or variable types will be skipped and the following action performed.  In this case, a log entry will be generated to record the error event.

Currently, the only type of action that may be specified in an operational rule is a ModifyVariable statement. 

 

ModifyVariable Actions

  • A ModifyVariable action statement modifies the value of a variable in global common.  An assignment operation must be specified in the following form:

GlobalVariable = Expression

where:

GlobalVariable is the fully qualified name of variable in global common whose type is int, float, double, long, short, char, or char[].

Expression is any expression in a form identical to a standard Variable Operation.

 

The following special conditions apply:

  • Character array variables can only be set equal to expressions that are other character array variables or string constants.

 

Following are examples of valid expressions:

Code Block
mycommon.myfloat = 3.141
mycommon.mychar = ‘a’
mycommon.mystring = “samplestring”
mycommon.myfloat = (mycommon.myint + 3.141)
mycommon.myfloat = (mycommon.myfloat * mycommon.myint)
Expand
titleFile Format

Rule definitions are stored on disk in an XML file format.  An example file containing a generic rule definition is shown below.

Code Block
<?xml version="1.0" encoding="utf-8"?>
<OperationalRules>
  <Rule>
    <Name>Rule #1</Name>
    <Description>Rule #1 description</Description>
    <Enabled>True</Enabled>
    <NextEvalTime>2004/10/18 11:39:00</NextEvalTime>
    <EvalInterval>00:01:00</EvalInterval>
    <LockTimeOfDay>False</LockTimeOfDay>
    <EvalWindow>00:30:00</EvalWindow>
    <RearmInterval>08:00:00</RearmInterval>
    <Criteria>
      <VariableCondition>(mycommon.myvariable &gt; 5.0)</VariableCondition>
    </Criteria>
    <Actions>
      <ModifyVariable>mycommon.myothervariable = 0.0</ModifyVariable>
    </Actions>
    <Status>Rule Rule #1 active</Status>
    <Error>0</Error>
    <LastEvalTime>2004/10/18 11:38:00.0632904</LastEvalTime>
    <LastActionTime>2004/10/15 12:49:00.092576</LastActionTime>
    <LastVerifyTime>2004/10/15 12:47:23.5585345</LastVerifyTime>
    <LastErrorTime>0</LastErrorTime>
    <LastModifyTime>2004/10/15 12:47:08</LastModifyTime>
  </Rule>
</OperationalRules>

Rule definitions can be stored either with only one rule per file or with multiple rules in a single file. 

Class Libraries - Rules Processing System API

The Rules Processing System API consists of a set of hierarchical classes defined in the TSENTRY tpriNtRt C/C++ library.  See the tpriRps library documentation for more details about these classes.