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

Share cpd params with CS. #400

Merged
merged 3 commits into from
Apr 30, 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
15 changes: 15 additions & 0 deletions iso15118/secc/controller/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,3 +1056,18 @@ async def session_ended(self, current_state: str, reason: str):
Indicate the reason for stopping charging.
"""
raise NotImplementedError

@abstractmethod
async def send_rated_limits(self):
"""
This method is called in the state ChargeParameterDiscovery state for all
protocols.
The message is used to share the physical limitations of the EV (perhaps
for this session alone) with the charging station.

Relevant for:
- DIN SPEC 70121
- ISO 15118-2
- ISO 15118-20
"""
raise NotImplementedError
6 changes: 6 additions & 0 deletions iso15118/secc/controller/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,3 +1090,9 @@ async def session_ended(self, current_state: str, reason: str):
@param last_message: The last message that was either sent/received.
"""
logger.info(f"Session ended in {current_state} ({reason}).")

async def send_rated_limits(self):
"""
Overrides EVSEControllerInterface.send_rated_limits
"""
logger.info("Send rated limits to CS.")
2 changes: 1 addition & 1 deletion iso15118/secc/states/din_spec_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ async def process_message(
ev_data_context.update_dc_charge_parameters(
charge_parameter_discovery_req.dc_ev_charge_parameter
)

await self.comm_session.evse_controller.send_rated_limits()
dc_evse_charge_params = (
await self.comm_session.evse_controller.get_dc_charge_parameters_dinspec() # noqa
)
Expand Down
2 changes: 2 additions & 0 deletions iso15118/secc/states/iso15118_20_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,7 @@ async def process_message(
ev_data_context.update_ac_charge_parameters_v20(energy_service, ac_cpd_req)
evse_data_context = self.comm_session.evse_controller.evse_data_context
evse_data_context.current_type = CurrentType.AC
await self.comm_session.evse_controller.send_rated_limits()
except UnknownEnergyService:
self.stop_state_machine(
f"Invalid charge parameter for service {energy_service}",
Expand Down Expand Up @@ -1545,6 +1546,7 @@ async def process_message(
ev_data_context.update_dc_charge_parameters_v20(energy_service, dc_cpd_req)
evse_data_context = self.comm_session.evse_controller.evse_data_context
evse_data_context.current_type = CurrentType.DC
await self.comm_session.evse_controller.send_rated_limits()
except UnknownEnergyService:
self.stop_state_machine(
f"Invalid charge parameter for service {energy_service}",
Expand Down
1 change: 1 addition & 0 deletions iso15118/secc/states/iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ async def process_message(
ev_data_context.update_dc_charge_parameters(
charge_params_req.dc_ev_charge_parameter
)
await self.comm_session.evse_controller.send_rated_limits()

departure_time = (
ev_data_context.departure_time if ev_data_context.departure_time else 0
Expand Down
3 changes: 3 additions & 0 deletions tests/shared/messages/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def ready_to_charge(self):
async def session_ended(self, _):
pass

async def send_rated_limits(self):
pass


@pytest.fixture
def evse_controller_interface():
Expand Down