• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    about the scripting datasource executionDelaySeconds, p1.value execute time

    Scripting general Discussion
    2
    5
    2.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hussamH
      hussam
      last edited by

      in below situation
      To calculate a daily consumption based on a incrementing register. This is most commonly used for calculating daily kWh values
      return p1.value - p1.ago(DAY)

      somes, to avoid much resource execute one same time(et 59 59 23 * * ?),we setup the executionDelaySeconds,for example,executionDelaySeconds is 30 seconds,then we use
      p1.value - p1.ago(DAY),

      p1.ago(day) 's value is the last day 23:59:59 's value ,but the p1.value's time is not the firetime'value ,it is today 23:59:59+30seconds times value, it have Deviation.

      so,if have some way to calculating exactly p1.value-p1.ago(DAY) in executionDelaySeconds case

      1 Reply Last reply Reply Quote 0
      • JoelHaggarJ
        JoelHaggar
        last edited by

        You could do something like this:

        return p1.value.previous(DAY).maximumValue - p1.value.previous(DAY).minimumValue
        
        1 Reply Last reply Reply Quote 0
        • hussamH
          hussam
          last edited by

          Thanks, and the p1.value.previous(DAY) base on the cron time, not the execute time(it DelaySeconds),so the cron need after 0 clock, etc 5 0 0 * * ?,not the 59 59 23 * * ? is it right?

          1 Reply Last reply Reply Quote 0
          • JoelHaggarJ
            JoelHaggar
            last edited by

            I'm not sure, you'll have to test this and let us know.

            1 Reply Last reply Reply Quote 0
            • hussamH
              hussam
              last edited by

              And i have tested, it is base on cron time,so the cron need after the 0 clock.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post