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

evcc charging loop time added to config #262

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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._charging_is_completed = False
self._soc = 10
Expand Down Expand Up @@ -525,11 +525,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
}