resistance-inductance-estimation.md

April 9, 2026 · View on GitHub

FieldValue
TitleElectrical Parameters Identification — R and L
Typetheory
Statusapproved
Version1.0.0
Componentservice-electrical-ident
Date2025-01-01

Overview

FOC performance depends directly on accurate stator resistance RsR_s and inductance LsL_s. These parameters are used to:

  1. Design the PI current controller gains (Kp=LsωbwK_p = L_s \omega_{bw}, Ki=RsωbwK_i = R_s \omega_{bw}).
  2. Implement feed-forward decoupling of the dq cross-coupling terms.
  3. Estimate motor temperature from measured RsR_s (since RsTR_s \propto T).

This identification procedure applies a DC voltage step to the motor aligned on the d-axis and measures the current transient. Alignment to the d-axis suppresses the back-EMF (which only appears on the q-axis), yielding a clean RL circuit step response. Resistance is derived from the DC steady-state, and inductance from the measured time constant.


Prerequisites

SymbolMeaningUnit
RsR_sStator resistance per phaseΩ
LsL_sStator inductance (d-axis, LdL_d)H
τ\tauElectrical time constant = Ls/RsL_s / R_ss
VstepV_{step}Applied step voltage (d-axis)V
IssI_{ss}Steady-state current = Vstep/RsV_{step} / R_sA
IτI_\tauCurrent at time τ\tau: Iss(1e1)I_{ss} \cdot (1 - e^{-1})A
fsf_sSampling frequencyHz
TsT_sSampling period = $1/f_s$s
NavgN_{avg}Moving average filter lengthsamples
NbufN_{buf}Total sample buffer sizesamples

Mathematical Foundation

1. d-Axis Alignment and Back-EMF Suppression

Before applying the voltage step, the motor is aligned to θe=0\theta_e = 0 (rotor d-axis aligned with stator α\alpha-axis). In this condition:

  • The back-EMF is eα=ψfωesin(0)=0e_\alpha = -\psi_f \omega_e \sin(0) = 0.
  • The q-axis current is forced to zero: iq=0i_q = 0.
  • Only the d-axis RL circuit is excited.

The stator d-axis circuit model reduces to:

vd=Rsid+Lsdiddtv_d = R_s\, i_d + L_s \frac{di_d}{dt}

This is a first-order linear system driven by a unit step of amplitude VstepV_{step}.

2. RL Step Response

For a step input vd(t)=Vstepu(t)v_d(t) = V_{step} \cdot u(t) with zero initial conditions (id(0)=0i_d(0) = 0):

id(t)=VstepRs ⁣(1et/τ),τ=LsRs\boxed{i_d(t) = \frac{V_{step}}{R_s}\!\left(1 - e^{-t/\tau}\right)}, \qquad \tau = \frac{L_s}{R_s}

Key properties of this response:

  • At t=τt = \tau: id(τ)=Iss(1e1)0.6321Issi_d(\tau) = I_{ss}(1 - e^{-1}) \approx 0.6321 \cdot I_{ss}
  • At t=5τt = 5\tau: id(5τ)0.9933Issi_d(5\tau) \approx 0.9933 \cdot I_{ss} (essentially settled)
  • Slope at t=0t = 0: diddtt=0=VstepLs\left.\frac{di_d}{dt}\right|_{t=0} = \frac{V_{step}}{L_s}

See: documentation/theory/images/rl_step_response.svg (generated by documentation/tools/generate_plots.gp)

3. Resistance Estimation

Once the current has fully settled to steady state (after $5\tau$):

Rs=VstepIss\boxed{R_s = \frac{V_{step}}{I_{ss}}}

where IssI_{ss} is measured from the mean of the last 10% of the sample buffer (to average out noise).

Noise considerations: RsR_s estimation is straightforward but requires:

  • Accurate current sensor calibration (ADC offset error directly biases IssI_{ss}).
  • Stable VstepV_{step} (DC bus voltage variation during measurement corrupts the result).
  • Sufficient settling time in the buffer (Nbuf5τ/TsN_{buf} \geq 5\tau / T_s samples).

4. Inductance Estimation — Time-Constant Method

The time constant τ=Ls/Rs\tau = L_s / R_s is found by identifying the sample index nτn_\tau where the current first reaches the 63.2% threshold:

id[nτ]0.6321Issi_d[n_\tau] \geq 0.6321 \cdot I_{ss}

The time constant is then:

τ=nτTs\tau = n_\tau \cdot T_s

and the inductance:

Ls=Rsτ=RsnτTs\boxed{L_s = R_s \cdot \tau = R_s \cdot n_\tau \cdot T_s}

Moving Average Filter Correction

A causal moving average filter of length NavgN_{avg} is applied to the raw current samples before threshold detection:

iˉ[n]=1Navgk=0Navg1i[nk]\bar{i}[n] = \frac{1}{N_{avg}} \sum_{k=0}^{N_{avg}-1} i[n-k]

This FIR filter introduces a lag of (Navg1)/2(N_{avg} - 1)/2 samples. The threshold index is corrected:

nτcorrected=nτNavg121n_\tau^{corrected} = n_\tau - \left\lfloor \frac{N_{avg} - 1}{2} \right\rfloor - 1

Without this correction, τ\tau is overestimated by the filter group delay, leading to an overestimate of LsL_s.

Filter trade-off: larger NavgN_{avg} reduces noise variance 1/Navg\propto 1/N_{avg} but increases the index correction and requires a corresponding increase in buffer size NbufN_{buf}.

5. Pole Pair Estimation

The number of electrical cycles per mechanical revolution equals the number of pole pairs pp. During the multi-step alignment sweep, the motor is driven through exactly 12 electrical steps over one full electrical revolution ($2\pielectrical).Theencodercountselectrical). The encoder countsC_{mech}perstepmultipliedbyper step multiplied byN_{steps} = 12givesthetotalencodercountsperfullelectricalcycle.Dividingbytheknownencodercountspermechanicalrevolutiongives the total encoder counts per full electrical cycle. Dividing by the known encoder counts per mechanical revolutionC_{rev}$ gives:

p=Crev12Cper_step(integer, rounded)p = \frac{C_{rev}}{12 \cdot C_{per\_step}} \quad \text{(integer, rounded)}

or equivalently, the total electrical angle traversed over the full 12-step sweep spans exactly $2\pi electrical = \2\pi/p$ mechanical, so:

p=2πΔθmech,totalp = \frac{2\pi}{\Delta\theta_{mech,total}}

where Δθmech,total\Delta\theta_{mech,total} is the measured total mechanical rotation during the sweep.

6. Complete Identification Sequence

1. Drive alignment: rotate field through N_steps to θ_e = 0.
   Record encoder offset θ_offset (see alignment theory).

2. Apply step voltage V_step on d-axis (i_q* = 0, v_d = V_step).

3. Sample i_d at f_s = 10 kHz for N_buf samples.

4. Apply moving average filter (length N_avg = 5) to samples.

5. Find steady-state current I_ss from mean of last 10% of buffer.

6. Compute R_s = V_step / I_ss.

7. Find first index n_τ where i_d[n] ≥ 0.6321 · I_ss.

8. Correct for filter delay: n_τ_corr = n_τ − ⌊(N_avg−1)/2⌋ − 1.

9. Compute τ = n_τ_corr · T_s, L_s = R_s · τ [H].
   Express L_s in mH: L_s_mH = R_s · n_τ_corr / f_s · 1000.

Block Diagrams

Electrical Identification Signal Flow

graph TD
    A[Set θ_e = 0\nAlign rotor to d-axis] --> B[Apply V_step\non d-axis\ni_q* = 0]
    B --> C[Sample i_d\nf_s = 10 kHz\nN_buf samples]
    C --> D[Moving Average\nFilter\nN_avg = 5]
    D --> E[Find I_ss\nmean of last 10%]
    D --> F[Find n_τ\nfirst sample ≥ 63.2% I_ss]
    E --> G[R_s = V_step / I_ss]
    F --> H[n_τ_corr = n_τ − delay]
    G --> I[L_s = R_s · n_τ_corr · T_s]
    H --> I

RL Step Response — ASCII Approximation

i_d (normalised: I_ss = 1.0)

1.0├───────────────────────────────── I_ss = V/R (steady state)
   │                       ──────────
0.86├──────────────────────/
   │                     /
0.63├────────────────────/ ← i(τ) = 0.632·I_ss
   │                   /
   │                  /
0.39├─────────────────/
   │               /
   │             /
   │           /
0.0├───────────
   └───────────────────────────────── samples (n·T_s)
       0      τ/T_s   2τ/T_s  5τ/T_s

          n_τ (63.2% crossing) — filter delay correction applied

Numerical Properties

PropertyValue / Condition
Sampling ratefs=10 kHzf_s = 10\ \text{kHz}, Ts=100 μsT_s = 100\ \mu\text{s}
Filter lengthNavg=5N_{avg} = 5 samples
Filter group delay(Navg1)/2=2(N_{avg}-1)/2 = 2 samples = $200\ \mu\text{s}$
Threshold$0.6321 \cdot I_{ss} (i.e. \1 - e^{-1}$)
RsR_s rangeNominally $0.1\ \Omega to \50\ \Omega$ (ADC current range)
LsL_s resolutionRsTsR_s \cdot T_s (one sample step) = depends on RsR_s
LsL_s min detectableApprox. Rs2TsR_s \cdot 2 T_s (due to filter delay correction)
Trigger voltageVstepV_{step} must be small enough to avoid magnetic saturation

Sensitivity Analysis

Source of ErrorEffect on RsR_sEffect on LsL_s
ADC current offsetDirectly biases IssI_{ss}Indirect via RsR_s error
VdcV_{dc} variationBiases VstepV_{step}Indirect via RsR_s error
Thermal drift in RsR_sMeasurement valid at TmeasT_{meas} only
Filter delay not correctedLsL_s overestimated by Navg/2N_{avg}/2 steps
Insufficient bufferIssI_{ss} underestimatedτ\tau underestimated
Magnetic saturationRsR_s underestimatedLsL_s underestimated (nonlinear)

Worked Example

Motor: Vstep=2 VV_{step} = 2\ \text{V}, Rs=1.2 ΩR_s = 1.2\ \Omega, Ls=0.6 mHL_s = 0.6\ \text{mH}, fs=10 kHzf_s = 10\ \text{kHz}, Navg=5N_{avg} = 5.

Expected results:

Iss=21.21.667 AI_{ss} = \frac{2}{1.2} \approx 1.667\ \text{A}

τ=LsRs=0.6×1031.2=0.5 ms=5 Ts\tau = \frac{L_s}{R_s} = \frac{0.6 \times 10^{-3}}{1.2} = 0.5\ \text{ms} = 5\ T_s

At the 63.2% threshold: id[nτ]0.6321×1.667=1.054 Ai_d[n_\tau] \geq 0.6321 \times 1.667 = 1.054\ \text{A}

The raw crossing occurs at nτ=5n_\tau = 5. Filter delay correction: nτcorr=521=2n_\tau^{corr} = 5 - 2 - 1 = 2.

Ls,mH=1.2×2×100×106×1000=0.24 mHL_{s,\mathrm{mH}} = 1.2 \times 2 \times 100 \times 10^{-6} \times 1000 = 0.24\ \text{mH}

The example shows that a very short τ\tau (5 samples) combined with a 5-tap filter and a 2-sample delay correction can yield significant estimation error. In practice τ\tau should be at least 15–20 samples for accurate identification.


Limitations & Assumptions

  • Assumes: The rotor is aligned to the d-axis (θe=0\theta_e = 0, θ˙=0\dot\theta = 0). Any rotor motion during identification overlays a back-EMF on the d-axis current.
  • Assumes: LdLqL_d \approx L_q (surface-mounted PMSM). For interior PMSM, the step must be repeated on both axes if the design requires both LdL_d and LqL_q.
  • Assumes: Magnetic linearity (no saturation). The identification current IdstepI_d^{step} must be kept below the saturation current.
  • Does not handle: Temperature-dependent RsR_s variation during operation.
  • Does not handle: Identification at running speed where back-EMF cannot be zeroed by alignment alone.

References

  1. Rauf, A. et al. — "Online Identification of PMSM Parameters Based on Extended Kalman Filter", IEEE Transactions on Industrial Electronics, 2019.
  2. Underwood, S.J. & Husain, I. — "Online Parameter Estimation and Adaptive Control of PMSM", IEEE Transactions on Industrial Electronics, 2010.
  3. Texas Instruments Application Report SPRABV5 — Motor Control in Embedded Applications, 2018.