[BUG][SOLVED] EnergyUsage should be double, not float

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Francis91
Posts: 5
Joined: Friday 26 August 2022 14:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

[BUG][SOLVED] EnergyUsage should be double, not float

Post by Francis91 »

Hi again !

I suspected a problem with lower values in power usage, but I've also seen a bug during the process.

In SQLHelper.cpp, line 5073 to 5076, all the values are in float, but energyUpToInterval and energyAfterInterval can become big (these are Wh).
I guess I'm not the only one with a value > 10000.000 kWh for a house.

float -> 4 bytes, precision is 7 digits
double -> 8 bytes, precision is 15 digits

For my case, with an Energy counter at 18228934.000 kWh, adding less than 2 Wh in float in 5 seconds means 1400 W ! (2 * 3600/5).

I was questionning why my results from my clamps are more and more different than my "real" bill from my provider, I have found why :-)
Francis91
Posts: 5
Joined: Friday 26 August 2022 14:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [BUG][SOLVED] EnergyUsage should be double, not float

Post by Francis91 »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest