<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>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: <a href="http://www.conrad.com/ce/en/product/125355/?insert=NA&insertNoDeeplink&productname=DPM1L32-DVOLTCRAFT-Alternating-current-meter-for-cap-rail-mounting-LCD-9999999-kWh">http://www.conrad.com/ce/en/product/125355/?insert=NA&insertNoDeeplink&productname=DPM1L32-DVOLTCRAFT-Alternating-current-meter-for-cap-rail-mounting-LCD-9999999-kWh</a></div><div><br></div><div>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:</div><div><br></div><div>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.</div><div><br></div><div>By dividing the full hour (3600 seconds) with td, I get the max power consumption. So in this case:</div><div><br></div><div>3600/(t2-t1) is 360W/h</div><div><br></div><div>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. </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>Thanks!</div><div><br></div><div>KR,</div><div><br></div><div>Oliver Loch</div><div><br></div><div><br></div><div><br></div></body></html>