function
Tests.ManualGuidanceTests.shapingMinimumSlope
Smallest forward difference of the stick curve outside the dead band
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| output | slope | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function shapingMinimumSlope
"Smallest forward difference of the stick curve outside the dead band"
output Real slope;
protected
constant Integer samples = 81;
constant Real step = 1.0 / (samples - 1);
Real position;
algorithm
slope := 1.0e30;
for index in 1:samples - 1 loop
position := deadband + (1.0 - deadband) * (index - 1) * step;
slope := min(slope,
(shapedStick(position + step) - shapedStick(position)) / step);
end for;
end shapingMinimumSlope;