## smoothOrdersmoothOrder |

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Define differentiability of function body

annotation"(" smoothOrder "=" UNSIGNED_INTEGER ")"annotation"(" smoothOrder "(" normallyConstant=NAME ["," normallyConstant=NAME] ")" "=" UNSIGNED_NUMBER ")"

This annotation has only an effect within a function declaration.

smoothOrder defines the number of differentiations of the function, in order that all of the differentiated outputs are continuous provided all input arguments and their derivatives up to order smoothOrder are continuous.

This means that the function is at least C^{smoothOrder}. smoothOrder = 1 means that the function can be differentiated at least once in order that all output arguments are still continuous, provided the input arguments are continuous. If a tool needs the derivative of a function, e.g., for index reduction or to compute an analytic Jacobian, the function can be differentiated analytically at most smoothOrder times.

The optional argument `normallyConstant`

of `smoothOrder`

defines that the function argument `NAME`

is usually constant.

This annotation is used by many functions of the Modelica.Fluid library, such as Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_laminar_DP, since geometric arguments to these functions are usually constant.

functionSpecialPolynomialinputReal u;outputReal y;algorithmy =ifu > 0thenu^2else0;annotation(smoothOrder = 1);endSpecialPolynomial;modelTestSpecialPolynomial Real y; Real yd; Real ydd;equationy = SpecialPolynomial(sin(time)); yd =der(y); // fine, SpecialPolynomial is analytically differentiated once ydd =der(yd); // error, SpecialPolynomial cannot be differentiated twiceendTestSpecialPolynomial;