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

soc request interval in s #1271

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
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
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