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

info messages for pv charging #1954

Merged
merged 2 commits into from
Oct 16, 2024
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
7 changes: 5 additions & 2 deletions packages/control/ev.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ def instant_charging(self,
return 0, "stop", "Keine Ladung, da da ein interner Fehler aufgetreten ist: "+traceback.format_exc()

PV_CHARGING_SOC_REACHED = "Keine Ladung, da der maximale Soc bereits erreicht wurde."
PV_CHARGING_SOC_CHARGING = ("Ladung evtl. auch ohne PV-Überschuss, da der Mindest-SoC des Fahrzeugs noch nicht "
"erreicht wurde.")
PV_CHARGING_MIN_CURRENT_CHARGING = "Ladung evtl. auch ohne PV-Überschuss, da minimaler Dauerstrom aktiv ist."

def pv_charging(self, soc: Optional[float], min_current: int, charging_type: str) -> Tuple[int, str, Optional[str]]:
""" prüft, ob Min-oder Max-Soc erreicht wurden und setzt entsprechend den Ladestrom.
Expand All @@ -707,7 +710,7 @@ def pv_charging(self, soc: Optional[float], min_current: int, charging_type: str
current = pv_charging.min_soc_current
else:
current = pv_charging.dc_min_soc_current
return current, "instant_charging", message
return current, "instant_charging", self.PV_CHARGING_SOC_CHARGING
if charging_type == ChargingType.AC.value:
pv_min_current = pv_charging.min_current
else:
Expand All @@ -717,7 +720,7 @@ def pv_charging(self, soc: Optional[float], min_current: int, charging_type: str
return min_current, "pv_charging", message
else:
# Min PV
return pv_min_current, "instant_charging", message
return pv_min_current, "instant_charging", self.PV_CHARGING_MIN_CURRENT_CHARGING
else:
return 0, "stop", self.PV_CHARGING_SOC_REACHED
except Exception:
Expand Down
6 changes: 4 additions & 2 deletions packages/control/ev_charge_template_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def test_instant_charging(selected: str, current_soc: float, used_amount: float,
"min_soc, min_current, current_soc, expected",
[
pytest.param(0, 0, 100, (0, "stop", ChargeTemplate.PV_CHARGING_SOC_REACHED), id="max soc reached"),
pytest.param(15, 0, 14, (10, "instant_charging", None), id="min soc not reached"),
pytest.param(15, 0, 14, (10, "instant_charging", ChargeTemplate.PV_CHARGING_SOC_CHARGING),
id="min soc not reached"),
pytest.param(15, 0, None, (6, "pv_charging", None), id="soc not defined"),
pytest.param(15, 8, 15, (8, "instant_charging", None), id="min current configured"),
pytest.param(15, 8, 15, (8, "instant_charging", ChargeTemplate.PV_CHARGING_MIN_CURRENT_CHARGING),
id="min current configured"),
pytest.param(15, 0, 15, (6, "pv_charging", None), id="bare pv charging"),
])
def test_pv_charging(min_soc: int, min_current: int, current_soc: float,
Expand Down