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.
Accessing previous values from data points to work out flow rate
-
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.
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 -
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
-
Thanks mate, I'll give it a go.
-
Anytime