CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

MathUtilities.clipVector

Clamp every element of a vector to a closed interval

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputvalueReal[:]
inputlowerReal
inputupperReal
outputresultReal[size(value, 1)]

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function clipVector "Clamp every element of a vector to a closed interval"
  input Real value[:];
  input Real lower;
  input Real upper;
  output Real result[size(value, 1)];
algorithm
  for index in 1:size(value, 1) loop
    result[index] := MathUtilities.clip(value[index], lower, upper);
  end for;
  annotation(Inline = true);
end clipVector;