Buildings.Utilities.Math.Functions
Package with mathematical functions
Information
This package contains functions for commonly used mathematical operations. The functions are used in the blocks Buildings.Utilities.Math.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Package Content
Name | Description |
---|---|
average | Average of a vector |
besselJ0 | Bessel function of the first kind of order 0, J0 |
besselJ1 | Bessel function of the first kind of order 1, J1 |
besselY0 | Bessel function of the second kind of order 0, Y0 |
besselY1 | Bessel function of the second kind of order 1, Y1 |
bicubic | Bicubic function |
binomial | Returns the binomial coefficient |
biquadratic | Biquadratic function |
booleanReplicator | Replicates Boolean signals |
cubicHermiteLinearExtrapolation | Interpolate using a cubic Hermite spline with linear extrapolation |
exponentialIntegralE1 | Exponential integral, E1 |
factorial | Returns the value n! as an integer |
fallingFactorial | Returns the k-th falling factorial of n |
integerReplicator | Replicates integer signals |
inverseXRegularized | Function that approximates 1/x by a twice continuously differentiable function |
isMonotonic | Returns true if the argument is a monotonic sequence |
polynomial | Polynomial function |
powerLinearized | Power function that is linearized below a user-defined threshold |
quadraticLinear | Function that is quadratic in first argument and linear in second argument |
quinticHermite | Quintic Hermite spline function for interpolation between two functions with a continuous second derivative |
regNonZeroPower | Power function, regularized near zero, but nonzero value for x=0 |
regStep | Approximation of a general step, such that the approximation is continuous and differentiable |
round | Round real number to specified digits |
smoothExponential | Once continuously differentiable approximation to exp(-|x|) in interval |x| < delta |
smoothHeaviside | Twice continuously differentiable approximation to the Heaviside function |
smoothInterpolation | Interpolate using a cubic Hermite spline with linear extrapolation for a vector xSup[], ySup[] and independent variable x |
smoothLimit | Once continuously differentiable approximation to the limit function |
smoothMax | Once continuously differentiable approximation to the maximum function |
smoothMin | Once continuously differentiable approximation to the minimum function |
spliceFunction | |
splineDerivatives | Function to compute the derivatives for cubic hermite spline interpolation |
trapezoidalIntegration | Integration using the trapezoidal rule |
Examples | Collection of models that illustrate model use and test models |
BaseClasses | Package with base classes for Buildings.Utilities.Math.Functions |
Buildings.Utilities.Math.Functions.average
Average of a vector
Information
This function outputs the average of the vector.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | Number of inputs | |
Real | u[nin] | Input vector |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.besselJ0
Bessel function of the first kind of order 0, J0
Information
Evaluates the Bessel function of the first kind of order 0 (J0), based on the implementations of Press et al. (1986).
References
Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. Numerical Recipes - The Art of Scientific Computing. Cambridge University Press (1986): 988 p.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | J0 | Bessel function J0(x) |
Modelica definition
Buildings.Utilities.Math.Functions.besselJ1
Bessel function of the first kind of order 1, J1
Information
Evaluates the Bessel function of the first kind of order 1 (J1), based on the implementations of Press et al. (1986).
References
Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. Numerical Recipes - The Art of Scientific Computing. Cambridge University Press (1986): 988 p.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | J1 | Bessel function J1(x) |
Modelica definition
Buildings.Utilities.Math.Functions.besselY0
Bessel function of the second kind of order 0, Y0
Information
Evaluates the Bessel function of the second kind of order 0 (Y0), based on the implementations of Press et al. (1986).
References
Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. Numerical Recipes - The Art of Scientific Computing. Cambridge University Press (1986): 988 p.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | Y0 | Bessel function Y0(x) |
Modelica definition
Buildings.Utilities.Math.Functions.besselY1
Bessel function of the second kind of order 1, Y1
Information
Evaluates the Bessel function of the second kind of order 1 (Y1), based on the implementations of Press et al. (1986).
References
Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. Numerical Recipes - The Art of Scientific Computing. Cambridge University Press (1986): 988 p.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | Y1 | Bessel function J1(x) |
Modelica definition
Buildings.Utilities.Math.Functions.bicubic
Bicubic function
Information
This function computes
y = a1 + a2 x1 + a3 x12 + a4 x2 + a5 x22 + a6 x1 x2 + a7 x1^3 + a8 x2^3 + a9 x12 x2 + a10 x1 x22
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | a[10] | Coefficients | |
Real | x1 | Independent variable | |
Real | x2 | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.binomial
Returns the binomial coefficient
Information
Function that evaluates the binomial coefficient "n choose k".
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | n | Size of set | |
Integer | k | Size of subsets |
Outputs
Type | Name | Description |
---|---|---|
Integer | binom | Binomial coefficient |
Modelica definition
Buildings.Utilities.Math.Functions.biquadratic
Biquadratic function
Information
This function computesy = a1 + a2 x1 + a3 x12 + a4 x2 + a5 x22 + a6 x1 x2
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | a[6] | Coefficients | |
Real | x1 | Independent variable | |
Real | x2 | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.booleanReplicator
Replicates Boolean signals
Information
This function replicates the boolean input signal to an array of nout
identical output signals.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | nout | 1 | Number of outouts |
Boolean | u | Boolean input signal |
Outputs
Type | Name | Description |
---|---|---|
Boolean | y[nout] | Boolean output signals |
Modelica definition
Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation
Interpolate using a cubic Hermite spline with linear extrapolation
Information
For x1 < x < x2, this function interpolates using cubic hermite spline. For x outside this interval, the function linearly extrapolates.
For how to use this function, see Buildings.Utilities.Math.Functions.Examples.CubicHermite.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | x1 | Lower abscissa value | |
Real | x2 | Upper abscissa value | |
Real | y1 | Lower ordinate value | |
Real | y2 | Upper ordinate value | |
Real | y1d | Lower gradient | |
Real | y2d | Upper gradient |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Interpolated ordinate value |
Modelica definition
Buildings.Utilities.Math.Functions.exponentialIntegralE1
Exponential integral, E1
Information
Evaluates the exponential integral (E1), based on the polynomial and rational approximations of Abramowitz and Stegun (1964).
References
Abramowitz, Milton, and Irene A. Stegun. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards. (1964): 1046 p.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable |
Outputs
Type | Name | Description |
---|---|---|
Real | E1 | Exponential integral E1(x) |
Modelica definition
Buildings.Utilities.Math.Functions.factorial
Returns the value n! as an integer
Information
Function that returns the factorial n! for 0 ≤ n ≤ 12.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | n | Integer number |
Outputs
Type | Name | Description |
---|---|---|
Integer | f | Factorial of n |
Modelica definition
Buildings.Utilities.Math.Functions.fallingFactorial
Returns the k-th falling factorial of n
Information
Function that evaluates the falling factorial "k-permutations of n".
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | n | Integer number | |
Integer | k | Falling factorial power |
Outputs
Type | Name | Description |
---|---|---|
Integer | f | k-th falling factorial of n |
Modelica definition
Buildings.Utilities.Math.Functions.integerReplicator
Replicates integer signals
Information
This function replicates the integer input signal to an array of
nout
identical output signals.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | nout | Number of outputs | |
Integer | u | Integer input signal |
Outputs
Type | Name | Description |
---|---|---|
Integer | y[nout] | Integer output signals |
Modelica definition
Buildings.Utilities.Math.Functions.inverseXRegularized
Function that approximates 1/x by a twice continuously differentiable function
Information
Function that approximates y=1 ⁄ x inside the interval -δ ≤ x ≤ δ. The approximation is twice continuously differentiable with a bounded derivative on the whole real line.
See the plot of Buildings.Utilities.Math.Functions.Examples.InverseXRegularized for the graph.
For efficiency, the polynomial coefficients
a, b, c, d, e, f
and
the inverse of the smoothing parameter deltaInv
are exposed as arguments to this function.
Typically, these coefficients only depend on parameters and hence
can be computed once.
They must be equal to their default values, otherwise the function
is not twice continuously differentiable.
By exposing these coefficients as function arguments, models
that call this function can compute them as parameters, and
assign these parameter values in the function call.
This avoids that the coefficients are evaluated for each time step,
as they would otherwise be if they were to be computed inside the
body of the function. However, assigning the values is optional
as otherwise, at the expense of efficiency, the values will be
computed each time the function is invoked.
See
Buildings.Utilities.Math.Functions.Examples.InverseXRegularized
for how to efficiently call this function.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | delta | Abscissa value below which approximation occurs | |
Real | deltaInv | 1/delta | Inverse value of delta |
Real | a | -15*deltaInv | Polynomial coefficient |
Real | b | 119*deltaInv^2 | Polynomial coefficient |
Real | c | -361*deltaInv^3 | Polynomial coefficient |
Real | d | 534*deltaInv^4 | Polynomial coefficient |
Real | e | -380*deltaInv^5 | Polynomial coefficient |
Real | f | 104*deltaInv^6 | Polynomial coefficient |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Function value |
Modelica definition
Buildings.Utilities.Math.Functions.isMonotonic
Returns true if the argument is a monotonic sequence
Information
This function returns true
if its argument is
monotonic increasing or decreasing, and false
otherwise.
If strict=true
, then strict monotonicity is tested,
otherwise weak monotonicity is tested.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x[:] | Sequence to be tested | |
Boolean | strict | false | Set to true to test for strict monotonicity |
Outputs
Type | Name | Description |
---|---|---|
Boolean | monotonic | True if x is monotonic increasing or decreasing |
Modelica definition
Buildings.Utilities.Math.Functions.polynomial
Polynomial function
Information
This function computes a polynomial of arbitrary order. The polynomial has the formy = a1 + a2 x + a3 x2 + ...
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Independent variable | |
Real | a[:] | Coefficients |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.powerLinearized
Power function that is linearized below a user-defined threshold
Information
Function that approximates y=xn where 0 < n so that- the function is defined and monotonically increasing for all x.
- dy/dx is bounded and continuous everywhere (for n < 1).
For x < x0, this function replaces y=xn by a linear function that is continuously differentiable everywhere.
A typical use of this function is to replace T = T4(1/4) in a radiation balance to ensure that the function is defined everywhere. This can help solving the initialization problem when a solver may be far from a solution and hence T4 < 0.
See the package Examples
for the graph.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | n | Exponent | |
Real | x0 | Abscissa value below which linearization occurs |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Function value |
Modelica definition
Buildings.Utilities.Math.Functions.quadraticLinear
Function that is quadratic in first argument and linear in second argument
Information
This function computesy = a1 + a2 x1 + a3 x12 + (a4 + a5 x1 + a6 x12) x2
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | a[6] | Coefficients | |
Real | x1 | Independent variable for quadratic part | |
Real | x2 | Independent variable for linear part |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.quinticHermite
Quintic Hermite spline function for interpolation between two functions with a continuous second derivative
Information
Returns the result y of a quintic Hermite spline,
which is a C2 continuous interpolation between two functions.
The abscissa value x
has to be between x1
and x2
.
Variables y1
, y1d
, y1dd
are the ordinate,
ordinate derivative and ordinate second derivative of the function at x1
.
Variables y2
, y2d
, y2dd
are respectively the ordinate,
ordinate derivative and ordinate second derivative of the function at x2
.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | x1 | Lower abscissa value | |
Real | x2 | Upper abscissa value | |
Real | y1 | Lower ordinate value | |
Real | y2 | Upper ordinate value | |
Real | y1d | Lower derivative | |
Real | y2d | Upper derivative | |
Real | y1dd | Lower second derivative | |
Real | y2dd | Upper second derivative |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Interpolated ordinate value |
Modelica definition
Buildings.Utilities.Math.Functions.regNonZeroPower
Power function, regularized near zero, but nonzero value for x=0
Information
Function that approximates y=|x|n where 0 < n < 2 so that
- y(0) is not equal to zero.
- dy/dx is bounded and continuous everywhere.
This function replaces y=|x|n in the interval -δ...+δ by a 4-th order polynomial that has the same function value and the first and second derivative at x=± δ.
A typical use of this function is to replace the function for the convective heat transfer coefficient for forced or free convection that is of the form h=c |dT|n for some constant c and exponent 0 < n ≤ 1. By using this function, the original function that has an infinite derivative near zero and that takes on zero at the origin is replaced by a function with a bounded derivative and a non-zero value at the origin. Physically, the region -δ...+δ may be interpreted as the region where heat conduction dominates convection in the boundary layer.
See the package Examples
for the graph.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | n | Exponent | |
Real | delta | 0.01 | Abscissa value where transition occurs |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Function value |
Modelica definition
Buildings.Utilities.Math.Functions.regStep
Approximation of a general step, such that the approximation is continuous and differentiable
Information
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
.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | y1 | Ordinate value for x > 0 | |
Real | y2 | Ordinate value for x < 0 | |
Real | x_small | 1e-5 | Approximation of step for -x_small <= x <= x_small; x_small >= 0 required |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Ordinate value to approximate y = if x > 0 then y1 else y2 |
Modelica definition
Buildings.Utilities.Math.Functions.round
Round real number to specified digits
Information
Function that outputs the input after rounding it to n
digits.
For example,
-
set
n = 0
to round to the nearest integer, -
set
n = 1
to round to the next decimal point, and -
set
n = -1
to round to the next multiple of ten.
Hence, the function outputs
y = floor(x*(10^n) + 0.5)/(10^n) for x > 0, y = ceil( x*(10^n) - 0.5)/(10^n) for x < 0.
To use this function as a block, use Buildings.Controls.OBC.CDL.Reals.Round.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Argument to be rounded | |
Integer | n | Number of digits being round to |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Connector of Real output signal |
Modelica definition
Buildings.Utilities.Math.Functions.smoothExponential
Once continuously differentiable approximation to exp(-|x|) in interval |x| < delta
Information
Function to provide a once continuously differentiable approximation to exp(- |x| ) in the interval |x| < δ for some positive δ
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Input argument | |
Real | delta | Transition point where approximation occurs |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Output argument |
Modelica definition
Buildings.Utilities.Math.Functions.smoothHeaviside
Twice continuously differentiable approximation to the Heaviside function
Information
Twice Lipschitz continuously differentiable approximation to the
Heaviside(.,.)
function.
Function is derived from a quintic polynomial going through (0,0) and (1,1),
with zero first and second order derivatives at those points.
See Example
Buildings.Utilities.Math.Examples.SmoothHeaviside.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Argument | |
Real | delta | Parameter used for scaling |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.smoothInterpolation
Interpolate using a cubic Hermite spline with linear extrapolation for a vector xSup[], ySup[] and independent variable x
Information
For xSup1 ≤ x ≤ xSupn, where n is the size of the support points xSup, which must be strictly monotonically increasing, this function interpolates using cubic hermite spline. For x outside this interval, the function linearly extrapolates.
If n=2, linear interpolation is used an if n=1, the function value y1 is returned.
Note that if xSup
and ySup
only depend on parameters
or constants, then
Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation
will be more efficient.
In contrast to the function
Modelica.Math.Vectors.interpolate
which provides linear interpolation, this function does
not trigger events.
For how to use this function, see Buildings.Utilities.Math.Functions.Examples.SmoothInterpolation.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Abscissa value | |
Real | xSup[:] | Support points (strictly increasing) | |
Real | ySup[size(xSup, 1)] | Function values at xSup | |
Boolean | ensureMonotonicity | isMonotonic(ySup, strict=fal... | Set to true to ensure monotonicity of the cubic hermite |
Outputs
Type | Name | Description |
---|---|---|
Real | yInt | Interpolated ordinate value |
Modelica definition
Buildings.Utilities.Math.Functions.smoothLimit
Once continuously differentiable approximation to the limit function
Information
Once continuously differentiable approximation to the limit(.,.)
function.
The output is bounded to be in [l, u].
Note that the limit need not be respected, such as illustrated in Buildings.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | Variable | |
Real | l | Low limit | |
Real | u | Upper limit | |
Real | deltaX | Width of transition interval |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.smoothMax
Once continuously differentiable approximation to the maximum function
Information
Once continuously differentiable approximation to the max(.,.)
function.
Note that the maximum need not be respected, such as illustrated in Buildings.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x1 | First argument | |
Real | x2 | Second argument | |
Real | deltaX | Width of transition interval |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.smoothMin
Once continuously differentiable approximation to the minimum function
Information
Once continuously differentiable approximation to the min(.,.)
function.
Note that the minimum need not be respected, such as illustrated in Buildings.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x1 | First argument | |
Real | x2 | Second argument | |
Real | deltaX | Width of transition interval |
Outputs
Type | Name | Description |
---|---|---|
Real | y | Result |
Modelica definition
Buildings.Utilities.Math.Functions.spliceFunction
Information
Function to provide a once continuously differentiable transition between to arguments.
The function is adapted from Modelica.Media.Air.MoistAir.Utilities.spliceFunction and provided here for easier accessability to model developers.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | pos | Argument of x > 0 | |
Real | neg | Argument of x < 0 | |
Real | x | Independent value | |
Real | deltax | Half width of transition interval |
Outputs
Type | Name | Description |
---|---|---|
Real | out | Smoothed value |
Modelica definition
Buildings.Utilities.Math.Functions.splineDerivatives
Function to compute the derivatives for cubic hermite spline interpolation
Information
This function computes the derivatives at the support points xi that can be used as input for evaluating a cubic hermite spline.
If ensureMonotonicity=true
, then the support points yi
need to be monotone increasing (or decreasing), and the computed derivatives
di are such that the cubic hermite is monotone increasing (or decreasing).
The algorithm to ensure monotonicity is based on the method described in Fritsch and Carlson (1980) for
ρ = ρ2.
This function is typically used with Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation which is used to evaluate the cubic spline. Because in many applications, the shape of the spline depends on parameters which will no longer change once the initialisation is complete, this function computes and stores the derivatives only once instead of doing so at each time step to save system resources.
References
F.N. Fritsch and R.E. Carlson, Monotone piecewise cubic interpolation. SIAM J. Numer. Anal., 17 (1980), pp. 238-246.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x[:] | Support point, strictly increasing | |
Real | y[size(x, 1)] | Function values at x | |
Boolean | ensureMonotonicity | isMonotonic(y, strict=false) | Set to true to ensure monotonicity of the cubic hermite |
Outputs
Type | Name | Description |
---|---|---|
Real | d[size(x, 1)] | Derivative at the support points |
Modelica definition
Buildings.Utilities.Math.Functions.trapezoidalIntegration
Integration using the trapezoidal rule
Information
This function computes a definite integral using the trapezoidal rule.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Integer | N | Number of integrand points | |
Real | f[:] | Integrands | |
Real | deltaX | Width of interval for Trapezoidal integration |
Outputs
Type | Name | Description |
---|---|---|
Real | result | Result |