Polybench® Reference
Used in an action sequence to make a decision based upon the values of the specified variables.

Action Decision

Overview

Use this operator as part of an action sequence. An action sequence consists of two kind of operators: the Action operator ("Action") and this operator.

This operator is used to split an action sequence in two routes; which route is taken depends on a logical equation that is specified in the properties.

You can also this operator to calculate a logical equation on fixed values, variables, values as well as any texts.

Operator ports

Input action: Specific sample type, see below.

Output Yes: Action sequence blobs

Output No: Action sequence blobs

Properties

Find more information about changing properties here: "Properties Viewer"

Equation
type: Address, starts with '$' sign (see "Address - how to address objects and variable parameters")
An equation based on which this operator decides to continue on the Yes or No output. You may use fixed value, variable parameters, AND and OR.

You may type or paste the address, or you may press the small button on the right to open the Address Constructor ("Address Constructor")

Parsed equation (to check)
type: See description
Displays the equation like how Polybench interprets it. Use this to check if your equation is correct.


Partial results (to check)
type: Parameter list (see "Parameter List")
Displays comparison results of parts in your equation. Use this to check if your equation is correct.


Caption
type: Word or phrase
The name of the object in the project. This name must not contain '.', '$' nor '@' characters.

For more information about the rules and usage of the Caption property, please refer to "Caption property - background and usage".

Documentation
type: See description
Optional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.

Details

In the properties dialog of the Action Decision you can specify a logical equation. The equation should contain at least one comparison between two values or variables.
A comparison, using the six inequality signs, looks like this:

a = b : is a equal to b?
a != b : is a not equal to b?
a > b : is a greater than b?
a >= b : is a greater than or equal to b?
a < b : is a less than b?
a <= b : is a less than or equal to b?

where a and b should be substituted by any of the following:
- a fixed text string, for example hypertension
- a fixed numerical value, for example 12.3, also valid is 12,3
- a global variable, for example $hour$
- a variable parameter of any other object, for example $Design.Constant 1.Value$

If a text string is to be compared to another text string, then comparison is handled in an ordinal fashion according to the ASCII character order. If a numerical value is used, then the comparison is handled according to numerical rules.

For more information on inequality operations, please read this: "Inequality math".

Logical equations

The Decision Operator allows to specify multiple comparisons. Those comparisons, as described above, are then glued together using the logical operators AND and OR (they must be written in capitals, so and or or is wrong).

To be able to structure the equation, you may use parentheses: ( to open a sub-section, and ) to close a sub-section.
Note the following rules:

a = a AND b < c : result is TRUE, so the 'Yes' route is taken.
(a = a AND b < c) OR c > d : result is TRUE
a = a AND b < c OR c > d : this is equal to the previous equation, since AND goes before OR.
(a < b AND (c > d OR (e = f AND e > d))) : well, the answer is... FALSE

The last equation takes some more time to understand. To help check if an equation is parsed and handled the way you intend it to be, the properties dialog of the Action Decision provides the parsed equation (with extra brackets to see what is calculated first), as well as a list of comparisons, so you are able to evaluate each and every part of the equation.
The last equation above, according to the parser, translates to:

((a < b) AND ((c > d) OR ((e = f) AND (e > d))))

which is FALSE, because either (c > d) is FALSE, or (e = f) is FALSE. The action sequence will continue its route via the 'No' output of this operator.

Wrong equation

If a problem is detected in the logical equation, then the Action Decision operator symbol issues a warning and becomes red. Any actions that are connected at the output will not be executed!

Examples

Example: Action Decision Test
Demonstrates the use of the Action Decision operator in an action sequence. The action sequence is started when you press the 'Go' button (it uses an ACTIONSEQUENCE action). In the Action Decision a random example equation is set. Change the equation to see if it evaluates to TRUE or FALSE. You may also change the constant values. Then press 'Go' again and check the result. If the equation evaluates to TRUE, then 'YES' is written in the input field, otherwise 'NO'.
Examples\DF0700203_001_Action_Decision_Demo.xmc