[PHP] Negative Watt value

Plugwise Forum about Plugwise devices and the Source software.
Post Reply
Freemann
Member
Member
Posts: 54
Joined: Tue Jan 03, 2012 12:21 am

[PHP] Negative Watt value

Post by Freemann »

i'm complete lost with my PHP approach.... and looking for a fresh view....

Who can calculate the calibration values from this circle response:
002701D7000D6F00005519E23F7C66A4B556EB543D65DCFE000000002C22

and, based on these figures, current power usage from this circle response:
002401D8000D6F00005519E20001015D0004421001850000044001074DCCDB7B0201DD

I get a value of -163xx,xx Watts
PietjeNL
Member
Member
Posts: 150
Joined: Sun May 30, 2010 8:47 am

Re: [PHP] Negative Watt value

Post by PietjeNL »

Solarpanel?
Freemann
Member
Member
Posts: 54
Joined: Tue Jan 03, 2012 12:21 am

Re: [PHP] Negative Watt value

Post by Freemann »

No, LCD monitor.
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Re: [PHP] Stange Gain value

Post by Mdamen »

Calibration:

0027 01D7 000D6F00005519E2 3F7C66A4 B556EB54 3D65DCFE 00000000 2C22

0027 = Response code
01D7 = Sequence number
000D6F00005519E2 = Mac address
3F7C66A4 = GainA = 0.9859411716461182
B556EB54 = GainB = -8.006365987967001e-07
3D65DCFE = OffTot = 0.056118957698345184
00000000 = OffNoise = 0.0

As for the 0024 response, that's a device information response which holds no information about the current power usage!
You need a 0013 response to get the current usage. For more information on the Plugwise protocol please see my Plugwise unleashed document.
Freemann
Member
Member
Posts: 54
Joined: Tue Jan 03, 2012 12:21 am

Re: [PHP] Negative Watt value

Post by Freemann »

That are exactly the values i "calculated".

I now have a "5" watt LightBulb on the plug and the formula gives: "-63.97 Watt" based on 2 pulses a second (17pulses in 8 seconds).

Here is my pulse correction(based on you're python) formula;

Code: Select all

	public function _pulsesCorrection($timespansource,$pulses, $offnoise, $offtot,$gain_a, $gain_b){
		$timespantarget = $timespansource;
		if($pulses == 0.0){
			return 0.0;
		}
		$corrected = 0.0;
		$value = $pulses / $timespansource;
		$out = $timespantarget * (((pow($value + $offnoise, 2.0) * $gain_b) + (($value + $offnoise) * $gain_a)) + $offtot);
		return $out;
	}
The function inputs are:

Code: Select all

pulses:2
offnoise:  0
offtot:      0.056118957698
gain_a:    0.985941171646
gain_b:    -8.00636598796

than i calculate the Watts and Kwh with the following functions:

Code: Select all

	public function _pulsetowatt($pulses,$timespan){
		return $this->_pulsetokwh($pulses,$timespan) * 1000;
	}
	
	public function _pulsetokwh($pulses, $timespan){
		return ($pulses / $timespan) / 468.9385193;
	}
What i'm i doing wrong?
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Re: [PHP] Negative Watt value

Post by Mdamen »

Did you read my latest comments? 0024 is not a power information response..
Freemann
Member
Member
Posts: 54
Joined: Tue Jan 03, 2012 12:21 am

Re: [PHP] Negative Watt value

Post by Freemann »

i read it, and i posted the wrong string.

this is the "good" string:
00130033000D6F00005519E2000200110000045200000000000A741E

And in my last post i gave all the info to calculate the current power usage;
pulses,
noise
totaloff
gaina
gainb

And when i put these figures in the formula, it gave a negative and totally off value

i aspect a value between +4 and +6 and get a -63.....
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Re: [PHP] Negative Watt value

Post by Mdamen »

I get weird values as well. What firmware version are you using?
It looks like a new format/version..
Post Reply

Return to “Plugwise Forum”