Skip to content

Commit

Permalink
Merge pull request #12 from atbore-phx/fix/capacity-reserve
Browse files Browse the repository at this point in the history
fix(schedule): fixing ratio of charge when reserve is not full
  • Loading branch information
atbore-phx authored Mar 5, 2024
2 parents 31cfc7a + 1d2a5d4 commit 010ca1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/fronius/fronius_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func TestBatteryChargeError3(t *testing.T) {
setup()

result, err := fronius.SetFroniusChargeBatteryMode(1000, 11000, -11000, 9000, 3500, 0, "00:00", "23:59", modbus_ip, modbus_port)
assert.Equal(int16(-31), result, "SetFroniusChargeBatteryMode returned wrong value")
assert.Equal(int16(-200), result, "SetFroniusChargeBatteryMode returned wrong value")
assert.Error(err)

teardown()
Expand Down
3 changes: 2 additions & 1 deletion pkg/fronius/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func SetFroniusChargeBatteryMode(pw_forecast float64, pw_batt2charge float64, pw
case pw_batt2charge == 0: // battery 100% => do not charge
u.Log.Info("Battery is full charged")
case pw_batt < pw_batt_reserve: // battery is less than reserve => charge
ch_pc = SetChargePower(pw_batt_max, pw_batt_reserve, max_charge)
u.Log.Infof("battery %f W < reserve %f W", pw_batt, pw_batt_reserve)
ch_pc = SetChargePower(pw_batt_max, pw_batt_reserve-pw_batt, max_charge)
default:
pw_grid, charge_enabled := ChargeBattery(pw_pv_net, pw_batt)
if charge_enabled {
Expand Down

0 comments on commit 010ca1e

Please sign in to comment.