JensenNick / huawei_solar_pees

Power, Energy and Economy Sensors in Home Assistant
MIT License
35 stars 5 forks source link

Wrong calculation of "Power House Load Yield" #67

Closed cmovetus75 closed 1 week ago

cmovetus75 commented 2 weeks ago

After installing the package with the PEES sensors everything has worked fine except the calculation of "Power House Load Yield" (sensor.power_house_load) and all sensors that further use this value and associated utility meters under some circumstances. In particular, in forced charge and forced discharge modes of use of the battery, the formula used in the template sensor to calculate the load of the house that is being sourced from PV Panels (Power House Load Yield) does not cover properly this use case.

The current pseudo formula is more or less : If (House Load > PV Yield) then House Load Yield = PV Yield Else House Load Yield = House Load

If in forced charge mode, all PV Yield is sent to the Battery (for later use when the electricity cost is more expensive), but with the above formula would assume that the PV Yield is being sent to the House Load.

I have being using for some hours a new formulation that seems to be working well. I have identified 4 different scenarios, that require a diferent formula according to the power flow diagram:

If (batteries_charge_discharge_power > 0) (charging) If PV Yield > Charge -> House Load Yield = House Load – Import If PV Yield ≤ Charge -> House Load Yield = 0 Else (discharging) If Discharge < Load -> House Load Yield = PV Yield – Export If Discharge ≥ Load -> House Load Yield = 0 I have attached the modified PEES yaml definition that I am currently using.

huawei_solar_pees (Power House Load Yield corrected).txt

JensenNick commented 1 week ago

I remember playing around with the formulas when Forced Charge first was introduced. My conclusion back then was to leave things as they were. What do you base your assumption on - that all PV Yield is sent to the battery in Forced Charge?

BTW: If you make the changes you suggest you "artificially" increase the house load from grid and "artificially" improve the battery economy - if that is the "correct" way is of course debatable.