functionexists
Returns true if at least one element of a Boolean vector is true ('or' of all elements)
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
exists(b);
Description
The function returns true if at least one element of the Boolean vector b is true. Otherwise, the function returns false.
Example
The property is demonstrated with the following example calling the function as:
Boolean atleastOnePumpActive = exists({p.isActive for p in pumps})
results in
![]() |
|
| simulation result |
Note, the same result can be achieved with the max(..) built-in operator:
Boolean atleastOnePumpActive2 = max(p.isActive for p in pumps)
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean[:] | b | Boolean vector |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | result | = true, if at least one element of b is true |
