Skip to content

emikit: ground-bounce CM estimator + Montrose envelope + cable CLI#50

Open
UnsignedChad wants to merge 2 commits into
mainfrom
emikit/cm-current-estimator
Open

emikit: ground-bounce CM estimator + Montrose envelope + cable CLI#50
UnsignedChad wants to merge 2 commits into
mainfrom
emikit/cm-current-estimator

Conversation

@UnsignedChad

@UnsignedChad UnsignedChad commented May 25, 2026

Copy link
Copy Markdown
Owner

Follow-up to #42. Three things landed together because they all had to be in for the TI re-validation to come out right.

1. Ground-bounce CM current estimator

CableSpec gains ground_inductance_h and cable_cm_inductance_per_m_h. estimate_cm_current(cable, signal_spectrum) derives I_cm via the Hockanson 1996 model:

I_cm(f) = (2 * L_gnd / (L_cable_per_m * cable_length)) * I_signal(f)

The omega in V_gb cancels the omega in cable Z_cm so the ratio is frequency-independent in the band of interest. Explicit cm_current_a still wins if set.

2. Montrose envelope spectrum

The existing harmonic_magnitude lands on the exact sinc curve, which has deep nulls at integer f*tau. Real chambers don't see those nulls -- EMI receivers integrate over their IF bandwidth and real signals have edge jitter. Added envelope_magnitude and envelope_sweep that follow the Bode-style two-corner envelope:

|I_env(f)| = 2 * I_peak * d * min(1, 1/(pi*f*tau)) * min(1, 1/(pi*f*t_r))

analyze_board now uses envelope_sweep. This is the standard pre-compliance form (Montrose Ch 5).

3. Cables in AnalysisConfig + CLI

AnalysisConfig::cables is a new vector. analyze_board power-sums loop + cable contributions per frequency, returns per-cable diagnostic in AnalysisResult::cables. CLI gains --cable-length-cm, --ground-inductance-nh, --cable-cm-uh-per-m, --cable-cm-ua.

TI re-validation -- new numbers

Same fixture (30 mm SCLK over 0.2 mm GND, 6 mA / 2 ns CMOS) plus:

  • Cable: 30 cm USB, 1.0 uH/m, L_gnd = 15 nH (mid-range "real digital board", not per-test fitted)
Test Measured emikit Gap
1 (SCLK=10 MHz, 9.7 kSPS) 34.67 31.64 -3.0 dB
2 (SCLK=50 MHz, 769 kSPS) 54.73 47.61 -7.1 dB
3 (SCLK=10 MHz, 232 kSPS) 51.06 33.63 -17.4 dB

Tests 1 and 2 within pre-compliance tolerance. Test 3 is the honest residual -- same SCLK as Test 1 but 17 dB more chamber emission because of higher sample-rate activity. The single-trace continuous-clock model doesn't see that. Documented as a known limitation in VALIDATION.md.

tests:
114 assertions / 44 cases. 20 new across cable_cm_test.cpp (estimator math + TI working point) and analysis_test.cpp (cable wired into BoardAnalysis, mixed loop+cable verdict, cable-only NoData semantics).

Known follow-ups

  • Activity-factor / multi-net summing is the obvious next step to close the Test 3 gap. emikit currently models one trace at one clock.
  • The 15 nH L_gnd is engineering judgement, not a measurement. Could be made empirical by feeding back from pdnkit's plane impedance once that ships.
  • More reference pairs. Hockanson's 1996 paper has its own test boards with cleaner geometry.

three things rolled together because they all needed to land for the
estimator-driven TI re-validation to come out right.

1. CableCommonMode gets a Hockanson-1996 estimator that derives I_cm
   from the signal current spectrum and a user-supplied ground-return
   partial inductance. ratio is frequency-independent in the relevant
   band -- the omega in V_gb cancels the omega in cable Z_cm.

2. Spectrum gets the Montrose envelope. the existing trapezoidal sinc
   has deep nulls at integer f*tau that the EMI receivers chamber data
   come from do not actually see -- their IF bandwidth catches multiple
   harmonics close-in and real signals have edge jitter that fills the
   nulls. BoardAnalysis switched to envelope_sweep -- the right thing
   for pre-compliance prediction.

3. AnalysisConfig now has a cables vector. analyze_board sums loop +
   per-cable CM contributions in power per frequency. CLI exposes the
   relevant flags: --cable-length-cm, --ground-inductance-nh,
   --cable-cm-uh-per-m, --cable-cm-ua.

TI re-validation with the estimator (L_gnd=15 nH, no per-test tuning):
  Test 1: gap -3.0 dB
  Test 2: gap -7.1 dB
  Test 3: gap -17.4 dB

tests 1 and 2 within pre-compliance tolerance. test 3 is honest residual
-- same SCLK as test 1 but 17 dB more chamber emission from higher
sample-rate activity that the single-trace model cannot see. documented
in VALIDATION.md as a known limitation.

20 new assertions across cable_cm_test and analysis_test. 114 total in
the emikit suite.
@UnsignedChad UnsignedChad enabled auto-merge (squash) May 25, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant