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.
Creating New equation
-
Hello! I would like to create a new equation using a specific variable.
This variable shows the total energy every specific time (refresh every 5 sec). I aim to create an equation where will be done a subtraction between this variable at 00:00 of this day (subtracter) and the instant Value of energy (subtrahend) as i take it from Mango.
Let's assume E is the total energy variable, i would like to create an equation like: E(t)-E(00:00-start of the day). Is any way to implement this?
Thanks in advance,
Nikos. -
Hi Nikos,
Yes, you could use a meta point like,
var dayStartTime = new Date(); dayStartTime.setHours(0); dayStartTime.setMinutes(0); dayStartTime.setSeconds(0); dayStartTime.setMilliseconds(1); //Get the value before the first millisecond of the day // (00:00:00.000, or the last value from yesterday if it didn't change) var subtracter = variableContextPoint.pointValueBefore(dayStartTime.getTime()) var subtrahend = energyContextPoint.value; if(subtracter == null) return -subtrahend; return subtracter.doubleValue - subtrahend;