Write the characterisation program of a lithium-ion cell test lab (reference capacity, OCV curve and second-order equivalent-circuit tables over SOC and temperature from cycler exports, plus a blind drive-cycle voltage prediction); it is run on further test campaigns with known reference values.
harbor run -t reactive-labs/cell-ecm-fitharbor download reactive-labs/cell-ecm-fitYou are Ilse Brandsma, test engineer in the Cell Test Laboratory of Kelderwick Energy in Eindhoven. The lab characterises KW50-A cells (21700, NMC811 / graphite-SiOx, 5.0 Ah nominal) on two Tavish BTS-30 cyclers, rigs R1 and R2, each in its own Voskamp climate chamber, to test plan TP-014 and procedure SOP-CT-007. Today is Monday 28 September 2026. Ruben Achterberg, head of cell testing, wrote this morning:
We have eight KW50-A campaigns from this year on the share that were never evaluated to the SOP (Joost only ran his quick script on a few before he left), and Arjun needs the cell model for the BMS release. Please write the evaluation as one program that takes a campaign folder as the operators leave it and produces capacity, OCV curve and the 2RC tables to SOP-CT-007, plus the prediction of the blind T06 drive cycle. Marleen will run it on Quality's validation campaigns before we release anything, so it has to work on any campaign from R1 and R2 of this year as it is, without anyone editing it per campaign.
In /app/inputs:
campaigns/: the eight campaigns in hand, KC-26-001 to KC-26-008. Each folder holds exports/ (CellDesk
exports of the tests), chamber/ (Klimalog exports), barcode_scans.csv and campaign_sheet.csv.docs/procedures/: SOP-CT-007 rev 4, TP-014 rev C and the CellDesk 4.1.2 release notes.docs/calibration/: the 2025 calibration records of both rigs, the R1 zero-adjustment record and metrology
note MN-2026-03.docs/elog_celltest_2026_extract.csv: the lab e-log of 2026 for the instruments, chambers, procedures and the
campaigns in hand.docs/mail/: the mails from Ruben, Arjun Mehta (BMS modelling) and Marleen Wouters (Quality).legacy/: the HPPC script of the previous test engineer and his handover note./app/output/ecm_fit.py, run as
python3 /app/output/ecm_fit.py <campaign_dir> <out.json>
It reads one campaign folder in the format of the eight in hand and writes one JSON object:
{"campaign": "KC-26-001", "cell_id": "KW50A-1101",
"capacity_ah": 4.8921,
"ocv_v": [3.4512, ...],
"ecm": {"10": {"r0_mohm": [...], "r1_mohm": [...], "tau1_s": [...], "r2_mohm": [...], "tau2_s": [...]},
"25": {...}, "40": {...}},
"validation": {"file": "R2-C15_20260226_1556_TP014B-T06_VAL.csv", "records": [5121, 5122, ...],
"voltage_v": [3.9123, 3.8810, ...]}}
| Key | Content |
|---|---|
campaign, cell_id |
from the campaign sheet (not scored) |
capacity_ah |
reference capacity C_ref of the campaign's cell, Ah (SOP-CT-007 8.1) |
ocv_v |
open-circuit voltage at SOC 0.1, 0.2, ..., 0.9 (nine values, in that order), V |
ecm[T][p] |
second-order equivalent-circuit parameter p at cell temperature T = "10", "25", "40" degC, at SOC 0.1 ... 0.9 (nine values each): r0_mohm, r1_mohm, r2_mohm in mOhm, tau1_s, tau2_s in s, with tau1 < tau2 |
validation.file |
file name (no path) of the T06 export of this campaign's cell |
validation.records |
the record indices (first column of the export) of every record of that export whose voltage is empty |
validation.voltage_v |
the predicted cell-terminal voltage at each of those records, V, same order |
SOC is on the scale of SOP-CT-007 8.2 (1 at the end of the CC-CV charge, charge counted against C_ref of the campaign's own T01), the circuit is the one of SOP-CT-007 8.4, and the temperatures are cell temperatures, not chamber setpoints.
The program runs with Python 3.12, numpy 2.1, scipy 1.14 and pandas 2.2, on one CPU core with 3 GB of memory
and no network, and must finish a campaign within 60 seconds. It is run as another user from a copy of
/app/output: it may load helper files that you put in /app/output (found relative to __file__), but
/app/inputs is not there when it runs.
/app/output/results/<campaign>.json for each of the eight campaigns in hand (for example
/app/output/results/KC-26-001.json): the program's output for that campaign.
Quality runs the program on 24 further campaigns of KW50-A cells from the same two rigs and chambers, run between February and September 2026 to TP-014 and exported the same way. Their reference values are the withheld T06 voltages at the cell terminals and the reference characterisation of the same cells (capacity, OCV and circuit parameters on the SOC grid and at the three cell temperatures). The eight campaigns in hand have reference values too, and your result files are compared in the same way.
Each quantity earns full credit within a tolerance tol and falls linearly to zero at 3 tol:
| Quantity | Error measure | tol |
|---|---|---|
| Validation V | RMSE of voltage_v over all withheld records of the cell's T06 export |
3 mV |
| Capacity C | relative error of capacity_ah |
0.1 % |
| OCV O | mean absolute error over the nine SOC points | 1.5 mV |
| Circuit E | per value |ln(p / p_ref)|, averaged over 3 temperatures x 5 parameters x 9 SOC points | R0 0.03, R1 0.08, tau1 0.15, R2 0.20, tau2 0.40 |
A validation object for another file, or one that leaves out any withheld record, earns V = 0. The other quantities count only as far as the validation prediction is usable: a gate g is 1 for a validation RMSE up to 10 mV and falls linearly to 0 at 25 mV (0 without a usable prediction).
Campaign score = 0.40 V + g x (0.20 C + 0.10 O + 0.30 E). Values that are missing, not numbers or not finite earn nothing, and a campaign on which the program fails, runs out of time or writes no readable JSON scores zero. The final score is 80 % the mean over the 24 further campaigns and 20 % the mean over the eight result files.