Input runtime counter & variables

This example shows how to setup the runtime counter for digital input 3. It also demonstrates how MEMORY VARIABLES can be used. Runtime counter is always available provided that digital input 3 is enabled. Its counter is increased every minutes if the input is closed and accumulate the total runtime in minutes. It is possible to reset the counter just writing the correspondig tag (in this case I33=0).

Memory variables can assume a fixed value, they can replicate a value of a tag and they can also incorporate some mathematical operations.

  • V10=hours
    variable 1 name = hours
  • V12=$I33/60
    variable 1 expression = value of I33 divided by 60 (total runtime hours)
  • V20=remainder
    variable 2 name = remainder
  • V22=$I33%60
    variable 2 expression = $I33%60 (remainder of I33 division are the minutes

Image

RULE 1

  • Every minute (when the on-board clock matches the recursive pattern)
  • If the input 3 runtime counter is above 60 minutes
  • Send an SMS to +1234567890 with text "Runtime is $V11 hrs. Service is due"
    $V11 is the value of memory variable V1 (runtime counter/60)

Image

RULE 2

  • Every minute (when the on-board clock matches the recursive pattern)
  • If the input 3 runtime counter is above 120 minutes
  • Reset input 3 runtime counter to zero.

Image

RULE 3

  • Every day at 12:00
  • We do not set any conditions
  • Send an email to "address@mail.com" with subject text of "Daily update: $V11 hours $V21 mins"
    $V11 value are the hours and $V12 are the minutes accumulated bi input 3 runtime counter
    i.e.: Daily update: 1 hours 40 mins

Image

AT COMMANDS

The rules described above can also be set with the following AT commands

AT#ER=001****_SCH_$I33>60_____AT+SMS=+1234567890,"Runtime is $V11 hrs. Service is due"____
AT#ER=002****_SCH_$I33>120_____I33=0____
AT#ER=0031200_SCH______AT#EMAIL=address@mail.com,"Daily update: $V11 hours $V21 mins",MAP____