aesim-tech / simba-project

Roadmap & issue tracking
7 stars 0 forks source link

New User Defined Expression control model #319

Closed manu-aesim closed 11 months ago

manu-aesim commented 1 year ago

A now control model with two parameters :

This control block will allow the user to write any mathematical expression that will be evaluated at every time-step/iterations.

Example of expressions to be supported:

Supported functions are:

Name Argc. Explanation
sin 1 sine function
cos 1 cosine function
tan 1 tangens function
asin 1 arcus sine function
acos 1 arcus cosine function
atan 1 arcus tangens function
sinh 1 hyperbolic sine function
cosh 1 hyperbolic cosine
tanh 1 hyperbolic tangens function
asinh 1 hyperbolic arcus sine function
acosh 1 hyperbolic arcus tangens function
atanh 1 hyperbolic arcur tangens function
log2 1 logarithm to the base 2
log10 1 logarithm to the base 10
log 1 logarithm to base e (2.71828...)
ln 1 logarithm to base e (2.71828...)
exp 1 e raised to the power of x
sqrt 1 square root of a value
sign 1 sign function -1 if x<0; 1 if x>0
rint 1 round to nearest integer
abs 1 absolute value
min var. min of all arguments
max var. max of all arguments
sum var. sum of all arguments
avg var. mean value of all arguments

Supported operators are:

Operator Description Priority
= assignement * 0
|| logical or 1
&& logical and 2
| bitwise or 3
& bitwise and 4
<= less or equal 5
>= greater or equal 5
!= not equal 5
== equal 5
> greater than 5
< less than 5
+ addition 6
- subtraction 6
* multiplication 7
/ division 7
^ raise x to the power of y 8

Development Progress

Note

It is important to note that this device does not trigger discontinuity events. It should be used for "continuous" variables and not for detecting events requiring small time steps. For example, it should not be used in place of a comparator controlling a switch.

jcornau commented 11 months ago

Development Progress

model ok test ok documentation ok

jcornau commented 11 months ago

Notes: Operators are not considered: