Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix commingling of battery charging/discharging in yield #1

Closed
wlcrs opened this issue Oct 20, 2021 · 15 comments
Closed

Fix commingling of battery charging/discharging in yield #1

wlcrs opened this issue Oct 20, 2021 · 15 comments

Comments

@wlcrs
Copy link
Owner

wlcrs commented Oct 20, 2021

The values reported in Daily Yield/Total Yield are muddied when you have a home battery (ex. LUNA2000) connected to your inverter (ex. SUN2000L).

Energy used to charge the battery is not added to the yield, while energy which was discharged from the battery is added to the yield.

It's not as simple as adding/substracting the values from the Battery (Dis)charge fields, as you need to account for conversion losses. For example: when I look to the daily values before the sun has come up, the Battery Discharge can report 1.2 kWh, while the daily yield reports roughly 1.0 kWh at that moment.

@Emilv2
Copy link

Emilv2 commented Nov 12, 2021

Wow, that's ugly... I think the only correct way to deal with this is fixing the firmware to not do this.

@johanvh83
Copy link

johanvh83 commented Dec 7, 2021

Convertion loses are important. I own the system for only 1 week, monitored a lot and learned a lot! I tried now, in wintertime, to charge my batteries at night (low rate) and use the 'stored power' at daytime (high rates). After monitoring I found I consumed 5000 Wh (real consumption from DSMR reading) and my battery was charged for 43 % from 10.000 Wh = 4300 Wh! Based on this I decided to stop charging at night!
You suspect Huawei will build a ratio factor to keep the losses in mind... Don't believe they will do, as it is not very commercial to calculate losses...
Anyway nothing can be predicted for 100%, right?

@wlcrs
Copy link
Owner Author

wlcrs commented Dec 7, 2021

I suspect that you have a 10kWh LUNA2000 battery? This is equivalent to 10000Wh, but not to 10000kWh of course.

So if my assumption is correct you charged your battery for 5000Wh, aka 5kWh? Is that 43% the amount that your battery increased above the minimum level of 16%? Is so: a conversion loss of 14% is indeed in the same ballpark as to what I am seeing in my installation.

I'm waiting for a clear explanation on the Flemish 'capaciteitstarief' tariff structure to decide whether it is worth it to charge my battery from the grid during winter.

@johanvh83
Copy link

Hi Thijs,

I'm also Flemish. I have indeed 2 pcs LUNA2000 5 kWh = 10 kWh battery. Yes, made a mistake in my previous post, It's rectified.
The battery capacity, how Huawei calls it, increased luckely with 43% (from 15 to 58%).
On the other hand, the Huawei phylosophy to count the discharge from battery as solar production is correct if you don't charge from the grid offcourse. The netto power delivered by the inverter + battery is counted, so it includes the loss.

What do you exactly mean by 'capaciteitstarief'. The only thing I've heard about is a new peak tarrif they will start to use. The battery could be a good 'resource' to flat the peak, if it is charged...

@Veletax
Copy link

Veletax commented Jan 16, 2022

Hi,
I share with you my experience about this issue.
What I have seen is that during the night the energy yield value (total or daily) has a significant deviation with the discharged energy of the battery. The amount of deviation for low increases (low load) it so hight that I suspect it could not comes from the inverter conversion losts. I have anlysed in deep the behavior of this deviation, it is quite lineal with low loads with 30% deviation more or less, and this is more than the expected 10-5% lost of inverter. See the image value of battery discharge vs total yield (normalized).
image

My idea was to use the linear funtion to correct the energy yield value, BUT this behavior happends only with low loads, if the load increase the deviation is reduced significantly to level of only 5% deviation, so it is not the accurate solution I expected. My conclusion is that this issue seems to be more complicated and due to the significat value deviation it is difficult to conclude that the inverter conversion lost is exclusively the reason or something is wrong with my battery instalation and I have a energy leakege on the battery side before inverter.

@Veletax
Copy link

Veletax commented Jan 16, 2022

The values reported in Daily Yield/Total Yield are muddied when you have a home battery (ex. LUNA2000) connected to your inverter (ex. SUN2000L).

Energy used to charge the battery is not added to the yield, while energy which was discharged from the battery is added to the yield.

It's not as simple as adding/substracting the values from the Battery (Dis)charge fields, as you need to account for conversion losses. For example: when I look to the daily values before the sun has come up, the Battery Discharge can report 1.2 kWh, while the daily yield reports roughly 1.0 kWh at that moment.

From 1.2 to 1 KWh, it means 83% of efficiency for the inverter and it is far away of the technical specification for SUN2000L, the efficiency range is 97.8% normal load and about 90% very low loads. I think there must be other additional reason ( a firmeware bug for example).
image

@wlcrs
Copy link
Owner Author

wlcrs commented Jan 17, 2022

Hi @Veletax , thanks for sharing your thoughts on this issue.

The efficiency curve only talks about the efficiency of the DC/AC conversion I think? You also have to add the charge- and discharging losses for the LiFePO4, which are around 8% (Assuming a round-trip efficiency of 92%, a number that I see floating around on internet).

So, when you're drawing a few hundred watts from the battery (which is how the battery is primarily used when we're measuring at night), it puts you on the left-hand side of the your efficiency graph. Using the blue line (as the nominal voltage of the LUNA2000 is 450V), this gets you a total efficiency of 87% (0.95 * 0.92 = 0.87).

It gets worse when you start to charge from the grid, as then you're passing through the inverter twice, which gives you a theoretical efficiency of 83% (0.95 * 0.92 * 0.95 = 0.83).

For now, I'm testing this straightforward calculation wrt. accuracy:
solar yield = daily yield + 0.93 * battery_day_charge - 0.86 * battery_day_discharge.

If you want to replicate it in HA, you can add the following to your configuration.yaml:

template:
  - sensor:
      - unique_id: "daily_solar_yield"
        name: "Daily Solar Yield"
        unit_of_measurement: "kWh"
        icon: "mdi:solar-power"
        state_class: "total_increasing"
        device_class: "energy"
        state: "{{ states('sensor.daily_yield') | float - 0.86 * states('sensor.battery_day_discharge') | float + 0.93 * states('sensor.battery_day_charge') | float }}"

I'll evaluate this calculation when I have enough samples, which might take a while as the yield of the solar panels on my flat roof are abysimal for the moment ...

(Maybe that's conclusion no. 1: don't combine a battery with a flat rooftop setup, as performance sucks during winter)

@wlcrs
Copy link
Owner Author

wlcrs commented Jan 28, 2022

Update: I don't have any useful data to work on, as development of this custom component messes with my statistics if I get things wrong / disable the component in my 'production' HA to be able to test.

While reading the documentation for another brand of inverters, I stumbled upon the following passage at https://www.home-assistant.io/integrations/fronius/#energy-dashboard:

If a battery is connected to an inverter: Use Riemann sum over Power photovoltaics entity (from power_flow endpoint found in your SolarNet device)

I think that 'Input Power' is the correct entity to do this for the Huawei Solar component. Currently testing:

  - platform: integration
    source: sensor.input_power
    unit_prefix: "k"
    unit_time: "h"
    name: "Daily Solar Yield"

@Veletax
Copy link

Veletax commented Jan 29, 2022

Update: I don't have any useful data to work on, as development of this custom component messes with my statistics if I get things wrong / disable the component in my 'production' HA to be able to test.

While reading the documentation for another brand of inverters, I stumbled upon the following passage at https://www.home-assistant.io/integrations/fronius/#energy-dashboard:

If a battery is connected to an inverter: Use Riemann sum over Power photovoltaics entity (from power_flow endpoint found in your SolarNet device)

I think that 'Input Power' is the correct entity to do this for the Huawei Solar component. Currently testing:

  - platform: integration
    source: sensor.input_power
    unit_prefix: "k"
    unit_time: "h"
    name: "Daily Solar Yield"

Hi wlcrs, first of all thank you for your contribution with this HACS develop, great job, thank you. The last additional functions
you added under " Diagnostic" are a fantastic idea.
Regarding this issue about the battery, I tried to solve the problem time ago using the Riemann Integral for PV production, but I was not agree with the soution at the end, again the deviation with the FusionSolar data was significant (PV production) ( i haven't try to analize the behavior of this deviation for this case) . As user then, how can I be sure that my Huawei inverter is working properly according manufacturer specifications if the data doesn't show this?. Mybe the problem is my inverter but it seems it is not the only. Therefore I try to use direct data from the inverter "Battery discharge" and "total_yield" to show that something is going wrong with the inverter: or the inverter efficiency is not according the especifications (handbook data) or the inverter provides wrong data and in both cases for my it is a reason to claim for warraty to the manufacturer.

@maartenhbe
Copy link

Update: I don't have any useful data to work on, as development of this custom component messes with my statistics if I get things wrong / disable the component in my 'production' HA to be able to test.

While reading the documentation for another brand of inverters, I stumbled upon the following passage at https://www.home-assistant.io/integrations/fronius/#energy-dashboard:

If a battery is connected to an inverter: Use Riemann sum over Power photovoltaics entity (from power_flow endpoint found in your SolarNet device)

I think that 'Input Power' is the correct entity to do this for the Huawei Solar component. Currently testing:

  - platform: integration
    source: sensor.input_power
    unit_prefix: "k"
    unit_time: "h"
    name: "Daily Solar Yield"

Currently testing this suggestion as it seems the most clean solution without making assumptions or custom logic about actual efficiency of the installation. Don't mind having to reset or recalc statistics using SQL stored procs. Will keep you updated.

@wlcrs
Copy link
Owner Author

wlcrs commented Feb 10, 2022

We have an active discussion going on about this issue here: https://community.home-assistant.io/t/integration-solar-inverter-huawei-2000l/132350/1242?u=wlcrs

@wlcrs
Copy link
Owner Author

wlcrs commented May 29, 2022

Thank you for all your input in this topic. I've since created a Wiki-page explaining how to properly deduce the yield.

This approach produces acceptable results, but not good enough to add a synthetic sensor to this integration. As there is no obvious "100% correct" solution, and other HA solar integrations have the same issue, I will now close this issue.

@wlcrs wlcrs closed this as completed May 29, 2022
@Veletax
Copy link

Veletax commented Jun 15, 2022

The values reported in Daily Yield/Total Yield are muddied when you have a home battery (ex. LUNA2000) connected to your inverter (ex. SUN2000L).

Energy used to charge the battery is not added to the yield, while energy which was discharged from the battery is added to the yield.

It's not as simple as adding/substracting the values from the Battery (Dis)charge fields, as you need to account for conversion losses. For example: when I look to the daily values before the sun has come up, the Battery Discharge can report 1.2 kWh, while the daily yield reports roughly 1.0 kWh at that moment.

I got possible reason why it could happen for your case. I got officially answer from Huawei about the cause of this significant deviation between battery discharge values and consumption values (daily yield) (15%-20% deviation). The reason is the configuration of the inverter. The inverter works very inefficient if it works only following the home energy demand, but the inverter work correctly with the configuration when it cover the demand + injecting the rest of energy into the public grid , in other words, if the inverter work with the configuration where all the energy recived from the solar pannels is converted (in this case only 0.2-0.1% lost). I tested it with my installation and it happens as Huawei explains, now I changed the configuration of my inverter and now it works well with the correct efficiency. Check the configuration of your inverter.

@h4de5
Copy link

h4de5 commented Sep 7, 2022

The values reported in Daily Yield/Total Yield are muddied when you have a home battery (ex. LUNA2000) connected to your inverter (ex. SUN2000L).
Energy used to charge the battery is not added to the yield, while energy which was discharged from the battery is added to the yield.
It's not as simple as adding/substracting the values from the Battery (Dis)charge fields, as you need to account for conversion losses. For example: when I look to the daily values before the sun has come up, the Battery Discharge can report 1.2 kWh, while the daily yield reports roughly 1.0 kWh at that moment.

I got possible reason why it could happen for your case. I got officially answer from Huawei about the cause of this significant deviation between battery discharge values and consumption values (daily yield) (15%-20% deviation). The reason is the configuration of the inverter. The inverter works very inefficient if it works only following the home energy demand, but the inverter work correctly with the configuration when it cover the demand + injecting the rest of energy into the public grid , in other words, if the inverter work with the configuration where all the energy recived from the solar pannels is converted (in this case only 0.2-0.1% lost). I tested it with my installation and it happens as Huawei explains, now I changed the configuration of my inverter and now it works well with the correct efficiency. Check the configuration of your inverter.

is this something a normal user account can change? and if so, where would that be?

@Veletax
Copy link

Veletax commented Sep 7, 2022

The values reported in Daily Yield/Total Yield are muddied when you have a home battery (ex. LUNA2000) connected to your inverter (ex. SUN2000L).
Energy used to charge the battery is not added to the yield, while energy which was discharged from the battery is added to the yield.
It's not as simple as adding/substracting the values from the Battery (Dis)charge fields, as you need to account for conversion losses. For example: when I look to the daily values before the sun has come up, the Battery Discharge can report 1.2 kWh, while the daily yield reports roughly 1.0 kWh at that moment.

I got possible reason why it could happen for your case. I got officially answer from Huawei about the cause of this significant deviation between battery discharge values and consumption values (daily yield) (15%-20% deviation). The reason is the configuration of the inverter. The inverter works very inefficient if it works only following the home energy demand, but the inverter work correctly with the configuration when it cover the demand + injecting the rest of energy into the public grid , in other words, if the inverter work with the configuration where all the energy recived from the solar pannels is converted (in this case only 0.2-0.1% lost). I tested it with my installation and it happens as Huawei explains, now I changed the configuration of my inverter and now it works well with the correct efficiency. Check the configuration of your inverter.

is this something a normal user account can change? and if so, where would that be?

It is required access to the inverter configuration with Fusionsolar App with the "Installer" key and kwnoledges about the config tool (screens) and to know where to change the configuration of the operation mode.

wlcrs added a commit that referenced this issue Apr 17, 2024
* Update bug_report.yml (#1)

Fixed typo and (suggest) add "Version of Huawei Solar Installed:" to the 'Describe your Huawei Solar Setup' section.

* Update bug_report.yml

---------

Co-authored-by: Thijs W <[email protected]>
@wlcrs wlcrs mentioned this issue Oct 3, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants