Skip to content
Open
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
1 change: 1 addition & 0 deletions iso15118/evcc/comm_session_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def __init__(
self.is_tls = False

self.sae_j2847_active: int = 0
self.service_hpc1_active: bool = False

def create_sap(self) -> Union[SupportedAppProtocolReq, None]:
"""
Expand Down
5 changes: 4 additions & 1 deletion iso15118/evcc/controller/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ async def process_sa_schedules_v2(
self, sa_schedules: List[SAScheduleTuple]
) -> Tuple[ChargeProgressV2, int, ChargingProfile]:
"""Overrides EVControllerInterface.process_sa_schedules()."""
secc_schedule = sa_schedules.pop()
secc_schedule = sa_schedules.pop(0) #[V2G2-297]
evcc_profile_entry_list: List[ProfileEntryDetails] = []

# The charging schedule coming from the SECC is called 'schedule', the
Expand Down Expand Up @@ -886,6 +886,9 @@ async def get_display_params(self) -> DisplayParameters:
charging_complete=await self.is_charging_complete(),
)

async def is_service_hpc1_active(self) -> bool:
return EVEREST_EV_STATE.ServiceHPC1_Active

# ============================================================================
# | SAE J2847/2 FUNCTIONS |
# ============================================================================
Expand Down
3 changes: 3 additions & 0 deletions iso15118/evcc/everest/ev_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class EVState:
dc_discharge_max_power_limit: float = 0
dc_discharge_target_current: float = 0

# Service HPC1
ServiceHPC1_Active: bool = False

# SAE J2847/2
SAEJ2847_V2H_V2G_Active = False
minimal_soc = 20
Expand Down
33 changes: 28 additions & 5 deletions iso15118/evcc/states/iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,17 @@
)
self.comm_session.sae_j2847_active = service.service_id

# Request more service details if you're interested in e.g.
# an Internet service or a use case-specific service
# check if service HPC1 is offered
if (service.service_category == ServiceCategory.CUSTOM
and await self.comm_session.ev_controller.is_service_hpc1_active() == True

Check notice on line 349 in iso15118/evcc/states/iso15118_2_states.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

iso15118/evcc/states/iso15118_2_states.py#L349

comparison to True should be 'if cond is True:' or 'if cond:' (E712)
and service.service_id == 63000):
self.comm_session.selected_services.append(
SelectedService(service_id=service.service_id)
)
self.comm_session.service_hpc1_active = True

# Request more service details if you're interested in e.g.
# an Internet service or a use case-specific service

logger.debug(f"Offered value-added services: {offered_services}")

Expand Down Expand Up @@ -793,6 +802,9 @@
# if e.g. EVSENotification is set to STOP_CHARGING or if RCD
# is True. But let's do that after the testival

if self.comm_session.service_hpc1_active and len(charge_params_res.sa_schedule_list) > 2:
charge_params_res.sa_schedule_list = charge_params_res.sa_schedule_list[:2] # [V2G2-PnC-CharIN-017]

Check notice on line 806 in iso15118/evcc/states/iso15118_2_states.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

iso15118/evcc/states/iso15118_2_states.py#L806

over-indented (E117)

(
charge_progress,
schedule_id,
Expand Down Expand Up @@ -830,7 +842,10 @@
Namespace.ISO_V2_MSG_DEF,
)

self.comm_session.selected_schedule = schedule_id
if await self.comm_session.ev_controller.is_service_hpc1_active():
self.comm_session.selected_schedule = charge_params_res.sa_schedule_list.schedule_tuples[0].sa_schedule_tuple_id # [V2G2-PnC-CharIN-036]
else:
self.comm_session.selected_schedule = schedule_id

await self.comm_session.ev_controller.enable_charging(True)
else:
Expand Down Expand Up @@ -866,6 +881,9 @@
dc_ev_charge_parameter=charge_params.dc_parameters,
)

if await self.comm_session.ev_controller.is_service_hpc1_active():
charge_parameter_discovery_req.max_entries_sa_schedule_tuple = None #[V2G2-PnC-CharIN-018]

self.create_next_message(
ChargeParameterDiscovery,
charge_parameter_discovery_req,
Expand Down Expand Up @@ -925,7 +943,12 @@
Timeouts.WELDING_DETECTION_REQ,
Namespace.ISO_V2_MSG_DEF,
)
elif self.comm_session.renegotiation_requested:
elif self.comm_session.renegotiation_requested and not await self.comm_session.ev_controller.is_service_hpc1_active():
# In HPC1, the EVSE and the EV do not use the renegotiation mechanism.
# [V2G2-PnC-CharIN-016] If the SECC sent the ServiceID service
# 63000, Service Name and ServiceCategory for HPC1 as
# defined in Table 105 it shall not use EVSENotification =
# Renegotiate.
self.comm_session.renegotiation_requested = False

charge_params = await self.comm_session.ev_controller.get_charge_params_v2(
Expand Down Expand Up @@ -1040,7 +1063,7 @@
Timeouts.POWER_DELIVERY_REQ,
Namespace.ISO_V2_MSG_DEF,
)
elif notification == EVSENotification.RE_NEGOTIATION:
elif notification == EVSENotification.RE_NEGOTIATION and not await self.comm_session.ev_controller.is_service_hpc1_active():
logger.debug("SECC requested a renegotiation")
self.comm_session.renegotiation_requested = True
self.create_next_message(
Expand Down