Statements
BooleanOr
BooleanAnd
BooleanNor
BooleanNand
General
The "..." symbol below equates to a single Boolean data item, for example:
Switch.Open
Boolean Test statements should always appear before Test statements and Context Test statements. This is not currently enforced by the Model Compiler but will be at some point in the future.
Permitted Item Field Formats
Boolean_state_data
boolean_process_data
Entity.Boolean_attribute_data
BooleanOr Statement
BooleanOr
Boolean_state_data
boolean_process_data
Entity.Boolean_attribute
ANSI C Code Generation:
| (... || ... || ...)
|
\BooleanOr (
... ...
| ||
... ...
| ||
... ...
/BooleanOr )
BooleanAnd Statement
BooleanAnd
Boolean_state_data
boolean_process_data
Entity.Boolean_attribute
ANSI C Code Generation:
| (... && ... && ...)
|
\BooleanAnd (
... ...
| &&
... ...
| &&
... ...
/BooleanAnd )
BooleanNor Statement
BooleanNor
Boolean_state_data
boolean_process_data
Entity.Boolean_attribute
ANSI C Code Generation:
| !(... || ... || ...)
|
\BooleanNor !(
... ...
| ||
... ...
| ||
... ...
/BooleanNor )
BooleanNand Statement
BooleanNand
Boolean_state_data
boolean_process_data
Entity.Boolean_attribute
ANSI C Code Generation:
| !(... && ... && ...)
|
\BooleanNand !(
... ...
| &&
... ...
| &&
... ...
/BooleanNand )
Simple Example
| (Boolean_state_data)
|
\ConditionAnd (
\BooleanAnd (
Boolean_state_data Boolean_state_data
/BooleanAnd )
/ConditionAnd )
ANSI C Code Generation:
(
(
Boolean_state_data
)
)
Example of Boolean Not Operation
| aaaa = !aaaa;
|
CaseSelection
WhenCase
ConditionAnd
BooleanAnd
aaaa
WhenCaseSelection
Assignment
SetBoolean
aaaa := <<False>>
NullCaseSelection
Assignment
SetBoolean
aaaa := <<True>>
ANSI C Code Generation:
if (
(
(
aaaa
)
)) {
aaaa = FALSE;
} else {
aaaa = TRUE;
}
Tests and Boolean Tests Example
| (
| boolean_process_data ||
| Entity.Boolean_attribute_data ||
| Entity.Integer_attribute == Integer_process_data ||
| String_process_data != String_state_data ||
| Entity.Integer_attribute_a < Entity.Integer_attribute_b
| )
|
ConditionOr
BooleanOr
boolean_process_data
Entity.Boolean_attribute_data
TestOr
Entity.Integer_attribute == Integer_process_data
String_process_data != String_state_data
Entity.Integer_attribute_a << Entity.Integer_attribute_b
ANSI C Code Generation:
(
(
boolean_process_data
||
Entity.Boolean_attribute_data
)
||
(
Entity.Integer_attribute == Integer_process_data
||
String_process_data != String_state_data
||
Entity.Integer_attribute_a < Entity.Integer_attribute_b
)
)
|