Purpose: Describe any stator winding as coils placed at named positions in the slots, so that the inductance calculations (emachines.inductance) can tell where each phase sits inside a slot.
What it does:WindingPattern holds the signed turns of every phase at every position of every slot, slot_turns[phase, slot, position], plus the coils that produced them. Builders make the common windings (star-of-slots, integer-slot distributed, tooth-coil concentrated) or take your own slot table or coil list. Every pattern can be checked for balance, gives its winding factors and draws itself as a developed slot diagram.
Why a new object:build_coil_matrix says only top or bottom layer, and a single layer has no position at all. Position-dependent slot leakage, side-by-side tooth coils and multi-layer (hairpin) windings need the position of every coil side by name.
How It Fits Into the Motor Design Workflow
Upstream:emachines.winding.sos (star of slots, build_coil_matrix) and design_windings, which pick a balanced layout for (Q, P, m).
Downstream:emachines.inductance (stator geometry now; air-gap and slot-leakage inductance in the next steps). Every inductance part is computed from slot_turns.
Conventions
Slots are numbered 0 … Q − 1 in the direction of increasing angle, drawn left to right. Tooth i sits between slot i and slot i + 1.
Phases are 0-based in code (0 = A) and lettered in text and plots.
A coil side carries +turns where current flows out of the page and −turns where it flows into the page, for a positive phase current.
Positions inside a slot depend on the layout:
Layout
Positions
Meaning
single
full
one coil side fills the slot
over_under, 2 layers
top, bottom
top is on the air-gap side
over_under, n > 2 layers
1 … n
1 is on the air-gap side (hairpin and bar windings)
side_by_side
left, right
two halves across the slot width (tooth coils)
The slot geometry (emachines.inductance.SlotGeometry.regions) maps each name to a region of the slot cross-section.
Slot positions
slot_positions
def slot_positions( layout:str, n:int=2)->tuple[str, ...]: # 'single' -> ('full',); 'over_under' with n = 2 -> ('top', 'bottom');'over_under'with n >2-> ('1', ..., 'n'), '1' on the air-gap side;'side_by_side'-> ('left', 'right').
Names of the conductor positions in a slot for a given layout.
Parameters
layout : str ‘single’, ‘over_under’ or ‘side_by_side’ (see LAYOUTS) n : int Number of radial layers for ‘over_under’ (default 2); ignored otherwise
Returns
tuple of str ‘single’ -> (‘full’,); ‘over_under’ with n = 2 -> (‘top’, ‘bottom’); ‘over_under’ with n > 2 -> (‘1’, …, ‘n’), ‘1’ on the air-gap side; ‘side_by_side’ -> (‘left’, ‘right’).
One coil of one phase, with a side in each of two slot positions.
For a positive phase current, current flows out of the page in the out side and into the page in the in side.
Attributes
phase : int Phase index, 0-based (0 = A) out_slot : int Slot of the out side, 0 … Q-1 out_pos : str Position of the out side in its slot (see slot_positions) in_slot : int Slot of the in side in_pos : str Position of the in side turns : int Turns in the coil (default 1)
WindingPattern
The pattern stores slot_turns, shape (m, Q, number of positions). Entry [k, i, r] is the signed number of turns of phase k at position r of slot i, for one parallel path. With a parallel paths in each phase, every path carries 1/a of the phase current, so the turns that link flux per ampere of phase current are slot_turns / a. That is effective_turns(), and it is what the inductance calculations use.
The balance check works on slot_turns directly. Phase k has the EMF phasor
and its winding factor at harmonic ν is \(k_{w\nu} = |\sum n\, e^{j\nu 2\pi i/Q}| / \sum |n|\). The winding is buildable if each phase has as many out turns as in turns, and balanced if the m phasors are equal in size and 360°/m apart (in either sequence). This is the same test as check_winding, extended to any number of positions and to turns.
A stator winding as signed turns per phase, slot and slot position.
Build one with a classmethod (from_star_of_slots, distributed, concentrated, from_slot_table or custom) rather than directly.
Attributes
Q, P, m : int Slots, poles, phases layout : str ‘single’, ‘over_under’ or ‘side_by_side’ positions : tuple of str Position names, as from slot_positions slot_turns : np.ndarray Shape (m, Q, len(positions)), signed turns per path coils : tuple | None The coils, or None if built from a slot table parallel_paths : int Parallel paths per phase, a (default 1) name : str Short description
Examples
A 36-slot, 4-pole, short-pitched double-layer winding (pitch 7 of 9 slots), with 10 turns per coil and 2 parallel paths:
pat = WindingPattern.distributed(36, 4, layers=2, pitch=7, turns=10, parallel_paths=2)print(pat.describe())assert pat.check()["balanced"] and np.isclose(pat.check()["kw1"], 0.9019, atol=1e-4)assert np.allclose(pat.series_turns(), 36*10/3/2) # 12 coils of 10 turns per phase, 2 pathspat.plot();
The short pitch puts two phases in some slots, one in the top layer and one in the bottom. These are the slots where the cross-slot mutual inductance comes from:
shared = [i for i inrange(pat.Q) if (np.abs(pat.slot_turns[:, i, :]).sum(axis=1) >0).sum() ==2]print(f"slots shared by two phases: {shared}")assertlen(shared) ==24
Bianchi, N., Dai Prè, M. (2006). Use of the star of slots in designing fractional-slot single-layer synchronous motors. IEE Proc. Electric Power Applications 153(3) — star of slots, single-layer tooth-coil windings.
Pyrhönen, J., Jokinen, T., Hrabovcová, V. (2014). Design of Rotating Electrical Machines (2nd ed.). Wiley — Chapter 2, windings.
Sudhoff, S.D. Power Magnetic Devices (2nd ed.), §8.1–8.5 — conductor distribution by slot, used here per slot position.