Skip to content

Make calibration fully voltage-independent #37

Description

@datacrystals

Problem

Calibration results currently vary with DC bus voltage. Observed while bring-up testing on feature/encoder-distortion-compensation:

  • Inductance cal (biased-AC injection) produces different Ld/Lq curves at different bus voltages (e.g. 50 V vs lower bus). Old values also confounded by the graph-FOC ISR fight fixed in d44975d.
  • Flux linkage cal (cal Motor.PMSM.FluxLinkage) hits its voltage ceiling at very low RPM on lower bus (58-96 RPM), leaving too few/too clustered samples for a robust (psi_m, V_off) least-squares fit. psi_m estimates have swung ~10x between runs (0.0986 vs 0.72-0.96 Wb) under different conditions (bus, ellipse fit on/off).
  • The (psi_m, V_off) joint fit is badly conditioned when samples cluster in a narrow low-speed band; median vs fit disagreed by ~30%.

Voltage-derived calibration quantities (psi_m, Ld/Lq) should be motor constants and must not depend on the bus.

Known bugs / confounds to untangle

  • Ellipse fit (Layer 1) phi is not repeatable run-to-run (observed 1.25-3.7 deg); a saved fit with a wrong phi measurably degrades commutation and corrupts downstream cal (flux cal ceiling RPM improved 58 -> 96 RPM immediately after encfit clear). Do not trust/save a fit until phi repeats within ~0.2 deg and capture is lock-gated.
  • PWM_FindSafeSamplePoint (f96e749) can select the all-high-side window where low-side shunts read zero once duties leave the centered region (saturation); turns any PI railing event into feedback collapse. Needs review/fix.
  • Inductance cal sometimes needs AC amplitude retries ("weak response"); measured L may depend on the AC perturbation amplitude on a saturating machine - define a standard amplitude per bias point for comparability.
  • ENCLIN (encoder linearity sweep) measurement exists and runs, but its residual is dominated by torque-lag/cogging in single-direction mode; FWD+REV dual-pass averaging is implemented but the INL result is not yet validated/used anywhere.

Acceptance

  • Repeating cal all (or each stage) at two different bus voltages (e.g. 24 V and 50 V) yields poles, cycles/rev, offset, resistance, Ld/Lq curve, and psi_m within stated tolerances of each other.
  • Flux cal documents minimum speed-range/sample-spread requirements and fails with a clear message when the bus is too low to meet them, instead of returning a garbage fit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions