Hello,

I'm using my Raspberry PI to log the power consumption in the house. To get the 
amount of the power currently consumed I'm using an a.c. gauge similar to this 
one: 
http://www.conrad.com/ce/en/product/125355/?insert=NA&insertNoDeeplink&productname=DPM1L32-DVOLTCRAFT-Alternating-current-meter-for-cap-rail-mounting-LCD-9999999-kWh

Everytime one Watt/hour has been consumed, the power meter sends a signal to 
the Raspberry Pi. By measuring the time between two signals, I'm able to 
calculate the actual power consumption:

Let's say I have t1 and t2, two points in time. t1 is from 10 seconds ago and 
t2 represents now. After subtraction of t1 from t2, I get the time span between 
the two signals, td = 10 seconds.

By dividing the full hour (3600 seconds) with td, I get the max power 
consumption. So in this case:

3600/(t2-t1) is 360W/h

Let's assume I'm using 10 second steps in RRD which allows me to store a value 
in RRD every time I could hit a timeout. Now, after a minute a device is turned 
off, and the power consumption goes down from 360W/h to 180W/h. This means, 
that the signal from the gauge only arrives every 20 seconds and the first 10 
second step is passed without any information to store inside RRD. 

And that's the point where I'm lost. Should I interpolate the value I store at 
that point into RRD? I mean it's just a guess. What if the signal comes 30 
seconds later instead of the 20 above? Then I'd need to interpolate two steps 
which would make the whole thing a bit "fuzzy", which is not what I want. It 
would also show as a Graph that is "falling" down to the next step where a 
signal has been received and a "real" value has been computed. That's also not 
the case, because from the last real value to the next real value, the then 
calculated power consumption became valid right after the first signal.

E.g.: 360W/h -> 180W/h. When I have the second signal, the 180W/h where 
utilized from the moment right after signal one till the moment of signal two 
and a "falling" graph would be wrong as it's the average power consumed during 
the time between t1 and t2.

So it would be best to use a "step less" RRD and store the time deltas and 
calculate the average when creating the graphs. Is this possible? As far as I 
know the steps are mandatory, aren't they? Can I wait till I have the next 
value and then write this value "backwards" to all steps the script missed?

Thanks!

KR,

Oliver Loch



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
rrd-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Reply via email to