Chercher
MENU
  • Applications TapHome
  • Expressions
  • Architecture du système par type de projet
  • Utilisateurs et autorisations
  • Expressions

    Les expressions sont utilisées dans Smart Rules "Equation" et "Formula".
    Des fonctions supplémentaires peuvent être utilisées sur les appareils Modbus pour lire / écrire des valeurs depuis / vers les registres Modbus.

    Expressions mathématiques

    +, -, *, /

    (20.5 + 9.5) / 2    (15)

    Expressions logiques

    AND, OR, !, =, !=, >, <

    (!IsRaining OR (Wind>30))
    MultiValueSwitchState != 2 (Not equal to 2)

    Les fonctions

    IF

    IF(logical_expression, value_if_true, value_if_false)

    Renvoie une valeur si une expression logique est «VRAIE» et une autre si elle est «FAUX».

    LINEAR

    Renvoie une valeur ajustée linéairement - interpolation linéaire.

    LINEAR(input, value1_input, value1_output, value2_input, value2_output)

    Example 1: LINEAR(250,  0,0,  50,500)   (Result is 25°C)
    
    Example 2: LINEAR(Co2,  400,0,  1200,1)
              (If value from Co2 sensor is 400ppm, output for air recovery will be 0%. 
               If Co2 is 1200, output will be 100%. And if e.g. Co2=800, output will be 50%)

    SWITCH

    SWITCH(expression, case1, value1, [case2, ...], [value2, ...], default_value)

    Teste une expression par rapport à une liste de cas et renvoie la valeur correspondante du premier cas correspondant, avec une valeur par défaut si rien d'autre n'est rencontré.

    Example


    Configuration

    ReadState ... SWITCH(MODBUSR(H, 168, UInt16),   0, 0,   0x02, 1,   0x04, 2,   0x08, 3,   0x10, 4,   0x40, 5, 0x800, 6,   0)
    WriteState ... MODBUSWNE(H, 168, UInt16, SWITCH(Mu,   0, 0,   1, 0x02,   2, 0x04,   3, 0x08,   4, 0x10,  5, 0x40,   6, 0x800,  0)

    Result

    MIN

    MIN(value1, value2)

    Renvoie la plus petite des deux valeurs.

    MAX

    MAX(value1, value)

    Renvoie la plus grande des deux valeurs.

    ROUND

    ROUND(value1)    

    Renvoie la valeur arrondie.

    Example 1: ROUND(2.01) (Result is 2)

    Example 2: ROUND(2.49) (Result is 2)

    Example 3: ROUND(2.5) (Result is 3)

    Example 4: ROUND(2.99) (Result is 3)

    Core 2018.1.9623

    DEWPOINT

    DEWPOINT(temperature, relativeHumidity)
    

    Renvoie la température du point de rosée compte tenu de la température actuelle et de l'humidité relative. Le point de rosée est calculé selon cette équation: http://bmcnoldy.rsmas.miami.edu/Humidity.html.

    Example 1: DEWPOINT(20, 50) (Result is ~9.26)

    Example 2: DEWPOINT(0, 100) (Result is 0)

    Core 2018.1.9623

    POWER

    Core 2021.1

    The POWER function calculates a given number, raised to a supplied power.

    POWER(number, power)

    Examples:

    • POWER(2,3) … 2^3 = 8

    • POWER(10, -3) … 0,001

    • POWER(25, 0) … 1

    MOD

    Core 2021.1

    The MOD function returns the remainder of a division between two supplied numbers.

    MOD(number, divisor)

    Arguments:

    • number - The number to be divided.

    • divisor - The value that the number argument is divided by.

    Examples:

    • MOD(6, 4)  … 2

    • MOD(6, 2.5) … 1

    CEIL

    Core 2021.1

    The CEIL function rounds a supplied number away from zero, to the nearest multiple of a given number.

    CEIL(number, significance)

    Arguments:

    • number   - The number that is to be rounded.

    • significance (optional) - The multiple of significance that the supplied number should be rounded to. If the significance is not specified, then it is equal to 1.
      (This should generally have the same arithmetic sign (positive or negative) as the supplied number argument)

    Examples:

    • CEIL(22.25,0.1) … 22.3

    • CEIL(22.25,1) … 23

    • CEIL(22.25) … 23

    • CEIL(-22.25,-1) … -23

    • CEIL(-22.25,1) … -22

    • CEIL(-22.25) … -22

    • CEIL(-22.25,-5) … -25

    FLOOR

    Core 2021.1

    The FLOOR function rounds a supplied number towards zero to the nearest multiple of a specified significance.

    FLOOR(number, significance)

    Arguments:

    • number - The number that is to be rounded.

    • significance (optional) -The multiple of significance that the supplied number is to be rounded to. If the significance is not specified, then it is equal to 1.
      (This should generally have the same arithmetic sign (positive or negative) as the supplied number argument)

    Examples:

    • FLOOR(22.25,0.1)… 22.2

    • FLOOR(22.25,1) … 22

    • FLOOR(22.25) … 22

    • FLOOR(-22.25,-1) … -22

    • FLOOR(-22.25,1) … -23

    • FLOOR(-22.25) … -23

    • FLOOR(-22.25,-5) … -20

    RAND

    Core 2021.1

    The Rand function generates a random real number between 0 and 1.

    RAND()

    Examples:

    • RAND()

    RANDINT

    Core 2021.1

    The RANDINT function generates a random integer between two supplied integers.

    RANDINT(bottom, top)

    Examples:

    • RANDINT(1,5)

    • RANDINT(-2,2)

    SIGN

    Core 2021.1

    The SIGN function returns the arithmetic sign (+1, -1 or 0) of a supplied number. I.e. if the number is positive, the SIGN function returns +1, if the number is negative, the function returns -1 and if the number is 0 (zero), the function returns 0.

    SIGN(number)

    Examples:

    • SIGN(100) … 1

    • SIGN(0) … 0

    • SIGN(-100) … -1

    SQRT

    Core 2021.1

    The SQRT function calculates the positive square root of a supplied number.

    SQRT(number)

    Examples:

    • SQRT(25) … 5

    LOG

    Core 2021.1

    The LOG function calculates the logarithm of a given number, to a supplied base.

    LOG(number, base)

    Arguments:

    • number - The positive real number that you want to calculate the logarithm of.

    • base (optional) - An optional argument that specifies the base to which the logarithm should be calculated.
      If the argument is not specified, then the base argument uses the default value 10.

    Examples:

    • LOG(4,0.5) … -2

    • LOG(100) … 2

    LN

    Core 2021.1

    The LN function calculates the natural logarithm of a given number.

    LN(number)

    where the number argument is the positive real number that you want to calculate the natural logarithm of.

    Examples:

    • LN(100) … 4,60517

    Opérations sur les bits

    <<   (LEFT BIT SHIFT)

    8 << 2   (32)

    Excel: BITLSHIFT(number, shift_amount)

    >> (RIGHT BIT SHIFT)

    32 >> 2   (8)

    Excel: BITRSHIFT(number, shift_amount)

    & (BITWISE AND)

    3 & 1   (1)

    Excel: BITAND(number1, number2)

    | (BITWISE OR)

    2 | 1 (3)

    Excel: BITOR(number1, number2)

    Nombres hexadécimaux

    Les expressions peuvent également interpréter des nombres hexadécimaux. Le préfixe 0x est requis et le reste n'est pas sensible à la casse.

    0x0A (10)

    0xA0A0   (41120)
    0xa0a0   (41120)

    Modbus

    Suivez ce lien pour obtenir plus d'informations sur la configuration Modbus.