Skip to content

Commit

Permalink
Merge pull request #1271 from LKuemmel/soc_request_interval
Browse files Browse the repository at this point in the history
soc request interval in s
  • Loading branch information
benderl authored Dec 11, 2023
2 parents 821d162 + 58328ba commit 836c2f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/control/ev.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def soc_interval_expired(self, vehicle_update_data: VehicleUpdateData) -> bool:
else:
interval = self.soc_module.general_config.request_interval_not_charging
# Zeitstempel prüfen, ob wieder abgefragt werden muss.
if timecheck.check_timestamp(self.data.get.soc_timestamp, interval*60-5) is False:
if timecheck.check_timestamp(self.data.get.soc_timestamp, interval-5) is False:
# Zeit ist abgelaufen
request_soc = True
return request_soc
Expand Down Expand Up @@ -771,7 +771,7 @@ def scheduled_charging_calc_current(self,
phases = control_parameter_phases
elif limit.selected == "amount" and used_amount >= limit.amount:
message = self.SCHEDULED_CHARGING_REACHED_AMOUNT
elif 0 - soc_request_intervall_offset*60 < plan_data.remaining_time < 300 + soc_request_intervall_offset*60:
elif 0 - soc_request_intervall_offset < plan_data.remaining_time < 300 + soc_request_intervall_offset:
# 5 Min vor spätestem Ladestart
if limit.selected == "soc":
limit_string = self.SCHEDULED_CHARGING_LIMITED_BY_SOC.format(limit.soc_scheduled)
Expand All @@ -783,7 +783,7 @@ def scheduled_charging_calc_current(self,
mode = "instant_charging"
# weniger als die berechnete Zeit verfügbar
# Ladestart wurde um maximal 20 Min verpasst.
elif plan_data.remaining_time <= 0 - soc_request_intervall_offset*60:
elif plan_data.remaining_time <= 0 - soc_request_intervall_offset:
current = min(plan_data.missing_amount/(plan_data.duration +
plan_data.remaining_time/3600)/(phases*230), plan_data.max_current)
message = self.SCHEDULED_CHARGING_MAX_CURRENT.format(round(current, 2))
Expand Down
13 changes: 12 additions & 1 deletion packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


class UpdateConfig:
DATASTORE_VERSION = 29
DATASTORE_VERSION = 30
valid_topic = [
"^openWB/bat/config/configured$",
"^openWB/bat/set/charging_power_left$",
Expand Down Expand Up @@ -1053,3 +1053,14 @@ def upgrade(topic: str, payload) -> None:
Pub().pub(topic.replace("openWB/", "openWB/set/"), payload)
self._loop_all_received_topics(upgrade)
Pub().pub("openWB/system/datastore_version", 29)

def upgrade_datastore_29(self) -> None:
def upgrade(topic: str, payload) -> None:
if re.search("openWB/vehicle/[0-9]+/soc_module/general_config", topic) is not None:
payload = decode_payload(payload)
# Zeitangabe in s
payload["request_interval_charging"] = payload["request_interval_charging"]*60
payload["request_interval_not_charging"] = payload["request_interval_not_charging"]*60
Pub().pub(topic.replace("openWB/", "openWB/set/"), payload)
self._loop_all_received_topics(upgrade)
Pub().pub("openWB/system/datastore_version", 30)
4 changes: 2 additions & 2 deletions packages/modules/common/abstract_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class VehicleUpdateData:
@dataclass
class GeneralVehicleConfig:
use_soc_from_cp: bool = False
request_interval_charging: int = 5
request_interval_not_charging: int = 720
request_interval_charging: int = 300
request_interval_not_charging: int = 43200
request_only_plugged: bool = False


Expand Down

0 comments on commit 836c2f4

Please sign in to comment.