functionregStep

Approximation of a general step, such that the characteristic is continuous and differentiable

Extends from Modelica.Icons.Function (Icon for functions).

Information

This function is a copy pasting of the same function from the MSL library with Modelica 3.2.3 . The function is copied rather than inherited to avoid regression issues due to an update of the function in further version of the MSL.

This function is used to approximate the equation

  y = if x > 0 then y1 else y2;

by a smooth characteristic, so that the expression is continuous and differentiable:

 y = smooth(1, if x >  x_small then y1 else
               if x < -x_small then y2 else f(y1, y2));

In the region -x_small < x < x_small a 2nd order polynomial is used for a smooth transition from y1 to y2.

Inputs

TypeNameDefaultDescription
RealxAbscissa value
Realy1Ordinate value for x > 0
Realy2Ordinate value for x < 0
Realx_small1e-5Approximation of step for -x_small <= x <= x_small; x_small >= 0 required

Outputs

TypeNameDefaultDescription
RealyOrdinate value to approximate y = if x > 0 then y1 else y2

Revisions

  • April 29, 2008 by Martin Otter:
    Designed and implemented.
  • August 12, 2008 by Michael Sielemann:
    Minor modification to cover the limit case x_small -> 0 without division by zero.