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

Offset available power by dc-generated battery charge #2735

Merged
merged 5 commits into from
Mar 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions core/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ func powerToCurrent(power float64, phases int) float64 {
return power / (float64(phases) * Voltage)
}

// consumedPower estimates how much power the charger might have consumed given it was the only load
// func consumedPower(pv, battery, grid float64) float64 {
// return math.Abs(pv) + battery + grid
// }

// sitePower returns the available delta power that the charger might additionally consume
// negative value: available power (grid export), positive value: grid import
func sitePower(grid, battery, residual float64) float64 {
// For hybrid inverters, battery can be charged from DC power in excess of
// inverter AC rating. This must be offset by the grid consumption when calculating
// available site power.
// (https://github.com/evcc-io/evcc/issues/2734)
if grid > 0 && battery < 0 && grid-battery > 50 {
battery = 0
}
return grid + battery + residual
}