| Name | Description |
|---|---|
| Returns true, if all elements of the Boolean input vector are true ('and') | |
| Returns true, if at least on element of the Boolean input vector is true ('or') | |
| Returns true, if exactly one element of the Boolean input vector is true ('xor') | |
| Returns the index of the first element of the Boolean vector that is true and returns 0, if no element is true |
Modelica_StateGraph2.Blocks.BooleanFunctions.allTrue
Extends from Modelica.Icons.Function (Icon for functions).
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | b[:] |
| Type | Name | Description |
|---|---|---|
| Boolean | result |
function allTrue
"Returns true, if all elements of the Boolean input vector are true ('and')"
extends Modelica.Icons.Function;
input Boolean b[:];
output Boolean result;
algorithm
result := true;
for i in 1:size(b,1) loop
result := result and b[i];
end for;
end allTrue;
Modelica_StateGraph2.Blocks.BooleanFunctions.anyTrue
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | b[:] |
| Type | Name | Description |
|---|---|---|
| Boolean | result |
function anyTrue
"Returns true, if at least on element of the Boolean input vector is true ('or')"
extends Modelica.Icons.Function;
input Boolean b[:];
output Boolean result;
algorithm
result := false;
for i in 1:size(b,1) loop
result := result or b[i];
end for;
end anyTrue;
Modelica_StateGraph2.Blocks.BooleanFunctions.oneTrue
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | b[:] |
| Type | Name | Description |
|---|---|---|
| Boolean | result |
function oneTrue
"Returns true, if exactly one element of the Boolean input vector is true ('xor')"
extends Modelica.Icons.Function;
input Boolean b[:];
output Boolean result;
protected
Integer count = 0;
algorithm
for i in 1:size(b,1) loop
count := if b[i] then count+1 else count;
end for;
result :=count == 1;
end oneTrue;
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | b[:] |
| Type | Name | Description |
|---|---|---|
| Integer | index |
function firstTrueIndex
"Returns the index of the first element of the Boolean vector that is true and returns 0, if no element is true"
input Boolean b[:];
output Integer index;
algorithm
index :=0;
for i in 1:size(b,1) loop
if b[i] then
index :=i;
return;
end if;
end for;
end firstTrueIndex;