Skip to content

Diagnostic Test 04 — Internal Resistance (Impedance) Test

Mode number 4
Registered handler internal_resistance_test → _run_test_04_internal_resistance in ems_diagnostic_handlers.py
Model actions change_power (pulse), direct Modbus reads (cell voltage + DC current)
Parameters diagnostic_test_mode.internal_resistance_test

Theory

Every battery has an internal resistance — the opposition to current flow caused by the electrolyte, electrodes, current collectors, terminals and internal connections. When the battery delivers or absorbs current I, its terminal voltage sags or rises by ΔV = I × R. Internal resistance therefore shows up as a voltage drop proportional to current.

As a battery ages, internal resistance increases: electrodes degrade, electrolyte conductivity falls and connections loosen. A high internal resistance reduces usable power, increases heating, and is a strong early indicator of cell degradation or a loose busbar/terminal. It is measured with a short, controlled current pulse:

R = |V_rest - V_pulse| / |I_pulse - I_rest|

V_rest and I_rest are measured just before the pulse; V_pulse and I_pulse are measured while the pulse is applied. The pulse is brief and moderate so it perturbs the battery without charging or discharging it significantly.

This test:

  1. applies a defined DC current pulse (discharge or charge),
  2. reads pack voltage (sum of the cell-voltage registers) and DC current,
  3. computes pack resistance in mΩ and derives the average cell resistance (pack resistance / cell count, since the cells are in series),
  4. compares the results against configured limits and against pulse-to-pulse repeatability.

Settings needed

All values live under diagnostic_test_mode.internal_resistance_test in emsConfig/ems/ems_control_setting.json. The nested object is canonical; flat keys are a legacy fallback; every key also has a built-in default.

Safety / eligibility

Key Default Meaning
min_soc 20 Minimum SOC (%) required before the pulse can run
max_soc 80 Maximum SOC (%) allowed before the pulse can run
min_pack_voltage_v 700.0 Minimum baseline pack voltage (V) allowed
max_pack_voltage_v 900.0 Maximum baseline pack voltage (V) allowed
max_cell_temp_c 45.0 Reserved maximum cell temperature (C), enforced by the BMS safety layer

The test aborts with prerequisite_failed if SOC or baseline pack voltage is outside its window.

Pulse generation

Key Default Meaning
pulse_current_a 50 Target current step magnitude (A)
pulse_direction discharge Pulse sign: discharge (positive power) or charge (negative power)
pulse_duration_sec 10 Total time the pulse is held (seconds)
settle_time_sec 5 Stabilisation delay after applying the pulse and before measuring (seconds)
rest_time_sec 5 Recovery delay between pulses (seconds)
number_of_pulses 3 Number of pulse cycles to run

The pulse power is derived as pulse_current_a × baseline_pack_voltage / 1000 (kW), signed by pulse_direction. The PCS is always commanded back to 0 kW after the measurement, including on every failure path.

Pass / fail thresholds

Key Default Meaning
max_pack_resistance_mohm 50.0 Maximum allowed pack resistance (mΩ)
max_cell_resistance_mohm 10.0 Maximum allowed average cell resistance (mΩ)
max_resistance_deviation_pct 20.0 Maximum pulse-to-pulse spread of pack resistance (%)

Average cell resistance = pack_resistance_mohm / cell_voltage_count. The test passes only when every pulse for every PCS stays within all three limits.

Register map (site-specific)

These addresses and scale factors must match the actual BMS/PCS Modbus map.

Key Default Meaning
cell_voltage_start_register 1860 First holding register of the cell-voltage window
cell_voltage_count 8 Number of cell-voltage registers to read
cell_voltage_scale_mv 1 Scale applied to each raw cell-voltage word (mV)
dc_current_register 1801 Holding register for DC current
dc_current_scale_a 0.1 Scale applied to the raw signed-16-bit current word (A)

Pack voltage is computed as sum(cell_voltage registers) × cell_voltage_scale_mv / 1000 volts. DC current is decoded as a signed 16-bit value then multiplied by dc_current_scale_a.

Example configuration:

"diagnostic_test_mode": {
  "internal_resistance_test": {
    "min_soc": 20,
    "max_soc": 80,
    "pulse_current_a": 50,
    "pulse_duration_sec": 10,
    "pulse_direction": "discharge",
    "settle_time_sec": 5,
    "rest_time_sec": 5,
    "number_of_pulses": 3,
    "max_pack_resistance_mohm": 50.0,
    "max_cell_resistance_mohm": 10.0,
    "max_resistance_deviation_pct": 20.0,
    "min_pack_voltage_v": 700.0,
    "max_pack_voltage_v": 900.0,
    "max_cell_temp_c": 45.0,
    "cell_voltage_start_register": 1860,
    "cell_voltage_count": 8,
    "cell_voltage_scale_mv": 1,
    "dc_current_register": 1801,
    "dc_current_scale_a": 0.1
  }
}

Model action required in emsConfig/pcs/power_sequences/<MODEL>.json:

  • change_power — used to apply the pulse power and to return to 0 kW.

Prerequisites

Before the test runs:

  • At least one active PCS is configured and Modbus-reachable.
  • Every available PCS returns a valid SOC, and every SOC lies within [min_soc, max_soc].
  • Every available PCS returns valid cell-voltage and DC-current register reads, and its baseline pack voltage lies within [min_pack_voltage_v, max_pack_voltage_v].
  • The PCS model must define the change_power action.
  • Every register required by the test — read_soc, change_power, the configured cell-voltage range and the DC-current register — exists in the PCS device register map (emsConfig/pcs/<pcs>/pcs_register_full.json, falling back to emsConfig/pcs/pcs_register.json). A missing register aborts the test and is reported in register_checks.
  • pymodbus is installed.

Testing procedure

  1. Phase 1 — Prerequisite check. Confirm at least one PCS is available, then verify every register required by the test (SOC, power setpoint, cell voltage and DC current) is defined in the device register map. A missing device or missing register aborts the test as prerequisite_failed.
  2. Phase 2 — SOC safety window. Read SOC from every PCS; abort if any value is outside [min_soc, max_soc].
  3. Phase 3 — Baseline measurement. Read pack voltage and DC current from every PCS; abort if any pack voltage is outside [min_pack_voltage_v, max_pack_voltage_v].
  4. Phase 4 — Pulse loop. For each pulse:
  5. Command the pulse power (derived from pulse_current_a and the baseline voltage, signed by pulse_direction).
  6. Wait settle_time_sec for the current to stabilise.
  7. Read pack voltage and DC current.
  8. Hold the remaining pulse_duration_sec - settle_time_sec (if positive).
  9. Command 0 kW and wait rest_time_sec.
  10. Compute R = |V_rest - V_pulse| / |I_pulse - I_rest| per PCS.
  11. Always command 0 kW at the very end, even if a step failed.
  12. Phase 5 — Evaluation. Compare pack resistance, cell resistance and pulse-to-pulse deviation against the configured limits.

Report output

The report (measurements) contains:

  • pulse_direction, pulse_current_a, pulse_power_kw, number_of_pulses.
  • max_pack_resistance_mohm, max_cell_resistance_mohm, max_resistance_deviation_pct.
  • max_pack_resistance_measured_mohm, max_cell_resistance_measured_mohm, resistance_deviation_pct.
  • results — per-PCS, per-pulse record with v_rest_v, i_rest_a, v_pulse_v, i_pulse_a, delta_v_v, delta_i_a, pack_resistance_mohm, cell_resistance_mohm.

Graphs:

  • ir-pack-resistance — bar chart of average pack resistance (mΩ) per PCS.
  • ir-voltage-current — line chart of pack voltage and DC current vs elapsed time (baseline + pulse samples).

Pass / fail summary

Result Condition
passed Every pulse for every PCS within all three limits and sequence completed
failed A resistance limit or the deviation limit was exceeded
error A read/command failed or the pulse sequence did not complete
prerequisite_failed No PCS, SOC outside window, baseline voltage outside window, or a required register missing from the register map

Register-map caution. The default register addresses (1860, 1801) and scale factors are placeholders. Confirm them against the real BMS/PCS Modbus map before the first run, otherwise the measured resistance will be wrong.