Hi all,
I am currently working on a little experiment with the Flukso. As a prerequisite I need to store the energy consumption of my household in a database. I have enabled SSH on the Flukso WLAN interface as described here:
http://vanheusden.com/misc/blog/2009-10-11-flukso.php
I also use rsyslog on another machine to log the flukso lines in a FIFO file. Now, based on an email conversation with Bart, I have these pulse lines coming in:
Nov 11 12:58:10 192.168.1.101 flukso: received pulse from /dev/ttyS0: 0e0bb5a7cc5e4d1f127d81a1c1837c83:0000024739
Each pulse line signals that a Watt-hour has been consumed. Now, I want to wait for at least 5 Minutes and integrate the pulses during this interval. Here is what I do:
(1) Wait for pulse line. Set start time once one is received. Count the pulse. The end time for this interval is set to the start time plus five minutes.
(2) When the next pulse is received, I count it and compare the current time with the end time. If the end time has been reached, go to (3), otherwise (2).
(3) Now, finalize the measurement. The average power in Watts is computed as follows:
watts=#pulses / (5min*60 / 3600)
I do, however, suspect a mistake here, but I can't grasp it. The values I get out of this are close to the values shown at the Flukso website. But especially for low power consumption the values are a little bit off.
Can anyone spot my problem?
Thanks,
-Mathias
PS: First post ever!
Hi Mathias,
The lower the power consumption, the higher the time in between Wh pulses will be. For example: 100W = 100Wh/3600s = 1Wh/36s. So if your house is consuming 100 watts, the Wh pulses will arrive at 36 second intervals. The time interval thus cannot be trusted to be close to 5min. So I would alter your formula to count average power like this:
watts = #Wh_pulses*3600/(T3-T1)
T1 = start time (s)
T3 = end time (s)
HTH
Bart.
Hi Bart,
thanks for the quick response. I think my problem description was not exact enough - I use the formula you have described above. Let me post some code to make my setup clear.
I have a script that parses the lines of the rsyslog daemon. The relevant part looks like this:
I removed some of my diagnostic code for brevity. As you can see, each time that I receive a pulse message, I add it to an PulseIntegrator instance (see below). If the Integrator is elapsed, I evaluate the recorded pulses:
As you can see I use timestamps on the local machine to evaluate the pulses. Using this code I have recorded the following readings:
The format is timestamp - watts (seconds of measurement interval). The website reports a relatively constant power consumption of 30 Watts. So there is a significant difference between the website values and the values I extract.
Thanks for your help,
-Mathias
EDIT: The intendation of the code tag seems to be broken :-)
Hi Mathias,
I've started with your last remark by enabling GeSHi code filtering in the forum. I've slightly edited the markup of your post by substituting 'code' by 'ruby'. It doesn't solve your problem yet, but it does make it a lot prettier. :-)
Cheers,
Bart.
For my understanding: If I calculate the interval time between your log entries, I get 382s (2-3) and 507s (1-2). These intervals don't seem to remotely match your interval calculations: 257s and 379s respectively. Am I overlooking something?
A quick view of your code made me wonder:
why do you keep track of the time of the first and the last pulse? What I think you want to do is count the pulses from start of measurement to the end of it.
you now 'forget' to 'count' some time before and after the first and last pulse. Especially for short intervals this would give a large error (accidentally your error is always positive). This is in line with Icarus' observations.
Hi,
I think you're right. I need to revisit that code, thank you for your comments! I was busy working on other sides of the project, which is now up and running in a first version. You can see it here:
http://twitter.com/fluksobot
I try to write more about the motivation behind the twitter bot later today.
Cheers,
-Mathias
Hi Mathias,
Is this some shrewd plan of yours to force us to look at your panoramic photography(cc)? :-P
Great stuff!!
Bart.
Damn, my plan is screwed :-) Now, I need to create a new plan for world dominance...
-Mathias