• 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

    Accessing previous values from data points to work out flow rate

    User help
    2
    4
    872
    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.
    • danD
      dan
      last edited by

      Hey Guys, I'm trying to work out if there is a way to access previous values in a data point's history from the scripting data sources so I can work out flow rate from water level data point in tanks.

      0_1605745395981_59e88e1e-f71b-4b9d-ae67-6f30c6867031-image.png

      I'm thinking I should be able to look at the difference in the values and work out the flow rate in litres per hour or litres per minute, then just update a virtual data point to display it. It's probably so simple I can't see it for looking :O)

      I know PREVIOUSVALUE(datapoint) exists as I use it frequently, but is there one for say a minute ago?
      Or could I simply mirror a data point value but only update it once a minute, then just work out the flow rate by comparing the current value to the previous only.

      Cheers
      Dan

      1 Reply Last reply Reply Quote 0
      • MattFoxM
        MattFox
        last edited by

        use pt.pointValuesSince(timestamp)
        or:

         pointValueAfter(timestamp, cache) 
        //function returns the nearest point value/time object after to timestamp, or null if there is not one.
        
        pointValueAt(timestamp, cache) 
        //function returns the a point value/time object that was recorded exactly at the timestamp, or null if there is not one.
        

        Fox

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        1 Reply Last reply Reply Quote 0
        • danD
          dan
          last edited by

          Thanks mate, I'll give it a go.

          1 Reply Last reply Reply Quote 0
          • MattFoxM
            MattFox
            last edited by

            Anytime

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

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