CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

LieGroups.Util.saturate

Clamp scalar to [x_min, x_max]

Public declarations

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

RoleNameTypeDimensions / attributes / defaultDescription
inputxReal
inputx_minReal
inputx_maxReal
outputyReal

Modelica declarations and implementation

Show parameters, interfaces and source

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

function saturate "Clamp scalar to [x_min, x_max]"
  input Real x;
  input Real x_min;
  input Real x_max;
  output Real y;
algorithm
  y := if x > x_max then x_max elseif x < x_min then x_min else x;
end saturate;