diff --git a/iso15118/evcc/controller/simulator.py b/iso15118/evcc/controller/simulator.py index a51e622f..34cc8872 100644 --- a/iso15118/evcc/controller/simulator.py +++ b/iso15118/evcc/controller/simulator.py @@ -114,7 +114,7 @@ class SimEVController(EVControllerInterface): def __init__(self, evcc_config: EVCCConfig): self.config = evcc_config - self.charging_loop_cycles: int = 0 + self.charging_loop_cycles: int = evcc_config.charge_loop_cycle self.precharge_loop_cycles: int = 0 self.welding_detection_cycles: int = 0 self._charging_is_completed = False @@ -526,11 +526,12 @@ async def process_sa_schedules_v2( async def continue_charging(self) -> bool: """Overrides EVControllerInterface.continue_charging().""" - if self.charging_loop_cycles == 10 or await self.is_charging_complete(): - # To simulate a bit of a charging loop, we'll let it run 10 times + if self.charging_loop_cycles == 0 or await self.is_charging_complete(): + # To simulate a bit of a charging loop, we'll let it run chargingLoopCycle + # times specified in config file return False else: - self.charging_loop_cycles += 1 + self.charging_loop_cycles -= 1 # The line below can just be called once process_message in all states # are converted to async calls # await asyncio.sleep(0.5) diff --git a/iso15118/evcc/evcc_config.py b/iso15118/evcc/evcc_config.py index b72c6a34..e9c7ac46 100644 --- a/iso15118/evcc/evcc_config.py +++ b/iso15118/evcc/evcc_config.py @@ -69,6 +69,9 @@ class EVCCConfig(BaseModel): # The SECC must not transmit more entries than defined in this parameter. max_supporting_points: Optional[int] = Field(1024, alias="maxSupportingPoints") + # charge cycle count + charge_loop_cycle: Optional[int] = Field(10, alias="chargeLoopCycle") + def load_raw_values(self): # conversion of list of strings to enum types. self.supported_energy_services = load_requested_energy_services( diff --git a/iso15118/shared/examples/evcc/DIN/evcc_config.json b/iso15118/shared/examples/evcc/DIN/evcc_config.json index 7c3057f7..809b00ff 100644 --- a/iso15118/shared/examples/evcc/DIN/evcc_config.json +++ b/iso15118/shared/examples/evcc/DIN/evcc_config.json @@ -4,5 +4,6 @@ ], "energyTransferMode": "DC_extended", "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_ac.json b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_ac.json index 41e7ac84..7b3fece5 100644 --- a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_ac.json +++ b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_ac.json @@ -6,5 +6,6 @@ "AC" ], "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_dc.json b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_dc.json index 9d9ba9be..faf0505f 100644 --- a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_dc.json +++ b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_dc.json @@ -7,5 +7,6 @@ ], "energyTransferMode": "DC_extended", "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_ac.json b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_ac.json index 4ec8ba3c..69eaa5ad 100644 --- a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_ac.json +++ b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_ac.json @@ -7,5 +7,6 @@ ], "energyTransferMode": "AC_three_phase_core", "isCertInstallNeeded": false, - "useTls": true + "useTls": true, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_dc.json b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_dc.json index 9d9ba9be..faf0505f 100644 --- a/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_dc.json +++ b/iso15118/shared/examples/evcc/iso15118_2/evcc_config_pnc_dc.json @@ -7,5 +7,6 @@ ], "energyTransferMode": "DC_extended", "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_20/evcc_config_ac_bpt.json b/iso15118/shared/examples/evcc/iso15118_20/evcc_config_ac_bpt.json index 289e787e..3af9d008 100644 --- a/iso15118/shared/examples/evcc/iso15118_20/evcc_config_ac_bpt.json +++ b/iso15118/shared/examples/evcc/iso15118_20/evcc_config_ac_bpt.json @@ -6,5 +6,6 @@ "AC_BPT" ], "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 } diff --git a/iso15118/shared/examples/evcc/iso15118_20/evcc_config_dc_bpt.json b/iso15118/shared/examples/evcc/iso15118_20/evcc_config_dc_bpt.json index 0a20bf80..fafa7016 100644 --- a/iso15118/shared/examples/evcc/iso15118_20/evcc_config_dc_bpt.json +++ b/iso15118/shared/examples/evcc/iso15118_20/evcc_config_dc_bpt.json @@ -6,5 +6,6 @@ "DC_BPT" ], "isCertInstallNeeded": false, - "useTls": false + "useTls": false, + "chargeLoopCycle": 10 }