Power distribution between battery and PV inverter

Hi, thank you guys for the amazing open source project.

We are currently using OpenEMS to manage our battery and PV inverter using the controller io.openems.edge.controller.symmetric.balancing and io.openems.edge.controller.pvinverter.selltogridlimit.

Our purpose is to keep grid consumption >=0 W (reverse power to the grid is not allowed). In the experiment, this goal was achieved. However, we found that PV and battery inverter would compete for power generation.

Let’s say the office load is 1000 W, then PV would generate, for instance, 700 W and battery would generate 300 W. But the irradiance is enough for the PV to generate more than 1000 W. We do not want the battery to generate power while the PV is capable to generate it all by itself.

I have read the code and understand that these two controllers are indenpent from each other. The xxx.balancing controller will control the battery inverter while reading the meter. The xxx.selltogridlimit controller will control the PV inverter while reading the meter. Is there any method to meet our control purpose while ask the PV inverter to generate most of the power if it is capable of? Is there any other controllers that I am missing?

I am aware that OpenEMS is designed to be modularized. Different components (controllers, devices, etc) can be grouped to achive a specific function. But it seems there are sometimes when message passing between components is needed.

Let’s say we have only 2 battery inverters (no PV inverter) and we use 2 xxx.balancing controllers. Both controller would read the meter and control the output without knowing each other’s exsitance. If a 1000 W load is attached to the system, then both controller will read 1000 W grid meter power and set each battery inverter to generate 1000 W more power. This will generate 2000 W more power and the grid meter will read -1000 W and the controllers will try the balance again and again…

We are currently considering implement one single custom controller to control our 2 PV inverters and 1 battery inverter. I am not sure is this the best way so I want to hear from you guys.


Hi Jin Zhang and welcome to the Community.

It’s always amazing to hear how OpenEMS is used around the world; and by the way congrats for winning against our German team in the world cup :wink:

The problem you explain is indeed one of the more complex ones, that we are currently looking into how we could optimize them. The planned approach includes a global mathematical model with an optimizer/solver… but it is still in the very early phases.

In practice we prefer solving the “0 W” (or any other) feed to grid limit using a Hybrid Battery-Inverter (like a GoodWe ET).

If that is not an option, you could try to solve it by setting different limits to the Controllers with a hysteresis, i.e. set the PV-Inverter (via Sell-To-Grid-Limit) to “max 0 W feed-in” and the Energy Storage Controller to “100 W buy-from-grid” - maybe using a Peak-Shaving-Controller instead of Balancing… but I would have to think a bit how this would have to be configured in detail.

For your second example with two Energy Storage Systems there is already such a mathematical model in place, that takes care of this. In this scenario you configure both systems as ess1 and ess2 and add an EssCluster ess0. The Balancing Controller is than configured for this ess0 which internally takes care of distributing the power between the two ESS (depending on the defined strategy in the Ess-Power-Component).

Apart from that it is also a very valid approach to create a specific Controller for your use case if that solves the issue for you!

I’ll be glad to hear more about your project and provide help and input if possible. Please keep us updated here!