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.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | target | Real | | |
| input | current | Real | | |
| input | maxStep | Real | | |
| output | result | Real | |
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;