# Stator and Slot Geometry


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Executive Summary

**Purpose:** Hold the stator dimensions that the inductance calculations
need, and say where each named conductor position sits in the slot.

**What it does:** `SlotGeometry` describes an open or semi-closed slot
whose conductor body tapers anywhere between a parallel slot and a
parallel tooth (taper *t* from 0 to 1). `StatorGeometry` adds the bore,
air gap, stack, yoke and end-winding overhang, and derives the slot
pitch, tooth width and outer radius. `SlotGeometry.regions` splits the
conductor body into the positions of a `WindingPattern` layout
(over-under layers of equal copper area, or side-by-side halves).

**Next steps:** air-gap inductance from the winding function, then
position-dependent slot leakage and tooth-tip leakage, both from these
regions.

## How It Fits Into the Motor Design Workflow

**Upstream:** `emachines.winding.WindingPattern` — which phase sits at
which named position of which slot.

**Downstream:** the inductance parts (air gap, slot leakage, tooth tip,
end winding), each a function of a `WindingPattern` and a
`StatorGeometry`.

## Inputs

<figure>
<img src="images/stator_geometry.svg"
alt="Stator cross-section showing three of the Q slots with bore radius, air gap, slot pitch, tooth width, slot depth, yoke height and outer radius; side view with stack length and end-winding overhang." />
<figcaption aria-hidden="true">Stator cross-section showing three of the
Q slots with bore radius, air gap, slot pitch, tooth width, slot depth,
yoke height and outer radius; side view with stack length and
end-winding overhang.</figcaption>
</figure>

<figure>
<img src="images/slot_geometry.svg"
alt="Slot close-up: (a) open slot, (b) semi-closed slot with opening, tooth-tip transition and tapered conductor body, (c) the named conductor positions for over-under, side-by-side and hairpin layouts." />
<figcaption aria-hidden="true">Slot close-up: (a) open slot, (b)
semi-closed slot with opening, tooth-tip transition and tapered
conductor body, (c) the named conductor positions for over-under,
side-by-side and hairpin layouts.</figcaption>
</figure>

<table>
<colgroup>
<col style="width: 33%" />
<col style="width: 33%" />
<col style="width: 33%" />
</colgroup>
<thead>
<tr>
<th>Symbol</th>
<th>Meaning</th>
<th>Where it is set</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="math inline"><em>Q</em></span></td>
<td>number of slots</td>
<td><code>StatorGeometry.Q</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>r</em><sub><em>b</em><em>o</em><em>r</em><em>e</em></sub></span></td>
<td>stator bore radius</td>
<td><code>StatorGeometry.r_bore</code></td>
</tr>
<tr>
<td><span class="math inline"><em>g</em></span></td>
<td>air gap (mechanical, before Carter correction)</td>
<td><code>StatorGeometry.g</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>l</em><sub><em>s</em><em>t</em><em>k</em></sub></span></td>
<td>stack length</td>
<td><code>StatorGeometry.l_stk</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>h</em><sub><em>y</em></sub></span></td>
<td>yoke height</td>
<td><code>StatorGeometry.h_y</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>l</em><sub><em>e</em><em>w</em></sub></span></td>
<td>end-winding overhang beyond each end of the stack</td>
<td><code>StatorGeometry.l_ew</code></td>
</tr>
<tr>
<td><span class="math inline"><em>b</em><sub>0</sub></span>, <span
class="math inline"><em>h</em><sub>0</sub></span></td>
<td>slot opening width and height</td>
<td><code>SlotGeometry.b0</code>, <code>.h0</code></td>
</tr>
<tr>
<td><span class="math inline"><em>h</em><sub>1</sub></span></td>
<td>tooth-tip transition (wedge) height, from <span
class="math inline"><em>b</em><sub>0</sub></span> out to <span
class="math inline"><em>b</em><sub><em>s</em></sub></span></td>
<td><code>SlotGeometry.h1</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>b</em><sub><em>s</em></sub></span></td>
<td>slot width at the top of the conductor body</td>
<td><code>SlotGeometry.bs</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>h</em><sub><em>s</em></sub></span></td>
<td>conductor body depth</td>
<td><code>SlotGeometry.hs</code></td>
</tr>
<tr>
<td><span class="math inline"><em>t</em></span></td>
<td>taper: 0 parallel slot, 1 parallel tooth</td>
<td><code>SlotGeometry.t</code></td>
</tr>
<tr>
<td><span
class="math inline"><em>h</em><sub><em>s</em><em>e</em><em>p</em></sub></span></td>
<td>separator between radial layers</td>
<td><code>SlotGeometry.h_sep</code></td>
</tr>
</tbody>
</table>

Derived: slot pitch
*τ*<sub>*s*</sub> = 2*π**r*<sub>*b**o**r**e*</sub>/*Q*; depth *y* is
measured from the top of the conductor body, at radius
*r*<sub>*b**o**d**y*</sub> = *r*<sub>*b**o**r**e*</sub> + *h*<sub>0</sub> + *h*<sub>1</sub>;
slot depth
*h*<sub>*s**l**o**t*</sub> = *h*<sub>0</sub> + *h*<sub>1</sub> + *h*<sub>*s*</sub>;
outer radius
*R*<sub>*o**u**t*</sub> = *r*<sub>*b**o**r**e*</sub> + *h*<sub>*s**l**o**t*</sub> + *h*<sub>*y*</sub>.

An **open slot** is *b*<sub>0</sub> = *b*<sub>*s*</sub> and
*h*<sub>0</sub> = *h*<sub>1</sub> = 0: the conductor body starts at the
bore.

## Slot Taper

The width of the conductor body at depth *y* is

$$b(y) = b_s + t\\\frac{2\pi y}{Q}, \qquad 0 \le y \le h_s .$$

With *t* = 1 the tooth width
*w*<sub>*t*</sub>(*y*) = 2*π*(*r*<sub>*b**o**d**y*</sub> + *y*)/*Q* − *b*(*y*) = 2*π**r*<sub>*b**o**d**y*</sub>/*Q* − *b*<sub>*s*</sub>
is the same at every depth, a parallel tooth. With *t* = 0 the slot
sides are parallel. Values in between split the difference. Because
*b*(*y*) is linear in *y*, every slot integral in the leakage
calculations stays in closed form.

The copper area between depths *y*<sub>0</sub> and *y*<sub>1</sub> is

$$A(y_0, y_1) = b_s (y_1 - y_0) + t\\\frac{\pi}{Q}\\(y_1^2 - y_0^2).$$

**Over-under layers** share the body between *n* layers of equal copper
area, with a separator *h*<sub>*s**e**p*</sub> between neighbours. Each
boundary solves
*A*(*y*<sub>0</sub>, *y*) = *A*<sub>*l**a**y**e**r*</sub>, a quadratic
in *y*. Layer 1 (`top` when *n* = 2) is on the air-gap side.
**Side-by-side** positions each take the full depth and half the width
(`left` is toward slot *i* − 1).

------------------------------------------------------------------------

## `SlotRegion` and `SlotGeometry`

------------------------------------------------------------------------

### SlotGeometry

``` python
def SlotGeometry(
    bs:float, hs:float, b0:float=0.0, h0:float=0.0, h1:float=0.0, t:float=0.0, h_sep:float=0.0
)->None:
```

*Slot shape: an optional opening and tooth-tip transition above a
tapered conductor body.*

All lengths in metres. Use `SlotGeometry.open` or
`SlotGeometry.semi_closed`.

## Attributes

bs : float Slot width at the top of the conductor body hs : float
Conductor body depth b0 : float Opening width; 0 -\> bs (open slot) h0 :
float Opening height (0 for an open slot) h1 : float Tooth-tip
transition height, from b0 out to bs (0 for an open slot) t : float
Taper, 0 = parallel slot … 1 = parallel tooth h_sep : float Separator
height between radial layers (default 0)

------------------------------------------------------------------------

### SlotRegion

``` python
def SlotRegion(
    name:str, y0:float, y1:float, x0:float=0.0, x1:float=1.0
)->None:
```

*The part of the conductor body that one named position occupies.*

## Attributes

name : str Position name (see `slot_positions`) y0, y1 : float Depth
range below the top of the conductor body \[m\], y0 \< y1 x0, x1 : float
Share of the local slot width, from the left side (0) to the right (1)

``` python
# Examples
s = SlotGeometry.open(bs=6e-3, hs=18e-3)
assert s.is_open and s.b0 == 6e-3 and s.depth == 18e-3
top, bottom = s.regions("over_under", Q=36)
assert np.isclose(top.y1, 9e-3) and np.isclose(bottom.y0, 9e-3)        # parallel slot: equal heights

sc = SlotGeometry.semi_closed(b0=2.5e-3, h0=1e-3, h1=1.5e-3, bs=6e-3, hs=18e-3, t=0.5)
print(f"bottom width {sc.bottom_width(36) * 1e3:.3f} mm, depth {sc.depth * 1e3:.1f} mm")
for r in sc.regions("over_under", Q=36):
    print(f"  {r.name:6s} y = {r.y0 * 1e3:6.3f} … {r.y1 * 1e3:6.3f} mm, area {sc.area(36, r.y0, r.y1) * 1e6:.3f} mm²")
```

    bottom width 7.571 mm, depth 20.5 mm
      top    y =  0.000 …  9.519 mm, area 61.069 mm²
      bottom y =  9.519 … 18.000 mm, area 61.069 mm²

------------------------------------------------------------------------

## `StatorGeometry`

------------------------------------------------------------------------

### StatorGeometry

``` python
def StatorGeometry(
    Q:int, r_bore:float, g:float, l_stk:float, slot:SlotGeometry, h_y:float, l_ew:float=0.0
)->None:
```

*Stator dimensions for the inductance calculations (inner-rotor, radial
flux). SI units.*

## Attributes

Q : int Number of slots r_bore : float Bore radius \[m\] g : float
Mechanical air gap \[m\] l_stk : float Stack length \[m\] slot :
SlotGeometry Slot shape h_y : float Yoke height \[m\] l_ew : float
End-winding overhang beyond each end of the stack \[m\] (default 0)

### Example

The machine drawn in the figures above: 36 slots on a 60 mm bore, 0.8 mm
air gap, semi-closed slots tapered halfway between parallel slot and
parallel tooth.

``` python
stator = StatorGeometry(Q=36, r_bore=60e-3, g=0.8e-3, l_stk=100e-3, h_y=12e-3, l_ew=22e-3,
                        slot=SlotGeometry.semi_closed(b0=2.5e-3, h0=1e-3, h1=1.5e-3, bs=6e-3, hs=18e-3, t=0.5))
print(f"slot pitch {stator.tau_s * 1e3:.3f} mm, tooth {stator.tooth_width * 1e3:.3f} → {stator.tooth_width_bottom * 1e3:.3f} mm, "
      f"slot bottom width {stator.slot.bottom_width(36) * 1e3:.3f} mm, R_out {stator.R_out * 1e3:.1f} mm")
assert np.isclose(stator.R_out, 92.5e-3) and np.isclose(stator.tau_s, 2 * np.pi * 60e-3 / 36)
```

    slot pitch 10.472 mm, tooth 4.908 → 6.479 mm, slot bottom width 7.571 mm, R_out 92.5 mm

The same stator with the taper swept from parallel slot to parallel
tooth. The tooth narrows toward the slot bottom at *t* = 0 and keeps its
width at *t* = 1:

``` python
import matplotlib.pyplot as plt
from dataclasses import replace
```

``` python
fig, ax = plt.subplots(figsize=(6, 3.4))
y = np.linspace(0, 18e-3, 50)
for t in (0.0, 0.5, 1.0):
    st = replace(stator, slot=replace(stator.slot, t=t))
    ax.plot(y * 1e3, st.slot_width(y) * 1e3, label=f"slot, t = {t:g}")
    ax.plot(y * 1e3, st.tooth_width_at(y) * 1e3, "--", label=f"tooth, t = {t:g}")
ax.set_xlabel("depth y below the top of the conductor body [mm]")
ax.set_ylabel("width [mm]")
ax.legend(fontsize=8, ncol=2)
ax.grid(alpha=0.3)
plt.tight_layout()
```

![](01_geometry_files/figure-commonmark/cell-8-output-1.png)

------------------------------------------------------------------------

## Tests

## References

- Pyrhönen, J., Jokinen, T., Hrabovcová, V. (2014). *Design of Rotating
  Electrical Machines* (2nd ed.). Wiley — slot dimensions and
  parallel-tooth slots.
- Lipo, T.A. (2017). *Introduction to AC Machine Design*. Wiley-IEEE
  Press — slot and tooth proportions.
