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

AB#5093 Skip SalesTariff if free service. #249

Merged
merged 1 commit into from
Jun 16, 2023
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
2 changes: 2 additions & 0 deletions iso15118/secc/controller/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ async def is_authorized(
async def get_sa_schedule_list(
self,
ev_charge_params_limits: EVChargeParamsLimits,
is_free_charging_service: bool,
max_schedule_entries: Optional[int],
departure_time: int = 0,
) -> Optional[List[SAScheduleTuple]]:
Expand All @@ -310,6 +311,7 @@ async def get_sa_schedule_list(
Args:
ev_charge_params_limits: Lists the maximum limits of the EV: max_voltage,
max_current and e_amount(AC)/energy_requested(DC)
is_free_charging_service: Indicates if free sa schedules are to be returned.
max_schedule_entries: The maximum amount of schedule entries the EVCC
can handle, or None if not provided
departure_time: The departure time given in seconds from the time of
Expand Down
3 changes: 2 additions & 1 deletion iso15118/secc/controller/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ async def get_sa_schedule_list_dinspec(
async def get_sa_schedule_list(
self,
ev_charge_params_limits: EVChargeParamsLimits,
is_free_charging_service: bool,
max_schedule_entries: Optional[int],
departure_time: int = 0,
) -> Optional[List[SAScheduleTuple]]:
Expand Down Expand Up @@ -526,7 +527,7 @@ async def get_sa_schedule_list(
sa_schedule_tuple = SAScheduleTuple(
sa_schedule_tuple_id=1,
p_max_schedule=p_max_schedule,
sales_tariff=sales_tariff,
sales_tariff=None if is_free_charging_service else sales_tariff,
)

# TODO We could also implement an optional SalesTariff, but for the sake of
Expand Down
5 changes: 4 additions & 1 deletion iso15118/secc/states/iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,10 @@ async def process_message(
if not departure_time:
departure_time = 0
sa_schedule_list = await self.comm_session.evse_controller.get_sa_schedule_list(
ev_charge_params_limits, max_schedule_entries, departure_time
ev_charge_params_limits,
self.comm_session.config.free_charging_service,
max_schedule_entries,
departure_time,
)

sa_schedule_list_valid = self.validate_sa_schedule_list(
Expand Down
31 changes: 31 additions & 0 deletions tests/iso15118_2/secc/states/test_iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,34 @@ async def test_resumed_session_sa_schedule_tuple(
assert len(filtered_list) == 1
else:
assert len(filtered_list) == 0

@pytest.mark.parametrize(
"free_charging_service",
[
False,
True,
],
)
async def test_sales_tariff_in_free_charging_schedules(self, free_charging_service):
self.comm_session.config.free_charging_service = free_charging_service
charge_parameter_discovery = ChargeParameterDiscovery(self.comm_session)
energy_transfer_modes = (
await self.comm_session.evse_controller.get_supported_energy_transfer_modes(
Protocol.ISO_15118_2
)
)
await charge_parameter_discovery.process_message(
message=get_v2g_message_charge_parameter_discovery_req(
energy_transfer_modes[0]
)
)
for (
schedule_tuple
) in (
charge_parameter_discovery.message.body.charge_parameter_discovery_res.sa_schedule_list.schedule_tuples # noqa
):
assert (
schedule_tuple.sales_tariff is None
if free_charging_service
else not None
)