User-Defined Expression
Description
User-Defined Expression
This control block allows the user to write any mathematical expression that are evaluated at every time-step/iterations. Variables named "i1","i2"..."in" can be used to represent model inputs.
Example of supported expressions:
- sin(2*i1)
- max(i1, i2)
- sqrt(i1ˆ2 + i2ˆ2)
This device should be used for "continuous" variables only. SIMBA will not consider discontinuities generated by user-defined expressions as such and therefore will not reduce the time steps. For example, it should not be used in place of a comparator controlling a switch.
The tables below present the list of functions and operators supported by this model.
Function name | Description | Example |
---|---|---|
abs | absolute value | abs(i1) |
acos | arcus cosine | acos(i1) |
acosh | hyperbolic arcus cosine | acosh(i1) |
asin | arcus sine | asin(i1) |
asinh | hyperbolic arcus sine | asinh(i1) |
atan | arcus tangent | atan(i1) |
atanh | hyperbolic arcus tangent | atanh(i1) |
atan2 | 2-arguments arcus tangent | atan2(i1) |
avg | average value | avg(i1,i2,...) |
cos | cosine | cos(i1) |
cosh | hyperbolic cosine | cosh(i1) |
exp | exponential function | exp(i1) |
ln | natural logarithm | ln(i1) |
log | natural logarithm | log(i1) |
log2 | 2-base logarithm | log2(i1) |
log10 | 10-base logarithm | log10(i1) |
max | maximal value | max(i1,i2,...) |
min | minimal value | min(i1,i2,...) |
rint | round to nearest interger | rint(i1) |
sin | sine | sin(i1) |
sinh | hyperbolic sine | sinh(i1) |
sqrt | square root value | sqrt(i1) |
sum | sum of all arguments | sum(i1,i2,...) |
tan | tangent | tan(i1) |
tanh | hyperbolic tangent | tanh(i1) |
Operator | Description | Example |
---|---|---|
+ | addition | i1+i2 |
- | subtraction | i1-i2 |
* | multiplication | i1*i2 |
/ | division | i1/i2 |
^ | raise to the power | i1^i2 |
Library
Control > Math
Pins
Name | Description |
---|---|
i1 | Input 0 |
Out | Output |
Parameters
Name | Description |
---|---|
NumberOfInputs | Number of Inputs |
Expression | Mathematical expression |
SamplingTime | -none or 0: No sampling. The system will be solved in the Newton loop (default). -auto: Inherit the sampling time of its source device. -Sampling Period: defined in seconds. |