From 1e1bd3be8de514079effb708913fa6377737552e Mon Sep 17 00:00:00 2001 From: Shalin Nijel <89510971+shalinnijel2@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:00:27 +0100 Subject: [PATCH] Removed contactor status related changes --- iso15118/secc/states/din_spec_states.py | 21 +++++++++---------- iso15118/secc/states/iso15118_20_states.py | 21 +++++++++---------- iso15118/secc/states/iso15118_2_states.py | 21 +++++++++---------- .../secc/test_iso15118_20_dc_states.py | 2 +- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/iso15118/secc/states/din_spec_states.py b/iso15118/secc/states/din_spec_states.py index 95b687d5..18dae6b6 100644 --- a/iso15118/secc/states/din_spec_states.py +++ b/iso15118/secc/states/din_spec_states.py @@ -470,6 +470,16 @@ 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 @@ -492,17 +502,6 @@ 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" diff --git a/iso15118/secc/states/iso15118_20_states.py b/iso15118/secc/states/iso15118_20_states.py index d57738da..fece6bfb 100644 --- a/iso15118/secc/states/iso15118_20_states.py +++ b/iso15118/secc/states/iso15118_20_states.py @@ -1609,7 +1609,16 @@ 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() - + # 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 next_state = None @@ -1623,16 +1632,6 @@ async def process_message( logger.warning( "Isolation resistance measured by EVSE is in Warning range" ) - # 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 next_state = DCPreCharge processing = EVSEProcessing.FINISHED elif isolation_level in [IsolationLevel.INVALID, IsolationLevel.FAULT]: diff --git a/iso15118/secc/states/iso15118_2_states.py b/iso15118/secc/states/iso15118_2_states.py index 92358dde..4743dbf4 100644 --- a/iso15118/secc/states/iso15118_2_states.py +++ b/iso15118/secc/states/iso15118_2_states.py @@ -2216,6 +2216,16 @@ 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 @@ -2233,17 +2243,6 @@ 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" diff --git a/tests/iso15118_20/secc/test_iso15118_20_dc_states.py b/tests/iso15118_20/secc/test_iso15118_20_dc_states.py index a0bf55e9..8cf0ca54 100644 --- a/tests/iso15118_20/secc/test_iso15118_20_dc_states.py +++ b/tests/iso15118_20/secc/test_iso15118_20_dc_states.py @@ -212,7 +212,7 @@ async def test_15118_20_schedule_exchange_res( "cable_check_status, " "expected_state", [ - (False, False, IsolationLevel.VALID, Terminate), + (False, False, None, Terminate), (False, True, None, None), (False, True, IsolationLevel.VALID, DCPreCharge), (True, True, None, None),