Zoeken
MENU
  • Tik op Home-apps
  • Uitdrukkingen
  • Systeemarchitectuur per projecttype
  • Gebruikers en machtigingen
  • Uitdrukkingen

    Uitdrukkingen worden gebruikt in Smart Rules "Vergelijking" en "Formule".
    Extra functies kunnen op Modbus-apparaten worden gebruikt om waarden van / naar Modbus-registers te lezen / schrijven.

    Wiskundige uitdrukkingen

    +, -, *, /

    (20.5 + 9.5) / 2    (15)

    Logische uitdrukkingen

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

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

    Functies

    IF

    IF(logical_expression, value_if_true, value_if_false)

    Retourneert één waarde als een logische uitdrukking 'WAAR' is en een andere als het 'ONWAAR' is.

    LINEAR

    Retourneert lineair aangepaste waarde - lineaire interpolatie.

    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)

    Test een uitdrukking tegen een lijst met cases en retourneert de overeenkomstige waarde van de eerste overeenkomende case, met een standaardwaarde als niets anders wordt bereikt.

    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)

    Retourneert de kleinste van de twee waarden.

    MAX

    MAX(value1, value)

    Retourneert de grootste van de twee waarden.

    ROUND

    ROUND(value1)    

    Retourneert de afgeronde waarde.

    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)
    

    Retourneert de dauwpunttemperatuur gegeven de huidige temperatuur en relatieve vochtigheid. Dauwpunt wordt berekend volgens deze vergelijking: 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

    Bit operaties

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

    Hexadecimale getallen

    Expressies kunnen ook hexadecimale getallen interpreteren. Voorvoegsel 0x is vereist en de rest is niet hoofdlettergevoelig.

    0x0A (10)

    0xA0A0   (41120)
    0xa0a0   (41120)

    Modbus

    Volg deze link voor meer informatie over Modbus-configuratie.