Table of Contents | ||
---|---|---|
|
Symbol and connections
...
These blocks can be programmed to your liking. On the top side connections all inputs can be connected, on the bottom sides, all the outputs can be connected. The coding languange that is compatible with the programable controlers is Javascript. However, Hysopt evaluates the writen code in these programmable controllers every simulation step. This results that not all off the functionalities of Javascript are possible to be implemented. For instance:
...
assignment statements
if and if-else statements
switch statements
comments : single line (//) and multiline (/*...*/)
operators :
increment operators (++ and --)
unary operators (- and !)
binary operators : power (^), multiply (*), modulo (%), divide (/), sum (+), min (-)
ternary operator (a = x ? b : x) see https://www.freecodecamp.org/news/c-ternary-operator/
conditional operators (|| and &&)
comparison (<=', >=, >, <, ==, '!=)
mathematical functions :
exp
,ln
,sin
,cos
,tan
,sqrt
,min(x1, x2)
,max(x1, x2)
,abs
,floor
,ceil
,sgn
(signum)
Initialisation
When using a variable that has not been defined before, the controller will equal the new variable to 0. This functionality can be used for initialisation purposes with the following topology:
...