Skip to content

Commit dee89f4

Browse files
CableCheck: allow 0 samples, option to disable wait below 60V at end … (#990)
* CableCheck: allow 0 samples, option to disable wait below 60V at end of cablecheck Signed-off-by: Cornelius Claussen <cc@pionix.de> --------- Signed-off-by: Cornelius Claussen <cc@pionix.de> Co-authored-by: Kai Hermann <kai-uwe.hermann@pionix.de>
1 parent 48581e9 commit dee89f4

File tree

3 files changed

+58
-33
lines changed

3 files changed

+58
-33
lines changed

modules/EvseManager/EvseManager.cpp

+39-33
Original file line numberDiff line numberDiff line change
@@ -1547,32 +1547,37 @@ void EvseManager::cable_check() {
15471547
// CC.4.1.4: Perform the insulation resistance check
15481548
imd_start();
15491549

1550-
// read out new isolation resistance value
1551-
isolation_measurement.clear();
1552-
types::isolation_monitor::IsolationMeasurement m;
1553-
1554-
EVLOG_info << "CableCheck: Waiting for " << config.cable_check_wait_number_of_imd_measurements
1555-
<< " isolation measurement sample(s)";
1556-
// Wait for N isolation measurement values
1557-
for (int i = 0; i < config.cable_check_wait_number_of_imd_measurements; i++) {
1558-
if (not isolation_measurement.wait_for(m, 5s) or cable_check_should_exit()) {
1559-
EVLOG_info << "Did not receive isolation measurement from IMD within 5 seconds.";
1550+
if (config.cable_check_wait_number_of_imd_measurements > 0) {
1551+
// read out new isolation resistance value
1552+
isolation_measurement.clear();
1553+
types::isolation_monitor::IsolationMeasurement m;
1554+
1555+
EVLOG_info << "CableCheck: Waiting for " << config.cable_check_wait_number_of_imd_measurements
1556+
<< " isolation measurement sample(s)";
1557+
// Wait for N isolation measurement values
1558+
for (int i = 0; i < config.cable_check_wait_number_of_imd_measurements; i++) {
1559+
if (not isolation_measurement.wait_for(m, 5s) or cable_check_should_exit()) {
1560+
EVLOG_info << "Did not receive isolation measurement from IMD within 5 seconds.";
1561+
imd_stop();
1562+
fail_cable_check();
1563+
return;
1564+
}
1565+
}
1566+
1567+
charger->get_stopwatch().mark("Measure");
1568+
1569+
// Now the value is valid and can be trusted.
1570+
// Verify it is within ranges. Fault is <100 kOhm
1571+
// Note that 2023 edition removed the warning level which was included in the 2014 edition.
1572+
// Refer to IEC 61851-23 (2023) 6.3.1.105 and CC.4.1.2 / CC.4.1.4
1573+
if (not check_isolation_resistance_in_range(m.resistance_F_Ohm)) {
15601574
imd_stop();
15611575
fail_cable_check();
15621576
return;
15631577
}
1564-
}
1565-
1566-
charger->get_stopwatch().mark("Measure");
1567-
1568-
// Now the value is valid and can be trusted.
1569-
// Verify it is within ranges. Fault is <100 kOhm
1570-
// Note that 2023 edition removed the warning level which was included in the 2014 edition.
1571-
// Refer to IEC 61851-23 (2023) 6.3.1.105 and CC.4.1.2 / CC.4.1.4
1572-
if (not check_isolation_resistance_in_range(m.resistance_F_Ohm)) {
1573-
imd_stop();
1574-
fail_cable_check();
1575-
return;
1578+
} else {
1579+
// If no measurements are needed after self test, report valid isolation status to ISO stack
1580+
r_hlc[0]->call_update_isolation_status(types::iso15118_charger::IsolationStatus::Valid);
15761581
}
15771582

15781583
// We are done with the isolation measurement and can now report success to the EV,
@@ -1592,18 +1597,20 @@ void EvseManager::cable_check() {
15921597
charger->get_stopwatch().mark("Sleep");
15931598
}
15941599

1595-
// CC.4.1.2: We need to wait until voltage is below 60V before sending a CableCheck Finished to the EV
1596-
powersupply_DC_off();
1600+
if (config.cable_check_wait_below_60V_before_finish) {
1601+
// CC.4.1.2: We need to wait until voltage is below 60V before sending a CableCheck Finished to the EV
1602+
powersupply_DC_off();
15971603

1598-
if (not wait_powersupply_DC_below_voltage(CABLECHECK_SAFE_VOLTAGE)) {
1599-
EVLOG_error << "Voltage did not drop below " << CABLECHECK_SAFE_VOLTAGE << "V within timeout.";
1600-
imd_stop();
1601-
fail_cable_check();
1602-
return;
1603-
}
1604-
charger->get_stopwatch().mark("VRampDown");
1604+
if (not wait_powersupply_DC_below_voltage(CABLECHECK_SAFE_VOLTAGE)) {
1605+
EVLOG_error << "Voltage did not drop below " << CABLECHECK_SAFE_VOLTAGE << "V within timeout.";
1606+
imd_stop();
1607+
fail_cable_check();
1608+
return;
1609+
}
1610+
charger->get_stopwatch().mark("VRampDown");
16051611

1606-
EVLOG_info << "CableCheck done, output is below " << CABLECHECK_SAFE_VOLTAGE << "V";
1612+
EVLOG_info << "CableCheck done, output is below " << CABLECHECK_SAFE_VOLTAGE << "V";
1613+
}
16071614

16081615
// Report CableCheck Finished with success to EV
16091616
r_hlc[0]->call_cable_check_finished(true);
@@ -1814,7 +1821,6 @@ void EvseManager::imd_start() {
18141821
// This returns our active local limits, which is either externally set limits
18151822
// or hardware capabilties
18161823
types::energy::ExternalLimits EvseManager::get_local_energy_limits() {
1817-
18181824
types::energy::ExternalLimits active_local_limits;
18191825

18201826
std::scoped_lock lock(external_local_limits_mutex);

modules/EvseManager/EvseManager.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct Conf {
7676
int hack_sleep_in_cable_check_volkswagen;
7777
int cable_check_wait_number_of_imd_measurements;
7878
bool cable_check_enable_imd_self_test;
79+
bool cable_check_wait_below_60V_before_finish;
7980
bool hack_skoda_enyaq;
8081
int hack_present_current_offset;
8182
bool hack_pause_imd_during_precharge;

modules/EvseManager/manifest.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ config:
119119
Enable self testing of IMD in cable check. This is required for IEC 61851-23 (2023) compliance.
120120
type: boolean
121121
default: true
122+
cable_check_wait_below_60V_before_finish:
123+
description: >-
124+
Switch off power supply and wait until output voltage drops below 60V before cable check is finished.
125+
Note: There are different versions of IEC 61851-23:2023 in the wild with the same version number but slightly different content.
126+
The IEC was correcting mistakes _after_ releasing the document initially without tagging a new version number.
127+
Some early versions require to wait for the output voltage to drop below 60V in CC.4.1.2 (last sentence).
128+
Later versions do not have that requirement. The later versions are correct and should be used according to IEC.
129+
Both settings (true and false) are compliant with the correct version of IEC 61851-23:2023.
130+
Set to true when:
131+
- the power supply has no active discharge, and lowering the voltage with no load takes a very long time. In this case
132+
this option usually helps to ramp the voltage down quickly by switching it off. It will be switched on again in precharge.
133+
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,
134+
so true is the recommended default.
135+
Set to false when:
136+
- the power supply has active discharge and can ramp down quickly without a switch off (by just setting a lower target voltage).
137+
This may save a few seconds as it avoids unnecessary voltage down and up ramping.
138+
type: boolean
139+
default: true
122140
hack_skoda_enyaq:
123141
description: >-
124142
Skoda Enyaq requests DC charging voltages below its battery level or even below 0 initially.

0 commit comments

Comments
 (0)