.ModelicaReference.Operators.'der()'

Information

Time derivative of expression or
partial derivative of function

Syntax

der(expr) or
IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment

Description

The first form is the time derivative of expression expr. If the expression expr is a scalar it needs to be a subtype of Real. The expression and all its subexpressions must be differentiable. If expr is an array, the operator is applied to all elements of the array. For Real parameters and constants the result is a zero scalar or array of the same size as the variable.

The second form is the partial derivative of a function and may only be used as declarations of functions. The semantics is that a function [and only a function] can be specified in this form, defining that it is the partial derivative of the function to the right of the equal sign (looked up in the same way as a short class definition - the looked up name must be a function), and partially differentiated with respect to each IDENT in order (starting from the first one). The IDENT must be Real inputs to the function. The comment allows a user to comment the function (in the info-layer and as one-line description, and as icon).

Examples

  Real x, xdot1, xdot2;
equation
  xdot1 = der(x);
  xdot2 = der(x*sin(x));

The specific enthalpy can be computed from a Gibbs-function as follows:

function Gibbs
  input Real p,T;
  output Real g;
algorithm
  ...
end Gibbs;

function Gibbs_T=der(Gibbs, T);

function specificEnthalpy
  input Real p,T;
  output Real h;
algorithm
  h:=Gibbs(p,T)-T*Gibbs_T(p,T);
end specificEnthalpy;

Generated at 2024-12-21T19:25:56Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos