CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

Tests.ManualGuidanceTests.shapingOddnessResidual

Largest failure of odd symmetry over the stick travel

Public declarations

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

RoleNameTypeDimensions / attributes / defaultDescription
outputresidualReal

Modelica declarations and implementation

Show parameters, interfaces and source

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

function shapingOddnessResidual
    "Largest failure of odd symmetry over the stick travel"
    output Real residual;
  protected
    constant Integer samples = 81;
    Real position;
  algorithm
    residual := 0.0;
    for index in 1:samples loop
      position := -1.0 + 2.0 * (index - 1) / (samples - 1);
      residual := max(residual,
        abs(shapedStick(position) + shapedStick(-position)));
    end for;
  end shapingOddnessResidual;