All harmonic orders ν in this module are mechanical: ν cycles per revolution, so the working harmonic is ν = p. A coil spanning w of the Q slots links the ν-th harmonic with
This is the textbook \(\sin(\nu' \tfrac{\pi}{2} \tfrac{w}{\tau_p})\) with electrical order ν’ = ν/p and pole pitch τp = Q/P. It is a property of one coil, so it holds for any ν. For 12s/4p the full pitch is w = 3 slots, and the working harmonic is ν = 2.
References: Hanselman (2003), eq. 4.5; Pyrhönen et al. (2014), §2.4.
which is the textbook \(\sin(\nu' \pi / 2m) \,/\, (q \sin(\nu' \pi / 2mq))\) with ν’ = ν/p.
Where the closed form is valid. kd describes one phase belt. The full winding also repeats every pole pair, which cancels every ν that is not a multiple of p, and its go and return belts are mirror images, which cancels even electrical orders. So kp·kd equals the true winding factor only for whole-number q and ν an odd multiple of p. Elsewhere the function raises ValueError instead of returning a factor for a harmonic that does not exist. Use winding_factor for every other case.
Valid only for whole-number q and nu an odd multiple of p, where kp*kd equals the winding factor. Use winding_factor otherwise.
Parameters
nu : int Mechanical harmonic order (working harmonic nu = p) Q : int Number of stator slots (keyword-only) P : int Number of poles (keyword-only) m : int Number of phases (default 3)
Returns
float kd in (0, 1]
Raises
ValueError If q is not a whole number, or nu is not an odd multiple of p.
from emachines.winding.winding_factors import distribution_factorprint("Distribution factor at the working harmonic ν = p, 4 poles:")print(f"{'Config':>16}{'q':>3}{'kd(ν=2)':>8}{'kd(ν=10)':>9}")print("-"*42)for Q in (12, 24, 36, 48): q = Q //12print(f" {Q:>2}s/4p {q:>3}{distribution_factor(2, Q=Q, P=4):>8.4f} "f"{distribution_factor(10, Q=Q, P=4):>9.4f}")for Q, P, nu in [(36, 8, 4), (24, 4, 4)]:try: distribution_factor(nu, Q=Q, P=P)exceptValueErroras e:print(f"\n{Q}s/{P}p, ν={nu} → ValueError: {e}")
Distribution factor at the working harmonic ν = p, 4 poles:
Config q kd(ν=2) kd(ν=10)
------------------------------------------
12s/4p 1 1.0000 1.0000
24s/4p 2 0.9659 0.2588
36s/4p 3 0.9598 0.2176
48s/4p 4 0.9577 0.2053
36s/8p, ν=4 → ValueError: distribution_factor() needs a whole-number q (slots per pole per phase); got q = 3/2 for Q=36, P=8, m=3. Use winding_factor() instead.
24s/4p, ν=4 → ValueError: distribution_factor() is valid only for nu an odd multiple of p=2; got nu=4. That harmonic cancels in the full winding. Use winding_factor() instead.
winding_factor: Combined kw
Theory
winding_factor(nu, Q=…, P=…) is the exact winding factor of harmonic ν (mechanical order, working harmonic ν = p), from the star-of-slots phasor sum. It works for integer-slot, fractional-slot and tooth-coil windings, and for every ν, including sub-harmonics and orders that cancel (which give 0).
It describes the same winding as the rest of the module: when layers or w is left out, the best candidate from design_windings is used.
For whole-number q and ν an odd multiple of p, it equals the textbook product pitch_factor(ν, Q=Q, w=w) * distribution_factor(ν, Q=Q, P=P) for a double-layer winding of span w. The tests check this.
winding_factor
def winding_factor( nu:int, *, Q:int, P:int, w:int|None=None, layers:int|None=None, # (see ``design_windings``); a given w implies 2. m:int=3)->float:
Winding factor |kw| of mechanical harmonic nu, by the star of slots.
Parameters
nu : int Mechanical harmonic order (working harmonic nu = p) Q : int Number of stator slots (keyword-only) P : int Number of poles (keyword-only) w : int | None Double-layer coil span in slots. None -> the best span. layers : int | None 1 or 2. None -> the best buildable, balanced candidate (see design_windings); a given w implies 2. m : int Number of phases (default 3)
def winding_factor_spectrum( Q:int, P:int, m:int=3, layers:int|None=None, # 1 (single-layer) or 2 (double-layer).# None -> the best buildable, balanced candidate (see design_windings). w:int|None=None, # Double-layer coil span in slots. None -> the best span. nu_max:int=40)->tuple[np.ndarray, np.ndarray]:
Winding factor magnitude spectrum for mechanical harmonics 1…nu_max.
Parameters
Q : int Number of stator slots P : int Number of poles (even, >= 2) m : int Number of phases (default 3) layers : int | None 1 (single-layer) or 2 (double-layer). None -> the best buildable, balanced candidate (see design_windings). w : int | None Double-layer coil span in slots. None -> the best span. nu_max : int Highest mechanical harmonic (default 40)
Returns
nu_arr : np.ndarray, shape (nu_max,), dtype int kw_arr : np.ndarray, shape (nu_max,), dtype float64 |kw(nu)| in [0, 1]