Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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)

Input/output assignment

The controller needs to interact with the hydronic system. For this purpose, we can feed inputs to the controller and can give outputs to the system.

To assign a variable to an input in the programmeable controller, you can use: parameterName=in1;

Following the same logic, you can provide outputs as: out1=parameterName;

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:

...