.Modelica_Requirements.LogicalFunctions.exists

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)

Interface

function exists
  extends Modelica.Icons.Function;
  input Boolean b[:] "Boolean vector";
  output Boolean result "= true, if at least one element of b is true";
end exists;

Generated at 2024-12-03T19:25:34Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos