This article explains the script language. If you are looking for information about how to navigate around the script editor page, it is suggested you read Using the script editor and to take a look at the script examples and Essential knowledge for configuring scripts.

The calculation consists of references to the aliases of the sensors added in the sensor list in the left side of the screen, coupled with a reference to the time "[t]" (time is always related to the sensor frequency, so if you have an sensor with a frequency of 10 seconds, 't-3' means current time minus 30 seconds ago). and the equation, defined by the operators mentioned below.

### Between two values:

- plus = "+"
- minus = "-"
- modulo = "%"
- multiplication = "*"
- division = "/"
- booleanAnd = "&&"
- booleanOr = "||"
- equals = "=="
- notEquals = "!="
- lessThan = "<"
- greaterThan = ">"
- lessOrEqual = "<="
- greaterOrEqual = ">="

### For one value/expression:

- sum = "sum"
- average = "avg"
- max = "max"
- count = "count"
- sin = "sin"
- cos = "cos"
- tan = "tan"
- asin = "asin"
- acos = "acos"
- atan = "atan"
- abs = "abs"
- e_exp = "e^"
- ln = "ln"
- exp10 = "10^"
- log10 = "10log"
- round = "round"
- floor = "floor"
- ceil = "ceiling"
- sqrt = "sqrt"
- sqaure = "^"

Examples:

- S1[t] = 3 + 5
- S1[t] = sum(S2[t-1,t])
- S1[t] = cos(5)
- S1[t] = 10^(S2[t])
- S1[t] = 5^2

### More unusual options:

"if(predicate){}" | Example: if(S1[t] < 3) {V1[t] = 6} |

"if(predicate){}else{}" | Example: if(S1[t] < 3) {V1[t] = 6} else {V1[t] = S1[t]} |

"sumif(value, predicate)" | Example: sumif(S1[t-1,t], S1[t-1,t] >= 80) |

“countif(value, predicate)” | Example: countif(S2[t-1,t], S1[t-1,t] != 80) |

"lasttime(sensor, value)" * |
Example: lasttime(S2, 3) |

"lasttimebetween(sensor, value1, value2)" * |
Example: lasttimebetween(S2, 3, 1) |

"duration(sensor, value)" | Example: duration(S3, 1) |

"random(lowervalue, uppervalue)" | Example: random(3.44,5.22) |

*** **The operators ‘lasttime’ and ‘lasttimebetween’ will produce a ‘0’ if they find no values.

For script examples, refer to the article: Script examples.