Currently I am rewriting my domoticasystem written in PHP, for the past year I was monitoring my energy usage (water, electricity, gas) that worked tolerable but not perfect!.
I saw that in process of time the electricity countings from my system continuously deviated from the real countings on the meter of my electricity supplier. The countings of the water and gas are reasonably accurate. This make me thinking and searching to the problem in my system. First I checked if the pulse counter on my electricity meter was counting correct, I checked this for hours (with ambient light and without) but the conclusion was that pulse-counter counts accurate.
The problem came from my dom-system, when I programmed v1 of this class I calculated a formula that the system will use to calculate the kWh's, it looks like the following;
My meter has a C=187,5 that will result in 187,5 rotations for each 1kWh. Here for I devised the formula;
1kWh / 187,5 = 0,005333333333333333333333333333333333333 (and go on).
So every pulse from the RFXmeter will say that there is 0,005333333333333333333333333333333333333 kWh of power was consumed. But you can guess the problem, this can't be accurate at all! for the first weeks the system was accurate to the real meter but after 1 year it was way off because of this formula (333333333 1/3).
My current MySQL table `energy_usage` looks like this;
Code: Select all
CREATE TABLE IF NOT EXISTS `energy_usage` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`address` varchar(4) NOT NULL DEFAULT '',
`type` int(1) NOT NULL DEFAULT '0' COMMENT '1 = Elektriciteit, 2 = Gas, 3 = Water',
`valueStart` decimal(36,30) NOT NULL DEFAULT '0.000000000000000000000000000000',
`valueTotal` decimal(36,30) NOT NULL DEFAULT '0.000000000000000000000000000000',
`pulseStart` int(8) NOT NULL DEFAULT '0',
`pulseTotal` int(8) NOT NULL DEFAULT '0',
`reads` int(4) NOT NULL DEFAULT '0',
`dateAdd` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateModified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8756 ;
Code: Select all
(8754, '01F1', 1, 123816.257333333333333333333330997180, 123816.667999999999999999999997663821, 2245182, 2245259, 57, '2012-05-07 09:00:22', '2012-05-07 09:59:02')
My question is, how can I make this accurate and how do you do it (Bwired, Digit, Airox etc?). Maybe I have only to save the pulses and not the calculated values before I insert it into the the database and calculate the kWh, m3 rate's afterwards (on the views)?
I hope you can help me out with this problem so i can improve this piece of software
Thanks.