diff --git a/modules/EvseManager/EvseManager.cpp b/modules/EvseManager/EvseManager.cpp index b209516d5..3a15f2722 100644 --- a/modules/EvseManager/EvseManager.cpp +++ b/modules/EvseManager/EvseManager.cpp @@ -1547,32 +1547,37 @@ void EvseManager::cable_check() { // CC.4.1.4: Perform the insulation resistance check imd_start(); - // read out new isolation resistance value - isolation_measurement.clear(); - types::isolation_monitor::IsolationMeasurement m; - - EVLOG_info << "CableCheck: Waiting for " << config.cable_check_wait_number_of_imd_measurements - << " isolation measurement sample(s)"; - // Wait for N isolation measurement values - for (int i = 0; i < config.cable_check_wait_number_of_imd_measurements; i++) { - if (not isolation_measurement.wait_for(m, 5s) or cable_check_should_exit()) { - EVLOG_info << "Did not receive isolation measurement from IMD within 5 seconds."; + if (config.cable_check_wait_number_of_imd_measurements > 0) { + // read out new isolation resistance value + isolation_measurement.clear(); + types::isolation_monitor::IsolationMeasurement m; + + EVLOG_info << "CableCheck: Waiting for " << config.cable_check_wait_number_of_imd_measurements + << " isolation measurement sample(s)"; + // Wait for N isolation measurement values + for (int i = 0; i < config.cable_check_wait_number_of_imd_measurements; i++) { + if (not isolation_measurement.wait_for(m, 5s) or cable_check_should_exit()) { + EVLOG_info << "Did not receive isolation measurement from IMD within 5 seconds."; + imd_stop(); + fail_cable_check(); + return; + } + } + + charger->get_stopwatch().mark("Measure"); + + // Now the value is valid and can be trusted. + // Verify it is within ranges. Fault is <100 kOhm + // Note that 2023 edition removed the warning level which was included in the 2014 edition. + // Refer to IEC 61851-23 (2023) 6.3.1.105 and CC.4.1.2 / CC.4.1.4 + if (not check_isolation_resistance_in_range(m.resistance_F_Ohm)) { imd_stop(); fail_cable_check(); return; } - } - - charger->get_stopwatch().mark("Measure"); - - // Now the value is valid and can be trusted. - // Verify it is within ranges. Fault is <100 kOhm - // Note that 2023 edition removed the warning level which was included in the 2014 edition. - // Refer to IEC 61851-23 (2023) 6.3.1.105 and CC.4.1.2 / CC.4.1.4 - if (not check_isolation_resistance_in_range(m.resistance_F_Ohm)) { - imd_stop(); - fail_cable_check(); - return; + } else { + // If no measurements are needed after self test, report valid isolation status to ISO stack + r_hlc[0]->call_update_isolation_status(types::iso15118_charger::IsolationStatus::Valid); } // We are done with the isolation measurement and can now report success to the EV, @@ -1592,18 +1597,20 @@ void EvseManager::cable_check() { charger->get_stopwatch().mark("Sleep"); } - // CC.4.1.2: We need to wait until voltage is below 60V before sending a CableCheck Finished to the EV - powersupply_DC_off(); + if (config.cable_check_wait_below_60V_before_finish) { + // CC.4.1.2: We need to wait until voltage is below 60V before sending a CableCheck Finished to the EV + powersupply_DC_off(); - if (not wait_powersupply_DC_below_voltage(CABLECHECK_SAFE_VOLTAGE)) { - EVLOG_error << "Voltage did not drop below " << CABLECHECK_SAFE_VOLTAGE << "V within timeout."; - imd_stop(); - fail_cable_check(); - return; - } - charger->get_stopwatch().mark("VRampDown"); + if (not wait_powersupply_DC_below_voltage(CABLECHECK_SAFE_VOLTAGE)) { + EVLOG_error << "Voltage did not drop below " << CABLECHECK_SAFE_VOLTAGE << "V within timeout."; + imd_stop(); + fail_cable_check(); + return; + } + charger->get_stopwatch().mark("VRampDown"); - EVLOG_info << "CableCheck done, output is below " << CABLECHECK_SAFE_VOLTAGE << "V"; + EVLOG_info << "CableCheck done, output is below " << CABLECHECK_SAFE_VOLTAGE << "V"; + } // Report CableCheck Finished with success to EV r_hlc[0]->call_cable_check_finished(true); @@ -1814,7 +1821,6 @@ void EvseManager::imd_start() { // This returns our active local limits, which is either externally set limits // or hardware capabilties types::energy::ExternalLimits EvseManager::get_local_energy_limits() { - types::energy::ExternalLimits active_local_limits; std::scoped_lock lock(external_local_limits_mutex); diff --git a/modules/EvseManager/EvseManager.hpp b/modules/EvseManager/EvseManager.hpp index 67181fd1d..fc4ba9825 100644 --- a/modules/EvseManager/EvseManager.hpp +++ b/modules/EvseManager/EvseManager.hpp @@ -76,6 +76,7 @@ struct Conf { int hack_sleep_in_cable_check_volkswagen; int cable_check_wait_number_of_imd_measurements; bool cable_check_enable_imd_self_test; + bool cable_check_wait_below_60V_before_finish; bool hack_skoda_enyaq; int hack_present_current_offset; bool hack_pause_imd_during_precharge; diff --git a/modules/EvseManager/manifest.yaml b/modules/EvseManager/manifest.yaml index a40810d25..1c912d700 100644 --- a/modules/EvseManager/manifest.yaml +++ b/modules/EvseManager/manifest.yaml @@ -119,6 +119,24 @@ config: Enable self testing of IMD in cable check. This is required for IEC 61851-23 (2023) compliance. type: boolean default: true + cable_check_wait_below_60V_before_finish: + description: >- + Switch off power supply and wait until output voltage drops below 60V before cable check is finished. + Note: There are different versions of IEC 61851-23:2023 in the wild with the same version number but slightly different content. + The IEC was correcting mistakes _after_ releasing the document initially without tagging a new version number. + Some early versions require to wait for the output voltage to drop below 60V in CC.4.1.2 (last sentence). + Later versions do not have that requirement. The later versions are correct and should be used according to IEC. + Both settings (true and false) are compliant with the correct version of IEC 61851-23:2023. + Set to true when: + - the power supply has no active discharge, and lowering the voltage with no load takes a very long time. In this case + this option usually helps to ramp the voltage down quickly by switching it off. It will be switched on again in precharge. + Also, some EVs switch their internal relay on at a too high voltage when the voltage is ramped down directly from cablecheck voltage to precharge voltage, + so true is the recommended default. + Set to false when: + - the power supply has active discharge and can ramp down quickly without a switch off (by just setting a lower target voltage). + This may save a few seconds as it avoids unnecessary voltage down and up ramping. + type: boolean + default: true hack_skoda_enyaq: description: >- Skoda Enyaq requests DC charging voltages below its battery level or even below 0 initially.