# Load Capacity (ISO 6336)


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

## Executive Summary

**Purpose:** Check that the teeth of a planetary set survive the load
for the required life: pitting of the flanks (contact stress) and
fatigue breakage at the root (bending stress), for the sun–planet and
planet–ring meshes.

**What it does:** `rate_planetary` splits the output torque over the
planets, applies the load factors of ISO 6336-1, and computes the
contact stress of ISO 6336-2 and the tooth-root stress of ISO 6336-3 for
each gear, with the life factors for the number of load cycles each gear
sees. It returns the safety factors against pitting *S*<sub>*H*</sub>
and against root breakage *S*<sub>*F*</sub>, and names the gear and
failure mode that limit the design.

**Method:** ISO 6336:2019 Method B for the geometry factors, with Method
C simplifications for the dynamic factor *K*<sub>*v*</sub>, the face
load factor *K*<sub>*H**β*</sub> (entered, with a default) and the
transverse load factors *K*<sub>*H**α*</sub>, *K*<sub>*F**α*</sub>. The
tooth form factor uses load at the tip with the contact ratio factor
*Y*<sub>*ε*</sub> (Method C of ISO 6336-3:1996), which is a little
conservative compared with loading at the outer point of single tooth
contact. This is a design calculation. A design that is close to its
limits, or a safety-critical one, should be re-checked in KISSsoft,
RIKOR or a full ISO 6336 tool, and the material values confirmed with
the heat treater.

## How It Fits Into the Gear Design Workflow

**Upstream:** `gears.layout.PlanetarySet` (geometry and contact ratios
of both meshes).

**Downstream:** `gears.components` (the tooth forces load the planet
pins and bearings), `gears.design` (the search keeps sets whose safety
factors meet the minima).

## Materials

Allowable stress numbers for the endurance limit, from ISO 6336-5 for
quality grade MQ (the grade a good commercial heat treater achieves with
process control). *σ*<sub>*H* *l**i**m*</sub> is the contact endurance
limit and *σ*<sub>*F* *l**i**m*</sub> the bending endurance limit of the
standard reference test gear; the bending strength of a single tooth
loaded in one direction is
*σ*<sub>*F**E*</sub> = 2*σ*<sub>*F* *l**i**m*</sub>.

<table>
<colgroup>
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Key</th>
<th>Steel and treatment</th>
<th><span
class="math inline"><em>σ</em><sub><em>H</em> <em>l</em><em>i</em><em>m</em></sub></span></th>
<th><span
class="math inline"><em>σ</em><sub><em>F</em> <em>l</em><em>i</em><em>m</em></sub></span></th>
<th>Typical use</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>case_carburized</code></td>
<td>20MnCr5, 18CrNiMo7-6; carburized, 58–62 HRC, core ≥ 30 HRC</td>
<td>1500</td>
<td>500</td>
<td>sun, planets</td>
</tr>
<tr>
<td><code>nitrided</code></td>
<td>31CrMoV9 nitriding steel, gas nitrided, ≥ 650 HV surface</td>
<td>1250</td>
<td>420</td>
<td>ring, planets</td>
</tr>
<tr>
<td><code>qt_nitrided</code></td>
<td>42CrMo4 quenched and tempered, then nitrided, ≥ 500 HV</td>
<td>1000</td>
<td>360</td>
<td>ring</td>
</tr>
<tr>
<td><code>through_hardened</code></td>
<td>42CrMo4 quenched and tempered to about 300 HB (315 HV)</td>
<td>787</td>
<td>321</td>
<td>ring, low-cost sets</td>
</tr>
</tbody>
</table>

The through-hardened values come from the ISO 6336-5 MQ lines
*σ*<sub>*H* *l**i**m*</sub> = 1.313 *H**V* + 373 and
*σ*<sub>*F* *l**i**m*</sub> = 0.425 *H**V* + 187. The others are the MQ
plateau values. Treat all of them as typical; your supplier’s
certificate or the heat treater’s own data takes precedence.

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

### GearMaterial

``` python
def GearMaterial(
    name:str, treatment:str, hardness:str, sigma_Hlim:float, sigma_Flim:float, kind:str, E:float=206000.0,
    nu:float=0.3
)->None:
```

*Steel and heat treatment of one gear.*

name : str Designation for the drawing treatment : str Heat treatment
for the drawing hardness : str Surface (and core) hardness for the
drawing sigma_Hlim : float Contact endurance limit \[MPa\] sigma_Flim :
float Bending endurance limit \[MPa\] kind : str ‘case’
(carburized/induction), ‘nitrided’ or ‘through’ — selects the life
curves E, nu : float Young’s modulus \[MPa\] and Poisson’s ratio

## Tooth Form and Stress Correction Factors: Theory

The root stress is greatest at the *critical section*, where a 30°
tangent touches the root fillet. The tooth is treated as a cantilever
loaded at its tip: the normal load *F*<sub>*n*</sub> acts along the
flank normal at the angle *α*<sub>*F**a**n*</sub>, its bending arm above
the section is *h*<sub>*F**a*</sub>, the section is *s*<sub>*F**n*</sub>
wide and the fillet there has radius *ρ*<sub>*F*</sub>.

![](03_rating_files/figure-commonmark/cell-3-output-1.png)

For a gear cut by a rack (hob) with dedendum *h*<sub>*f**P*</sub>, tip
radius *ρ*<sub>*f**P*</sub> and no protuberance, ISO 6336-3 gives the
section through the auxiliary quantities

$$E = \frac{\pi m}{4} - h\_{fP}\tan\alpha - (1-\sin\alpha)\frac{\rho\_{fP}}{\cos\alpha},\qquad G = \frac{\rho\_{fP}}{m} - \frac{h\_{fP}}{m} + x,\qquad H = \frac{2}{z}\left(\frac{\pi}{2} - \frac{E}{m}\right) - \frac{\pi}{3}$$

$$\vartheta = \frac{2G}{z}\tan\vartheta - H\quad\text{(iterate from } \vartheta = \pi/6\text{)}$$

$$\frac{s\_{Fn}}{m} = z\sin\left(\frac{\pi}{3}-\vartheta\right) + \sqrt3\left(\frac{G}{\cos\vartheta} - \frac{\rho\_{fP}}{m}\right),\qquad \frac{\rho_F}{m} = \frac{\rho\_{fP}}{m} + \frac{2G^2}{\cos\vartheta\\(z\cos^2\vartheta - 2G)}.$$

With the load at the tip
(*α*<sub>*a**n*</sub> = arccos (*d*<sub>*b*</sub>/*d*<sub>*a*</sub>),
$\gamma_a = \frac{1}{z}(\frac{\pi}{2} + 2x\tan\alpha) + \operatorname{inv}\alpha - \operatorname{inv}\alpha\_{an}$,
*α*<sub>*F**a**n*</sub> = *α*<sub>*a**n*</sub> − *γ*<sub>*a*</sub>):

$$\frac{h\_{Fa}}{m} = \frac12\left\[(\cos\gamma_a - \sin\gamma_a\tan\alpha\_{Fan})\frac{d_a}{m} - z\cos\left(\frac{\pi}{3}-\vartheta\right) - \frac{G}{\cos\vartheta} + \frac{\rho\_{fP}}{m}\right\]$$

$$Y\_{Fa} = \frac{6\\(h\_{Fa}/m)\cos\alpha\_{Fan}}{(s\_{Fn}/m)^2\cos\alpha},\qquad Y\_{Sa} = (1.2 + 0.13L)\\q_s^{\frac{1}{1.21 + 2.3/L}},\quad L = \frac{s\_{Fn}}{h\_{Fa}},\\q_s = \frac{s\_{Fn}}{2\rho_F}.$$

**Internal gears.** ISO 6336-3 treats the ring tooth as a rack tooth
with the ring’s own reference thickness *s*, addendum
*h*<sub>*a*</sub> = *m*(*h*<sub>*a**P*</sub><sup>\*</sup> + *x* − *k*<sup>\*</sup>),
dedendum
*h*<sub>*f*</sub> = *m*(*h*<sub>*f**P*</sub><sup>\*</sup> − *x*) and
fillet radius *ρ* = *ρ*<sub>*f**P*</sub><sup>\*</sup>*m*. Put the origin
on the tooth centreline at the root line, *y* upwards. The straight
flank is *x* = *C* − *y*tan *α*, and the fillet circle touches both the
root line and the flank:

$$C = \frac{s}{2} + h_f\tan\alpha,\qquad y_c = \rho,\qquad x_c = C - \rho\tan\alpha + \frac{\rho}{\cos\alpha}.$$

The 30° tangent touches the fillet at
(*x*<sub>*c*</sub> − *ρ*cos 30°, *y*<sub>*c*</sub> − *ρ*sin 30°), so

*s*<sub>*F**n*</sub> = 2 (*x*<sub>*c*</sub> − *ρ*cos 30°),   *ρ*<sub>*F*</sub> = *ρ*.

The tip load acts at the tip corner
(*w*<sub>*a*</sub>, *y*<sub>*a*</sub>) with
*y*<sub>*a*</sub> = *h*<sub>*f*</sub> + *h*<sub>*a*</sub> and
*w*<sub>*a*</sub> = *C* − *y*<sub>*a*</sub>tan *α*, normal to the flank,
so it crosses the centreline at
*y*<sub>*a*</sub> − *w*<sub>*a*</sub>tan *α* and

*h*<sub>*F**a*</sub> = *y*<sub>*a*</sub> − *w*<sub>*a*</sub>tan *α* − (*y*<sub>*c*</sub> − *ρ*sin 30°),   *α*<sub>*F**a**n*</sub> = *α*.

*Y*<sub>*F**a*</sub> and *Y*<sub>*S**a*</sub> then follow from the same
two formulas as above. The fillet radius of a shaped ring comes from the
shaper cutter tip radius; `GearGeometry.rho_f` of the ring stands for
it.

**Rim thickness factor.** A thin rim under the teeth bends as well. With
rim thickness *s*<sub>*R*</sub> and tooth depth
*h*<sub>*t*</sub> = (*h*<sub>*a**P*</sub><sup>\*</sup> + *h*<sub>*f**P*</sub><sup>\*</sup>) *m*:

![](03_rating_files/figure-commonmark/cell-4-output-1.png)

$$Y_B = 1.6\ln\frac{2.242\\h_t}{s_R}\\\\(0.5 \le s_R/h_t \< 1.2,\\\text{external}),\qquad Y_B = 1.15\ln\frac{8.324\\m}{s_R}\\\\(1.75 \le s_R/m \< 3.5,\\\text{internal}),$$

and *Y*<sub>*B*</sub> = 1 for thicker rims. Thinner rims than the lower
limits are outside ISO 6336 and are rejected.

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

### rim_factor

``` python
def rim_factor(
    g:GearGeometry, s_R:float | None
)->float:
```

*ISO 6336-3 rim thickness factor Y_B for rim thickness s_R \[mm\] (None:
solid gear, Y_B = 1).*

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

### form_factors

``` python
def form_factors(
    g:GearGeometry
)->dict[str, float]:
```

*Tooth form factor Y_Fa, stress correction factor Y_Sa and the
critical-section values* s_Fn, h_Fa, rho_F \[mm\] for load at the tip
(see theory). Works for external and internal gears.

``` python
for z in (12, 17, 20, 30, 60, 200):
    f = form_factors(GearGeometry(z=z, m=1, x=0.0 if z >= 17 else 0.4))
    print(f"z = {z:3d}: Y_Fa = {f['Y_Fa']:.3f}  Y_Sa = {f['Y_Sa']:.3f}  Y_Fa·Y_Sa = {f['Y_Fa'] * f['Y_Sa']:.3f}")
f20 = form_factors(GearGeometry(z=20, m=1))
assert 2.7 < f20["Y_Fa"] < 2.9 and 1.5 < f20["Y_Sa"] < 1.6         # ISO 6336-3 chart values ≈ 2.80 / 1.55
# the rack-tooth model used for internal gears agrees with the external formulas as z → ∞
fe = form_factors(GearGeometry(z=50000, m=1))
fr = _rack_tooth_section(math.pi / 2, 1.0, 1.25, 0.38, math.radians(20))
assert abs(fe["s_Fn"] - fr[0]) < 1e-3 and abs(fe["h_Fa"] - fr[1]) < 1e-3
print("internal ring z = 72:", {k: round(v, 3) for k, v in form_factors(GearGeometry(z=72, m=1, internal=True, k_tip=0.2)).items()})
```

    z =  12: Y_Fa = 2.470  Y_Sa = 1.665  Y_Fa·Y_Sa = 4.114
    z =  17: Y_Fa = 2.957  Y_Sa = 1.522  Y_Fa·Y_Sa = 4.501
    z =  20: Y_Fa = 2.800  Y_Sa = 1.553  Y_Fa·Y_Sa = 4.347
    z =  30: Y_Fa = 2.529  Y_Sa = 1.623  Y_Fa·Y_Sa = 4.104
    z =  60: Y_Fa = 2.286  Y_Sa = 1.729  Y_Fa·Y_Sa = 3.952
    z = 200: Y_Fa = 2.129  Y_Sa = 1.864  Y_Fa·Y_Sa = 3.967
    internal ring z = 72: {'Y_Fa': 1.818, 'Y_Sa': 2.055, 's_Fn': 2.355, 'h_Fa': 1.68, 'rho_F': 0.38}

## Load Factors: Theory

**Load sharing between planets, *K*<sub>*γ*</sub>.** Tolerances on pin
positions and tooth thickness make one planet carry more than 1/*N* of
the torque. Typical values for a sun held on a stiff shaft (after AGMA
6123-B06):

<table>
<thead>
<tr>
<th><span class="math inline"><em>N</em></span></th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
</tr>
</thead>
<tbody>
<tr>
<td><span
class="math inline"><em>K</em><sub><em>γ</em></sub></span></td>
<td>1.00</td>
<td>1.10</td>
<td>1.25</td>
<td>1.35</td>
<td>1.44</td>
<td>1.47</td>
<td>1.50</td>
</tr>
</tbody>
</table>

Three planets with a floating sun (radially free, for example on a
crowned spline or a flexible coupling) share the load evenly:
*K*<sub>*γ*</sub> = 1.0.

**Dynamic factor *K*<sub>*v*</sub>** (ISO 6336-1 Method C for spur
gears, using the pitch line velocity relative to the carrier,
*v* = *π**d*<sub>*s*</sub>|*n*<sub>*s*</sub> − *n*<sub>*c*</sub>|/60 000):

$$K_v = 1 + \left(\frac{K_1}{K_A F_t/b} + K_2\right)\frac{z_1 v}{100}\sqrt{\frac{u^2}{1+u^2}},\qquad K_2 = 0.0193,$$

with *K*<sub>*A*</sub>*F*<sub>*t*</sub>/*b* ≥ 100 N/mm (smaller values
are raised to 100), *z*<sub>1</sub> the smaller gear and
*u* = *z*<sub>*l**a**r**g**e*</sub>/*z*<sub>*s**m**a**l**l*</sub> for
the sun–planet mesh, and *z*<sub>1</sub> = *z*<sub>*p*</sub>,
*u* = *z*<sub>*r*</sub>/*z*<sub>*p*</sub> for the planet–ring mesh.
*K*<sub>1</sub> comes from the ISO 1328 accuracy grade:

<table>
<thead>
<tr>
<th>grade</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>10</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="math inline"><em>K</em><sub>1</sub></span></td>
<td>2.1</td>
<td>3.9</td>
<td>7.5</td>
<td>14.9</td>
<td>26.8</td>
<td>39.1</td>
<td>52.8</td>
<td>76.6</td>
</tr>
</tbody>
</table>

**Face load factor.** The planet pins bend and the carrier twists, so
the load is not uniform across the face. *K*<sub>*H**β*</sub> is an
input (default 1.2, a reasonable value for a straddle-mounted
double-plate carrier with crowned or ground planets; use 1.35 or more
for a single-plate cantilever carrier). The bending factor follows from
it:

$$K\_{F\beta} = K\_{H\beta}^{N_F},\qquad N_F = \frac{(b/h)^2}{1 + b/h + (b/h)^2},\qquad h = (h\_{aP}^\* + h\_{fP}^\*)\\m,$$

with *b* the smaller face width of the mesh.

**Transverse load factors** (spur,
*K*<sub>*A*</sub>*F*<sub>*t*</sub>/*b* ≥ 100 N/mm):
*K*<sub>*H**α*</sub> = *K*<sub>*F**α*</sub> = 1.0 for grades 5–6; for
surface-hardened gears 1.1 at grade 7 and 1.2 at grade 8; for
through-hardened gears 1.0 at grade 7 and 1.1 at grade 8. The
surface-hardened line is used unless one of the three gears is through
hardened.

**Application factor *K*<sub>*A*</sub>** is yours to choose: 1.0 for a
smooth electric motor driving a uniform load, 1.25 for moderate shocks,
1.5–1.75 for heavy shocks. If you rate on peak torque instead of the
nominal torque, use *K*<sub>*A*</sub> = 1 with the peak torque, and
check the static strength separately.

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

### transverse_factor

``` python
def transverse_factor(
    grade:int, surface_hardened:bool=True
)->float:
```

*K_Hα = K_Fα for spur gears with K_A·F_t/b ≥ 100 N/mm.*

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

### dynamic_factor

``` python
def dynamic_factor(
    z1:int, u:float, v:float, wt:float, grade:int
)->float:
```

*K_v (ISO 6336-1 Method C, spur). z1 pinion teeth, u = |z2/z1|, v
\[m/s\], wt = K_A·F_t/b \[N/mm\].*

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

### load_sharing_factor

``` python
def load_sharing_factor(
    n_planets:int, floating_sun:bool=False
)->float:
```

*Mesh load factor K_γ for N planets (see table).*

## Life Factors: Theory

A gear that sees fewer load cycles than its endurance limit can take
more stress. ISO 6336-2/-3 Method B give log–log straight lines through
these points; above 10<sup>10</sup> cycles the factor is held. This
module uses the conservative branch (factor falls to 0.85 at
10<sup>10</sup> cycles), which applies unless the lubrication, material
cleanliness and manufacturing are all known to be optimal.

<table>
<colgroup>
<col style="width: 33%" />
<col style="width: 33%" />
<col style="width: 33%" />
</colgroup>
<thead>
<tr>
<th>kind</th>
<th><span
class="math inline"><em>Z</em><sub><em>N</em><em>T</em></sub></span>:
static / knee</th>
<th><span
class="math inline"><em>Y</em><sub><em>N</em><em>T</em></sub></span>:
static / knee</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>case</code>, <code>through</code></td>
<td>1.6 at ≤ <span class="math inline">10<sup>5</sup></span>, 1.0 at
<span class="math inline">5 ⋅ 10<sup>7</sup></span></td>
<td>2.5 at ≤ <span class="math inline">10<sup>3</sup></span> (through:
<span class="math inline">10<sup>4</sup></span>), 1.0 at <span
class="math inline">3 ⋅ 10<sup>6</sup></span></td>
</tr>
<tr>
<td><code>nitrided</code></td>
<td>1.3 at ≤ <span class="math inline">10<sup>5</sup></span>, 1.0 at
<span class="math inline">2 ⋅ 10<sup>6</sup></span></td>
<td>1.6 at ≤ <span class="math inline">10<sup>3</sup></span>, 1.0 at
<span class="math inline">3 ⋅ 10<sup>6</sup></span></td>
</tr>
</tbody>
</table>

Between the points the factor is interpolated on log–log scales: for
*N*<sub>0</sub> ≤ *N* ≤ *N*<sub>1</sub> with factors
*f*<sub>0</sub>, *f*<sub>1</sub>,

$$\log f = \log f_0 + \frac{\log N - \log N_0}{\log N_1 - \log N_0}\\(\log f_1 - \log f_0).$$

![](03_rating_files/figure-commonmark/cell-11-output-1.png)

**Load cycles in a planetary set** (ring fixed, *L*<sub>*h*</sub> hours,
one flank loaded per mesh):

*N*<sub>*L*, *s**u**n*</sub> = 60 *L*<sub>*h*</sub> |*n*<sub>*s*</sub> − *n*<sub>*c*</sub>| *N*,   *N*<sub>*L*, *p**l**a**n**e**t*</sub> = 60 *L*<sub>*h*</sub> |*n*<sub>*p*/*c*</sub>|,   *N*<sub>*L*, *r**i**n**g*</sub> = 60 *L*<sub>*h*</sub> |*n*<sub>*c*</sub>| *N*.

The planet meshes with the sun on one flank and with the ring on the
other, so each tooth root is bent one way and then the other on every
revolution. ISO 6336-3 accounts for this alternating bending with the
mean stress factor *Y*<sub>*M*</sub> = 0.7 on the planet.

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

### life_factor_bending

``` python
def life_factor_bending(
    N:float, kind:str
)->float:
```

*Y_NT (ISO 6336-3 Method B, conservative branch above the knee).*

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

### life_factor_contact

``` python
def life_factor_contact(
    N:float, kind:str
)->float:
```

*Z_NT (ISO 6336-2 Method B, conservative branch above the knee).*

``` python
assert life_factor_contact(1e4, "case") == 1.6 and math.isclose(life_factor_contact(5e7, "case"), 1.0)
assert math.isclose(life_factor_bending(3e6, "case"), 1.0) and life_factor_bending(1e11, "case") == 0.85
```

## Contact and Bending Stress: Theory

The force along the line of action is the same at both meshes of a
planet (moment balance about the pin), and its component on the
reference circle is the nominal tangential force. The carrier holds the
pin against the sum of the two.

![](03_rating_files/figure-commonmark/cell-15-output-1.png)

$$T_s = \frac{T\_{out}}{i\\\eta},\qquad F_t = \frac{2000\\T_s}{N\\d_s}\quad\[\text{N, with } T_s \text{ in N·m and } d_s \text{ in mm}\],\qquad F\_{bn} = \frac{F_t}{\cos\alpha},\qquad T_r = -(T\_{out} - T_s).$$

*η* is the stage efficiency (default 0.97) and *T*<sub>*r*</sub> the
reaction torque the housing must hold. The pitch line velocity used for
*K*<sub>*v*</sub> is taken relative to the carrier,
*v* = *π**d*<sub>*s*</sub> |*n*<sub>*s*</sub> − *n*<sub>*c*</sub>|/60 000
m/s.

**Contact (ISO 6336-2)**, *u* = *z*<sub>2</sub>/*z*<sub>1</sub> \> 0,
upper sign external, lower sign internal:

$$\sigma\_{H0} = Z_H Z_E Z\_\varepsilon\sqrt{\frac{F_t}{d_1 b}\\\frac{u \pm 1}{u}},\qquad \sigma\_{H1,2} = Z\_{B,D}\\\sigma\_{H0}\sqrt{K_A K_v K\_{H\beta} K\_{H\alpha} K\_\gamma}$$

$$Z_H = \sqrt{\frac{2\cos\alpha_w}{\cos^2\alpha\\\sin\alpha_w}},\qquad Z_E = \sqrt{\frac{1}{\pi\left(\frac{1-\nu_1^2}{E_1} + \frac{1-\nu_2^2}{E_2}\right)}},\qquad Z\_\varepsilon = \sqrt{\frac{4-\varepsilon\_\alpha}{3}}.$$

*Z*<sub>*B*</sub>, *Z*<sub>*D*</sub> move the stress from the pitch
point to the inner point of single tooth contact of an external pinion
and wheel, where one tooth pair carries the whole load:

![](03_rating_files/figure-commonmark/cell-16-output-1.png)

*Z*<sub>*B*</sub> = max (1, *M*<sub>1</sub>),
*Z*<sub>*D*</sub> = max (1, *M*<sub>2</sub>):

$$M_1 = \frac{\tan\alpha_w}{\sqrt{\left(\sqrt{\frac{d\_{a1}^2}{d\_{b1}^2}-1} - \frac{2\pi}{z_1}\right)\left(\sqrt{\frac{d\_{a2}^2}{d\_{b2}^2}-1} - (\varepsilon\_\alpha - 1)\frac{2\pi}{z_2}\right)}},$$

*M*<sub>2</sub> with indices 1 and 2 swapped. For the internal mesh both
are taken as 1.

Permissible contact stress and safety factor:

$$\sigma\_{HP} = \frac{\sigma\_{H\\lim} Z\_{NT} Z\_{LvR} Z_W Z_X}{S\_{H\\min}},\qquad S_H = \frac{\sigma\_{H\\lim} Z\_{NT} Z\_{LvR} Z_W Z_X}{\sigma_H},$$

with *Z*<sub>*L**v**R*</sub> = 0.85 for hobbed or shaped flanks
(*R*<sub>*z*</sub> \> 4 *μ*m), 0.92 for ground or shaved flanks,
*Z*<sub>*W*</sub> = *Z*<sub>*X*</sub> = 1.

**Bending (ISO 6336-3)**, for each gear of the mesh with its own form
factors:

$$\sigma_F = \frac{F_t}{b\\m}\\Y\_{Fa} Y\_{Sa} Y\_\varepsilon Y_B\\K_A K_v K\_{F\beta} K\_{F\alpha} K\_\gamma,\qquad Y\_\varepsilon = 0.25 + \frac{0.75}{\varepsilon\_\alpha}$$

$$S_F = \frac{\sigma\_{F\\lim}\\Y\_{ST}\\Y\_{NT}\\Y\_{\delta relT}\\Y\_{RrelT}\\Y_X\\Y_M}{\sigma_F},\qquad Y\_{ST} = 2,\\Y\_{\delta relT} = Y\_{RrelT} = Y_X = 1.$$

with *Y*<sub>*M*</sub> = 0.7 for the planets (alternating bending) and 1
for sun and ring. The permissible bending stress reported is

$$\sigma\_{FP} = \frac{\sigma\_{F\\lim}\\Y\_{ST}\\Y\_{NT}\\Y_M}{S\_{F\\min}}.$$

Usual minimum safety factors: *S*<sub>*H* *m**i**n*</sub> = 1.0 to 1.3,
*S*<sub>*F* *m**i**n*</sub> = 1.4 to 2.0 (root breakage is a sudden
failure, pitting a gradual one).

**Result.** Each gear is rated in each of its meshes (sun, planet at the
sun, planet at the ring, ring). The set passes when

min *S*<sub>*H*</sub> ≥ *S*<sub>*H* *m**i**n*</sub>  and  min *S*<sub>*F*</sub> ≥ *S*<sub>*F* *m**i**n*</sub>,

and the *limiting* gear and failure mode is the one with the smallest
margin *S*<sub>*H*</sub>/*S*<sub>*H* *m**i**n*</sub> or
*S*<sub>*F*</sub>/*S*<sub>*F* *m**i**n*</sub>.

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

### rate_planetary

``` python
def rate_planetary(
    ps:PlanetarySet, inp:RatingInputs, materials:dict[str, GearMaterial] | None=None,
    rims:dict[str, float | None] | None=None
)->PlanetaryRating:
```

*ISO 6336 rating of both meshes of a planetary set.*

materials : {‘sun’, ‘planet’, ‘ring’} → GearMaterial (default:
carburized sun and planets, Q&T nitrided ring) rims : {‘sun’, ‘planet’,
‘ring’} → rim thickness s_R under the tooth roots \[mm\] (None or
missing: solid)

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

### PlanetaryRating

``` python
def PlanetaryRating(
    T_sun:float, T_ring:float, T_carrier:float, F_t:float, F_bn:float, v:float, factors:dict,
    gears:tuple[GearRating, ...], S_Hmin:float, S_Fmin:float
)->None:
```

*Result of `rate_planetary`.*

T_sun, T_ring, T_carrier : torques \[N·m\] (ring reaction is opposite in
sign to the others) F_t : nominal tangential force per planet mesh \[N\]
(before K_γ) F_bn : force along the line of action per mesh \[N\]
(before K_γ) v : pitch line velocity relative to the carrier \[m/s\]
factors : the load factors used gears : one GearRating per gear and mesh
(sun, planet@sun, planet@ring, ring)

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

### GearRating

``` python
def GearRating(
    gear:str, mesh:str, cycles:float, sigma_H:float, sigma_HP:float, S_H:float, sigma_F:float, sigma_FP:float,
    S_F:float, Y_Fa:float, Y_Sa:float, Y_B:float, Z_NT:float, Y_NT:float
)->None:
```

*Stresses and safety factors of one gear in one mesh. Stresses in MPa.*

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

### RatingInputs

``` python
def RatingInputs(
    torque_out:float, n_in:float, life_h:float=10000.0, K_A:float=1.25, K_Hbeta:float=1.2, grade:int=6,
    floating_sun:bool=False, efficiency:float=0.97, S_Hmin:float=1.0, S_Fmin:float=1.4, flank_finish:str='ground'
)->None:
```

*Operating conditions and rating choices.*

torque_out : float Output (carrier) torque \[N·m\] used for the rating
n_in : float Input (sun) speed \[rpm\] life_h : float Required life
\[h\] at this torque and speed K_A : float Application factor K_Hbeta :
float Face load factor (see theory) grade : int ISO 1328-1 flank
tolerance class of the gears floating_sun : bool Sun radially free
(three planets share load evenly) efficiency : float Mesh efficiency of
the stage, for the sun torque S_Hmin : float Required safety against
pitting S_Fmin : float Required safety against tooth breakage
flank_finish : str ‘ground’ or ‘hobbed’ for sun and planets; the ring is
always shaped (Z_LvR = 0.85)

### Example

The ratio-5 set of the layout notebook (module 1.5, 18/27/72, three
planets, 20 mm face) at 40 N·m output, 3000 rpm input, 10 000 h:

``` python
from emachines.gears.layout import PlanetarySet
```

``` python
ps = PlanetarySet.build(18, 27, 72, m=1.5, n_planets=3, b=20)
r = rate_planetary(ps, RatingInputs(torque_out=40.0, n_in=3000.0, life_h=10_000))
print(f"T_sun = {r.T_sun:.2f} N·m, T_ring = {r.T_ring:.2f} N·m, F_t = {r.F_t:.0f} N per planet, v = {r.v:.2f} m/s")
print({k: round(v, 3) for k, v in r.factors.items()})
print(r.table())
assert r.ok
```

    T_sun = 8.25 N·m, T_ring = -31.75 N·m, F_t = 204 N per planet, v = 3.39 m/s
    {'K_A': 1.25, 'K_gamma': 1.1, 'K_Halpha': 1.0, 'K_Hbeta': 1.2, 'K_v sun–planet': 1.086, 'K_Fbeta sun–planet': 1.164, 'K_v planet–ring': 1.144, 'K_Fbeta planet–ring': 1.164}
    gear     mesh            cycles      σH     σHP    S_H      σF     σFP    S_F  Y_Fa  Y_Sa   Y_B
    sun      sun–planet    4.32e+09     461    1204   2.61      36     617  24.22  2.50  1.65  1.00
    planet   sun–planet    9.60e+08     454    1260   2.78      38     445  16.46  2.93  1.50  1.00
    planet   planet–ring   9.60e+08     220    1260   5.74      36     445  17.30  2.93  1.50  1.00
    ring     planet–ring   1.08e+09     220     754   3.43      31     457  20.83  1.82  2.06  1.00
    min S_H = 2.61 (need 1.0), min S_F = 16.46 (need 1.4); limited by pitting of the sun (sun–planet mesh)

Doubling the torque roughly halves the bending safety and divides the
pitting safety by $\sqrt2$, which is the scaling to expect:

``` python
r2 = rate_planetary(ps, RatingInputs(torque_out=80.0, n_in=3000.0, life_h=10_000))
print(f"S_H {r.S_H:.2f} → {r2.S_H:.2f}, S_F {r.S_F:.2f} → {r2.S_F:.2f}")
assert 0.45 < r2.S_F / r.S_F < 0.55 and 0.65 < r2.S_H / r.S_H < 0.75
```

    S_H 2.61 → 1.85, S_F 16.46 → 8.23

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

## Tests

## References

- ISO 6336-1:2019 — *Calculation of load capacity of spur and helical
  gears — Basic principles and influence factors* (*K*<sub>*v*</sub>,
  *K*<sub>*H**β*</sub>, *K*<sub>*H**α*</sub>).
- ISO 6336-2:2019 — *Calculation of surface durability (pitting)*.
- ISO 6336-3:2019 — *Calculation of tooth bending strength* (30°
  tangent, *Y*<sub>*F*</sub>, *Y*<sub>*S*</sub>, *Y*<sub>*B*</sub>,
  *Y*<sub>*M*</sub>).
- ISO 6336-5:2016 — *Strength and quality of materials*.
- AGMA 6123-B06 — *Design Manual for Enclosed Epicyclic Gear Drives*
  (planet load sharing *K*<sub>*γ*</sub>).
