Skip to content

Commit a77ac47

Browse files
committed
Use self consume as part of idle strategy when actual pv and/or consumption doesn't match forecast
1 parent 6c7e858 commit a77ac47

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

delegates/dynamicess.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from enum import Enum
1111

1212
NUM_SCHEDULES = 12
13-
INTERVAL = 5
13+
INTERVAL = 2
1414
SELLPOWER = -32000
1515
HUB4_SERVICE = 'com.victronenergy.hub4'
1616

@@ -60,7 +60,7 @@ def charge(self, flags, restrictions, rate, allow_feedin):
6060
def discharge(self, flags, restrictions, rate, allow_feedin):
6161
raise NotImplementedError("discharge")
6262

63-
def idle(self, allow_feedin):
63+
def idle(self, restrictions, allow_feedin):
6464
raise NotImplementedError("idle")
6565

6666
def self_consume(self, restrictions, allow_feedin):
@@ -177,21 +177,21 @@ def discharge(self, flags, restrictions, rate, allow_feedin):
177177
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/MaxDischargePower', -1)
178178
return rate
179179

180-
def idle(self, allow_feedin):
180+
def idle(self, restrictions, allow_feedin):
181181
self._set_feedin(allow_feedin)
182182
self._set_charge_power(None)
183183
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/ForceCharge', 0)
184184

185-
if allow_feedin:
185+
# When idle only configure setpoint and maxDischarge overrides if consumption < pv. Otherwise, use standard ESS
186+
# (which is also quicker to react) to avoid importing when pv is lower, or consumption higher, than forecast.
187+
if allow_feedin and self.consumption < self.acpv + self.pvpower:
186188
# This keeps battery idle by not allowing more power to be taken
187189
# from the DC bus than what DC-coupled PV provides.
188190
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/MaxDischargePower',
189191
max(1.0, round(0.9*self.pvpower)))
190192
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/Setpoint', self.maxfeedinpower)
191193
else:
192-
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/Setpoint', 0) # Normal ESS
193-
self.monitor.set_value_async(HUB4_SERVICE, '/Overrides/MaxDischargePower', max(1.0, self.pvpower))
194-
194+
self.self_consume(restrictions, allow_feedin)
195195
return None
196196

197197
def self_consume(self, restrictions, allow_feedin):
@@ -276,7 +276,7 @@ def discharge(self, flags, restrictions, rate, allow_feedin):
276276

277277
return rate
278278

279-
def idle(self, allow_feedin):
279+
def idle(self, restrictions, allow_feedin):
280280
self.monitor.set_value_async(self.service, '/Ess/DisableFeedIn', int(not allow_feedin))
281281
self.monitor.set_value_async(self.service, '/Ess/UseInverterPowerSetpoint', 1)
282282
self.monitor.set_value_async(self.service, '/Ess/InverterPowerSetpoint', -max(0, self.pvpower))
@@ -583,7 +583,7 @@ def bail(code):
583583
# zone
584584
self.discharge_hysteresis = 1
585585
self._dbusservice['/DynamicEss/ChargeRate'] = \
586-
self._device.idle(w.allow_feedin)
586+
self._device.idle(restrictions, w.allow_feedin)
587587

588588
break # out of for loop
589589
else:

0 commit comments

Comments
 (0)