Library with functions such as for smoothing
This package contains blocks and functions for commonly used mathematical operations. The classes in this package augment the classes Modelica.Blocks.
Extends from Modelica.Icons.Package (Icon for standard packages).
Name | Description |
---|---|
Average | Average of a vector |
Bicubic | Bicubic function |
Biquadratic | Biquadratic function |
BooleanReplicator | Boolean signal replicator |
IntegerReplicator | Integer signal replicator |
IntegratorWithReset | Output the integral of the input signal |
InverseXRegularized | Function that approximates 1/x by a twice continuously differentiable function |
Max | Maximum element of a vector |
Min | Minimum element of a vector |
Polynominal | Polynominal 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 |
RegNonZeroPower | Power function, regularized near zero, but nonzero value for x=0 |
SmoothExponential | Once continuously differentiable approximation to exp(-|x|) in interval |x| < delta |
SmoothHeaviside | Once continuously differentiable approximation to the Heaviside function |
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 |
Splice | Block for splice function opertation |
TrapezoidalIntegration | Integration using the trapezoidal rule |
Functions | Package with mathematical functions |
Examples | Collection of models that illustrate model use and test models |
Average of a vector
This block outputs the average of the vector.
Extends from Modelica.Blocks.Interfaces.MISO (Multiple Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | 1 | Number of inputs |
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y | Connector of Real output signal |
Bicubic function
This block 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.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block).
Type | Name | Description |
---|---|---|
input RealInput | u1 | Connector of Real input signal 1 |
input RealInput | u2 | Connector of Real input signal 2 |
output RealOutput | y | Connector of Real output signal |
Biquadratic function
This block computes
y = a1 + a2 x1 + a3 x12 + a4 x2 + a5 x22 + a6 x1 x2
Extends from Modelica.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | a[6] | Coefficients |
Type | Name | Description |
---|---|---|
input RealInput | u1 | Connector of Real input signal 1 |
input RealInput | u2 | Connector of Real input signal 2 |
output RealOutput | y | Connector of Real output signal |
Boolean signal replicator
This block replicates the boolean input signal to an array of nout
identical output signals.
Extends from Modelica.Blocks.Icons.BooleanBlock (Basic graphical layout of Boolean block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nout | 1 | Number of outputs |
Type | Name | Description |
---|---|---|
input BooleanInput | u | Connector of boolean input signal |
output BooleanOutput | y[nout] | Connector of boolean output signals |
Integer signal replicator
This block replicates the integer input signal to an array of nout
identical output signals.
Extends from Modelica.Blocks.Icons.IntegerBlock (Basic graphical layout of Integer block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nout | 1 | Number of outputs |
Type | Name | Description |
---|---|---|
input IntegerInput | u | Connector of integer input signal |
output IntegerOutput | y[nout] | Connector of integer output signals |
Output the integral of the input signal
This model is similar to
Modelica.Blocks.Continuous.Integrator
except that it optionally allows to reset the output y
of the integrator.
The output of the integrator can be reset as follows:
reset = Annex60.Types.Reset.Disabled
, which is the default,
then the integrator is never reset.
reset = Annex60.Types.Reset.Parameter
, then a boolean
input signal trigger
is enabled. Whenever the value of
this input changes from false
to true
,
the integrator is reset by setting y
to the value of the parameter y_reset
.
reset = Annex60.Types.Reset.Input
, then a boolean
input signal trigger
is enabled. Whenever the value of
this input changes from false
to true
,
the integrator is reset by setting y
to the value of the input signal y_reset_in
.
See Annex60.Utilities.Math.Examples.IntegratorWithReset for an example.
To adjust the icon layer, the code of Modelica.Blocks.Continuous.Integrator has been copied into this model rather than extended.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | k | 1 | Integrator gain [1] |
Reset | reset | Annex60.Types.Reset.Disabled | Type of integrator reset |
Initialization | |||
RealOutput | y.start | y_start | Connector of Real output signal |
Init | initType | Modelica.Blocks.Types.Init.I... | Type of initialization (1: no init, 2: steady state, 3,4: initial output) |
Real | y_start | 0 | Initial or guess value of output (= state) |
Integrator reset | |||
Real | y_reset | 0 | Value to which integrator is reset, used if reset = Annex60.Types.Reset.Parameter |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
input RealInput | y_reset_in | Input signal for state to which integrator is reset, enabled if reset = Annex60.Types.Reset.Input |
input BooleanInput | trigger | Resets the integrator output when trigger becomes true |
Function that approximates 1/x by a twice continuously differentiable function
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 package Examples
for the graph.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | delta | Abscissa value below which approximation occurs |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Maximum element of a vector
Outputs the maximum of the vector.
Extends from Modelica.Blocks.Interfaces.MISO (Multiple Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | 1 | Number of inputs |
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y | Connector of Real output signal |
Minimum element of a vector
Outputs the minimum of the vector.
Extends from Modelica.Blocks.Interfaces.MISO (Multiple Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | 1 | Number of inputs |
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y | Connector of Real output signal |
Polynominal function
This block computes a polynomial of arbitrary order. The polynomial has the form
y = a1 + a2 x + a3 x2 + ...
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | a[:] | Coefficients |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Power function that is linearized below a user-defined threshold
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.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | n | Exponent | |
Real | x0 | Abscissa value below which linearization occurs |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Function that is quadratic in first argument and linear in second argument
Block for function quadraticLinear, which computes
y = a1 + a2 x1 + a3 x12 + (a4 + a5 x1 + a6 x12) x2
Extends from Modelica.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | a[6] | Coefficients |
Type | Name | Description |
---|---|---|
input RealInput | u1 | Connector of Real input signal 1 |
input RealInput | u2 | Connector of Real input signal 2 |
output RealOutput | y | Connector of Real output signal |
Power function, regularized near zero, but nonzero value for x=0
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 packageExamples
for the graph.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | n | Exponent | |
Real | delta | 0.01 | Abscissa value where transition occurs |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Once continuously differentiable approximation to exp(-|x|) in interval |x| < delta
Function to provide a once continuously differentiable approximation to exp(- |x| ) in the interval |x| for some positive δ
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | delta | Transition point where approximation occurs |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Once continuously differentiable approximation to the Heaviside function
Once Lipschitz continuously differentiable approximation to the Heaviside(.,.) function. See Example Annex60.Utilities.Math.Examples.SmoothHeaviside.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | delta | Width of transition interval |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Once continuously differentiable approximation to the limit function
Once continuously differentiable approximation to the limit(.,.) function. The output is bounded to be in [lower, upper].
Note that the limit need not be respected, such as illustrated in Annex60.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | deltaX | Width of transition interval | |
Real | upper | Upper limit | |
Real | lower | Lower limit |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Once continuously differentiable approximation to the maximum function
Once continuously differentiable approximation to the max(.,.) function.
Note that the maximum need not be respected, such as illustrated in Annex60.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | deltaX | Width of transition interval |
Type | Name | Description |
---|---|---|
input RealInput | u1 | Connector of Real input signal 1 |
input RealInput | u2 | Connector of Real input signal 2 |
output RealOutput | y | Connector of Real output signal |
Once continuously differentiable approximation to the minimum function
Once continuously differentiable approximation to the min(.,.) function.
Note that the minimum need not be respected, such as illustrated in Annex60.Utilities.Math.Examples.SmoothMin.
Extends from Modelica.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Real | deltaX | Width of transition interval |
Type | Name | Description |
---|---|---|
input RealInput | u1 | Connector of Real input signal 1 |
input RealInput | u2 | Connector of Real input signal 2 |
output RealOutput | y | Connector of Real output signal |
Block for splice function opertation
This block implements Annex60.Utilities.Math.Functions.spliceFunction, which provides a continuously differentiable transition between two arguments.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Type | Name | Default | Description |
---|---|---|---|
Real | deltax | Half width of transition interval |
Type | Name | Description |
---|---|---|
input RealInput | x | Independent value |
input RealInput | u1 | Argument of u > 0 (pos) |
input RealInput | u2 | Argument of u < 0 (neg) |
output RealOutput | y | Smoothed value |
Integration using the trapezoidal rule
This function computes a definite integral using the trapezoidal rule.
Extends from Modelica.Blocks.Interfaces.MISO (Multiple Input Single Output continuous control block).
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | 1 | Number of inputs |
Integer | N | Number of integrand points | |
Real | deltaX | Width of interval for Trapezoidal integration |
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y | Connector of Real output signal |