CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

MathUtilities.rateLimit

Limit the change from a current value to a target

Public declarations

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

RoleNameTypeDimensions / attributes / defaultDescription
inputtargetReal
inputcurrentReal
inputmaxStepReal
outputresultReal

Modelica declarations and implementation

Show parameters, interfaces and source

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

function rateLimit "Limit the change from a current value to a target"
  input Real target;
  input Real current;
  input Real maxStep;
  output Real result;
algorithm
  result := current + MathUtilities.clip(target - current, -maxStep, maxStep);
  annotation(Inline = true);
end rateLimit;