Expand description
Clarke/Park coordinate transforms — the standard change of basis between a three-phase
abc signal, its stationary two-axis alpha/beta (plus zero-sequence) projection, and a
rotating d/q (plus zero-sequence) frame locked to a reference angle theta. Used to turn
a three-phase grid or motor-drive quantity into DC-like d/q values a Pid can regulate
directly, and the matching angle-tracking utility (anglewrap) that closes the loop
(a synchronous-reference-frame PLL is Clarke -> anglewrap -> Park, feeding a Pid on
the q output back into the tracked angle).
Every function here is a pure, stateless function of its instantaneous inputs (no
integration, no memory) — the same category as crate::math_ops and
crate::waveform_arithmetic, just multi-output. CoordinateTransform groups them the
same way crate::MathFn1/crate::MathFn2 group the single-output functions, so
dae-runtime’s block graph can dispatch by one enum instead of one bespoke BlockKind
variant per transform.
clarke_park/clarke_park_inv are convenience compositions of clarke/park (and
their inverses) directly against abc, skipping the alpha/beta intermediate — see
clarke_park_matches_clarke_then_park below for the equivalence this relies on. Amplitude
convention throughout is the standard “2/3” (non-power-invariant) scaling: a balanced
three-phase signal of peak amplitude A transforms to a d/q pair of magnitude A, not
A * sqrt(3/2).
Enums§
- Coordinate
Transform - One of the six Clarke/Park coordinate transforms, grouped for dispatch by
dae-runtime’s block graph the same waycrate::MathFn1/crate::MathFn2group the single-output waveform-arithmetic functions.
Functions§
- anglewrap
(alpha, beta) -> theta, wrapped to[0, 2*pi)— the angle-tracking half of a synchronous-reference-frame PLL:atan2(beta, alpha), shifted by a full turn when negative instead of the usual(-pi, pi]range, sothetais a monotonically-sensible input topark/clarke_parkacross a full mechanical/electrical revolution.- clarke
abc -> (alpha, beta, zero).- clarke_
inv (alpha, beta, zero) -> abc. Exact inverse ofclarke.- clarke_
park (a, b, c, theta) -> (d, q, zero)— a convenience composition ofclarkethenpark, skipping thealpha/betaintermediate for the common case of going straight from a three-phase signal to its rotating-framed/qvalue. Kept as its own function purely for netlist/call-site ergonomics (one call instead of wiringClarkeintoPark) — calls through toclarke/parkdirectly rather than re-deriving the trig, since a family exactly like this one (a combined transform hand-expanded separately from its two-step composition) is documented to have shipped withd/qswapped once already in the upstream library this crate’s formulas were adapted from; there is exactly one real implementation of each direction now, not two that could silently drift apart.- clarke_
park_ inv (d, q, zero, theta) -> (a, b, c)— the same convenience-composition treatment asclarke_park, calling through topark_invthenclarke_inv. Exact inverse ofclarke_park.- park
(alpha, beta, zero, theta) -> (d, q, zero)— projects the stationary frame onto a frame rotating at angletheta(radians). Zero-sequence passes through unchanged.- park_
inv (d, q, zero, theta) -> (alpha, beta, zero). Exact inverse ofparkat the sametheta.