Skip to content

Commit

Permalink
Merge branch 'master' into jtt_845_remove_3s_contactor_timeout_dc
Browse files Browse the repository at this point in the history
  • Loading branch information
shalinnijel2 authored Apr 16, 2024
2 parents 1e1bd3b + e661df8 commit 52fc78b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
11 changes: 11 additions & 0 deletions iso15118/secc/states/din_spec_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,17 @@ async def process_message(
IsolationLevel.VALID,
IsolationLevel.WARNING,
]:
# Requirement in 6.4.3.106 of the IEC 61851-23
# Any relays in the DC output circuit of the DC station shall
# be closed during the insulation test
if not await self.comm_session.evse_controller.is_contactor_closed():
self.stop_state_machine(
"Contactor didnt close for Cable Check",
message,
ResponseCode.FAILED,
)
return

if isolation_level == IsolationLevel.WARNING:
logger.warning(
"Isolation resistance measured by EVSE is in Warning-Range"
Expand Down
17 changes: 9 additions & 8 deletions iso15118/secc/states/iso15118_20_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,15 @@ async def process_message(
if not self.cable_check_req_was_received:
# First DCCableCheckReq received. Start cable check.
await self.comm_session.evse_controller.start_cable_check()
self.cable_check_req_was_received = True

next_state = None
processing = EVSEProcessing.ONGOING
isolation_level = (
await self.comm_session.evse_controller.get_cable_check_status()
)

if isolation_level in [IsolationLevel.VALID, IsolationLevel.WARNING]:
# Requirement in 6.4.3.106 of the IEC 61851-23
# Any relays in the DC output circuit of the DC station shall
# be closed during the insulation test
Expand All @@ -1619,15 +1628,7 @@ async def process_message(
ResponseCode.FAILED,
)
return
self.cable_check_req_was_received = True

next_state = None
processing = EVSEProcessing.ONGOING
isolation_level = (
await self.comm_session.evse_controller.get_cable_check_status()
)

if isolation_level in [IsolationLevel.VALID, IsolationLevel.WARNING]:
if isolation_level == IsolationLevel.WARNING:
logger.warning(
"Isolation resistance measured by EVSE is in Warning range"
Expand Down
22 changes: 11 additions & 11 deletions iso15118/secc/states/iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -2216,17 +2216,6 @@ async def process_message(
if not self.cable_check_req_was_received:
# First CableCheckReq received. Start cable check.
await self.comm_session.evse_controller.start_cable_check()
# Requirement in 6.4.3.106 of the IEC 61851-23
# Any relays in the DC output circuit of the DC station shall
# be closed during the insulation test
if not await self.comm_session.evse_controller.is_contactor_closed():
self.stop_state_machine(
"Contactor didnt close for Cable Check",
message,
ResponseCode.FAILED,
)
return

self.cable_check_req_was_received = True

self.comm_session.evse_controller.ev_data_context.present_soc = (
Expand All @@ -2243,6 +2232,17 @@ async def process_message(
IsolationLevel.VALID,
IsolationLevel.WARNING,
]:
# Requirement in 6.4.3.106 of the IEC 61851-23
# Any relays in the DC output circuit of the DC station shall
# be closed during the insulation test
if not await self.comm_session.evse_controller.is_contactor_closed():
self.stop_state_machine(
"Contactor didnt close for Cable Check",
message,
ResponseCode.FAILED,
)
return

if isolation_level == IsolationLevel.WARNING:
logger.warning(
"Isolation resistance measured by EVSE is in Warning-Range"
Expand Down
2 changes: 1 addition & 1 deletion tests/iso15118_20/secc/test_iso15118_20_dc_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ async def test_15118_20_schedule_exchange_res(
"cable_check_status, "
"expected_state",
[
(False, False, None, Terminate),
(False, False, IsolationLevel.VALID, Terminate),
(False, True, None, None),
(False, True, IsolationLevel.VALID, DCPreCharge),
(True, True, None, None),
Expand Down

0 comments on commit 52fc78b

Please sign in to comment.