Skip to content

Commit

Permalink
evcc charging loop time added to config (#262)
Browse files Browse the repository at this point in the history
* evcc charging loop time added to config

* charge cycle is 10
  • Loading branch information
ikaratass authored Feb 14, 2024
1 parent c947788 commit 08419d8
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
9 changes: 5 additions & 4 deletions iso15118/evcc/controller/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions iso15118/evcc/evcc_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion iso15118/shared/examples/evcc/DIN/evcc_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
],
"energyTransferMode": "DC_extended",
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"AC"
],
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
],
"energyTransferMode": "DC_extended",
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
],
"energyTransferMode": "AC_three_phase_core",
"isCertInstallNeeded": false,
"useTls": true
"useTls": true,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
],
"energyTransferMode": "DC_extended",
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"AC_BPT"
],
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"DC_BPT"
],
"isCertInstallNeeded": false,
"useTls": false
"useTls": false,
"chargeLoopCycle": 10
}

0 comments on commit 08419d8

Please sign in to comment.