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

Adding another quarter to flex time, when we started charging #185

Open
wants to merge 3 commits into
base: v1.2.1
Choose a base branch
from
Open
Changes from 2 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
7 changes: 7 additions & 0 deletions lib/TWCManager/TWCMaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ def getScheduledAmpsTimeFlex(self):
slave = next(iter(self.slaveTWCs.values()))
vehicle = slave.getLastVehicle()
if vehicle != None:
# we update current SOC - but only when charging
if slave.isCharging==1:
vehicle.update_charge()
dschuesae marked this conversation as resolved.
Show resolved Hide resolved

amps = self.getScheduledAmpsMax()
watts = self.convertAmpsToWatts(amps) * self.getRealPowerFactor(amps)
hoursForFullCharge = self.getScheduledAmpsBatterySize() / (watts / 1000)
Expand All @@ -308,6 +312,9 @@ def getScheduledAmpsTimeFlex(self):
# adding half an hour if battery should be charged over 98%
if vehicle.chargeLimit >= 98:
startHour -= 0.5
# As soon we start charge, we set start charging another quarter of an hour back - so it won't start and stop charging the whole time
if slave.isCharging==1:
startHour -= 0.25
if startHour < 0:
startHour = startHour + 24
# if startHour is smaller than the intial startHour, then it should begin beginn charging a day later
Expand Down