This package contains the following basic mathematical functions:
sin(u) sine cos(u) cosine tan(u) tangent (u shall not be -pi/2, pi/2, 3*pi/2, ...) asin(u) inverse sine (-1 <= u <= 1) acos(u) inverse cosine (-1 <= u <= 1) atan(u) inverse tangent atan2(u1,u2) four quadrant inverse tangent sinh(u) hyperbolic sine cosh(u) hyperbolic cosine tanh(u) hyperbolic tangent exp(u) exponential, base e log(u) natural (base e) logarithm (u > 0) log10(u) base 10 logarithm (u > 0)
These functions are used by calling them directly with a full name (e.g. y = Modelica.Math.asin(0.5)).
Release Notes:
Copyright (C) 1999-2000, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in the documentation of package Modelica in file "Modelica/package.mo".
partial function baseIcon1 "Basic icon for mathematical function with y-axis on left side" end baseIcon1;
partial function baseIcon2 "Basic icon for mathematical function with y-axis in middle" end baseIcon2;
function sin "sine" extends baseIcon1; input Angle u; output Real y; external "C" y = sin(u); end sin;
function cos "cosine" extends baseIcon1; input Angle u; output Real y; external "C" y = cos(u); end cos;
function tan "tangent (u shall not be -pi/2, pi/2, 3*pi/2, ...)" extends baseIcon2; input Angle u; output Real y; external "C" y = tan(u); end tan;
function asin "inverse sine (-1 <= u <= 1)" extends baseIcon2; input Real u; output Angle y; external "C" y = asin(u); end asin;
function acos "inverse cosine (-1 <= u <= 1)" extends baseIcon2; input Real u; output Angle y; external "C" y = acos(u); end acos;
function atan "inverse tangent" extends baseIcon2; input Real u; output Angle y; external "C" y = atan(u); end atan;
function atan2 "four quadrant inverse tangent" extends baseIcon2; input Real u1; input Real u2; output Angle y; external "C" y = atan2(u1, u2); end atan2;
function sinh "hyperbolic sine" extends baseIcon2; input Real u; output Real y; external "C" y = sinh(u); end sinh;
function cosh "hyperbolic cosine" extends baseIcon2; input Real u; output Real y; external "C" y = cosh(u); end cosh;
function tanh "hyperbolic tangent" extends baseIcon2; input Real u; output Real y; external "C" y = tanh(u); end tanh;
function exp "exponential, base e" extends baseIcon2; input Real u; output Real y; external "C" y = exp(u); end exp;
function log "natural (base e) logarithm (u shall be > 0)" extends baseIcon1; input Real u; output Real y; external "C" y = log(u); end log;
function log10 "base 10 logarithm (u shall be > 0)" extends baseIcon1; input Real u; output Real y; external "C" y = log10(u); end log10;
function tempInterpol1 "temporary routine for linear interpolation (will be removed)" input Real u "in1;put value (first column of table)"; input Real table[:, :] "table to be interpolated"; input Integer icol "column of table to be interpolated"; output Real y "interpolated input value (icol column of table)"; protected Integer i; Integer n "number of rows of table"; Real u1; Real u2; Real y1; Real y2; algorithm n := size(table, 1); if n <= 1 then y := table[1, icol]; else // Search interval if u <= table[1, 1] then i := 1; else i := 2; while i < n and u > table[i, 1] loop i := i + 1; end while; i := i - 1; end if; // Get interpolation data u1 := table[i, 1]; u2 := table[i + 1, 1]; y1 := table[i, icol]; y2 := table[i + 1, icol]; // Interpolate if u1 >= u2 then y := y1; // since not possible to throw error else y := y1 + (y2 - y1)*(u - u1)/(u2 - u1); end if; end if; end tempInterpol1;