Meta data script for KWH
-
I want to setup the 15 minutes profile for KWH in meta data. I write the script "return p78.value - p78.ago(MINUTE,15) ;" It works but it also end up some issues.
- The first value of the meta data equals to the value of the KWH.
- When there are power outage or other problem to make the KWH data not available in a period of time. When the KWH resumes to have data. The first resumed meta value is not correct. In my case, I got an interruption of the KWH so I missed some data in a few days, the last value read of the KWH is 317.58. After the interruption, the data read for the calculation is 389.66. The meta data becomes 72.08 (= 389.66 - 317.58) but 317.58 is few days ago. It mislead that there is a jump in the 15 minute.
Another issue is the "logging type" of the meta data. If I use "when point value changes", whenever the result of the calculation is the same value as the last value. The value does not record in the database. It looks like there is an interruption in that period. If I put "All data", the data missing in the interruption becomes "0". It means no consumption in that period of time. I just want to have "null" or no data means interruption and "0" means no change of the KWH.
I try another script to make the first value becomes 0
if (p78.ago(MINUTE,15) != 0)
return p78.value - p78.ago(MINUTE,15) ;
else
return 0 ;I will be grateful if you can have a script to solve my issues.
Thanks ! :)
-
You could try just using a logging type of 15 minute interval, with an accumulator of average.
-
this actually one problem i also meet? what 's your solve now?
Here is some suggest:
you script below is not right, because .ago will get the least value before 15 miniute,but not get the value at before 15 miniute.
if (p78.ago(MINUTE,15) != 0)
return p78.value - p78.ago(MINUTE,15) ;
else
return 0 ;the best way is official provide on function to get the exactly time values.
the second way you can try like this,
if ((p78.ago(MINUTE,15) -p78.ago((MINUTE,16))==0),this means you point is interruption