
Planetary Stage Design — From Requirements to Manufacturing Package
Executive Summary
Purpose: One call from the requirements (ratio, torque, speed, life, envelope, input shaft) to a complete, checked single-stage planetary design and the files needed to make it.
What it does: design_planetary searches every tooth-count set near the target ratio, for each allowed number of planets and each standard module that fits between the sun bore and the envelope, and finds the narrowest face width at which every check passes: mesh geometry, ISO 6336 pitting and bending, planet bearing life, pin, carrier, key, ring fixing and axial length. It returns the passing designs ranked. PlanetaryDesign.write_package writes, for the chosen design:
| File | Content |
|---|---|
report.md |
requirements, chosen design, every check with its value and limit, assumptions |
gear_data_sun.csv, gear_data_planet.csv, gear_data_ring.csv |
ISO 1340 / DIN 3966-1 gear data tables for the drawings |
parts.csv |
parts list with quantities, key dimensions and fits |
component_dimensions.csv |
dimensions and limits of pin, bore, carrier, key, ring fixing |
layout.svg |
front view and axial section of the stage |
sun.dxf, planet.dxf, ring.dxf |
tooth outlines at mean thickness, for prototypes and drawings |
Inputs ND supplies: outer envelope (diameter, optionally length) and the shaft diameter that carries the sun. The rest have defaults that are stated in the report and can all be overridden.
How It Fits Into the Gear Design Workflow
Upstream: all other gears notebooks: involute → layout → rating → components → manufacturing.
Downstream: the drawings. A designer copies the data tables onto the gear drawings, the fits onto the part drawings, and uses the layout for the assembly drawing.
Requirements: Theory
The stage has the ring fixed in the housing, the sun on the input shaft and the carrier as output. What it must do is given by the ratio \(i\), the output torque \(T_{out}\), the input speed \(n_{in}\) and the life \(L_h\); where it must fit by the outer envelope diameter \(D_{env}\) (and optionally the length \(L_{env}\)), the input shaft diameter \(d_{sh}\) in the sun bore and, if the ring sits in a housing, the housing wall \(t_h\) outside it:
With the ring fixed the ratio and the output speed are
\[i = 1 + \frac{z_r}{z_s},\qquad n_{out} = \frac{n_{in}}{i},\]
and a tooth-count set is accepted when its relative ratio error is within the tolerance,
\[\varepsilon_i = \frac{i - i_{target}}{i_{target}},\qquad |\varepsilon_i| \le \mathrm{ratio\_tol}\ (\text{default } 3\,\%).\]
The gears are rated at \(T_{out}\) on the carrier, multiplied by the application factor \(K_A\) (default 1.25) inside the rating. Every other input has a default (materials, flank tolerance classes, finish, safety factors \(S_{H,min} = 1.0\) and \(S_{F,min} = 1.4\), planet counts 3 to 5, sun teeth 12 to 40); all of them are written into the report.
The sun–shaft joint is chosen with hub_joint (key, spline, press, adhesive or integral, see gears.components), with its details in joint_options. A joint without backlash fixes the sun radially, so it cannot be combined with floating_sun = True; the search refuses that combination.
The carrier is double (two plates joined by posts between the planets, the default) or single (one plate with cantilevered pins, needed at high ratios where the planets leave no room for posts). m_min sets the smallest module the search may use; without it the search, which ranks by length and margin, can pick modules too fine to make.
PlanetaryRequirements
def PlanetaryRequirements(
ratio:float, torque_out:float, n_in:float, envelope_d:float, shaft_d:float, envelope_length:float | None=None,
life_h:float=10000.0, hub_joint:str='key', carrier:str='double', m_min:float=0.0, joint_options:dict=<factory>,
ratio_tol:float=0.03, n_planets:tuple[int, ...]=(3, 4, 5), K_A:float=1.25, materials:dict=<factory>, grade:int=6,
ring_grade:int=7, flank_finish:str='ground', S_Hmin:float=1.0, S_Fmin:float=1.4, floating_sun:bool=False,
housing_wall:float=0.0, series_ii:bool=True, zs_range:tuple[int, int]=(12, 40)
)->None:What the stage must do and where it must fit. Lengths mm, torque N·m, speed rpm.
ratio, torque_out, n_in, life_h : target ratio, output torque for rating, input speed, required life [h] envelope_d, envelope_length : outer diameter and axial length available (length optional) shaft_d : input shaft diameter in the sun bore hub_joint : ‘key’, ‘spline’, ‘press’, ‘adhesive’ or ‘integral’ (see gears.components) carrier : ‘double’ (posts between the planets) or ‘single’ (one plate, cantilevered pins) m_min : smallest module to consider [mm] (0: no limit) joint_options : further ComponentInputs fields for the joint, e.g. {‘spline_fit’: ‘tight’} or {‘press_fit’: ‘H6/s5’} ratio_tol : allowed relative ratio error n_planets : planet counts to try K_A : application factor materials : {‘sun’|‘planet’|‘ring’: key of gears.rating.MATERIALS} grade, ring_grade : ISO 1328-1 flank tolerance class of sun/planets and of the ring flank_finish : ‘ground’ or ‘hobbed’ for sun and planets S_Hmin, S_Fmin : required safety factors floating_sun : the sun is radially free (load sharing) housing_wall : housing wall outside the ring (0: ring is the outer wall) series_ii : also allow ISO 54 series II modules zs_range : sun tooth counts to search
The Search: Theory
For every number of planets \(N\) and every tooth-count set within the ratio tolerance (tooth_count_candidates):
Module window.
module_limits, raised to at leastm_min, with the hard ISO 6336-3 rim limits (sun rim ≥ 0.5 tooth depths over the key groove, ring rim ≥ 1.75 m). Thinner-than-ideal rims are allowed and charged through \(Y_B\). Every standard module in the window is tried.Geometry.
PlanetarySet.build; sets that fail a mesh, neighbour or tip-thickness check are dropped.Face width. Starting from
\[b_{lo} = \max(5,\ \lceil 6m \rceil)\ \text{mm}\]
(narrower teeth are hard to hold square and to inspect) and growing in 1 mm steps up to
\[b_{hi} = \min\big(1.2\,d_s,\ L_{env} - n_c t_c - 2s_w - 2c_{ax}\big),\qquad n_c = 2\ (\text{double}) \text{ or } 1\ (\text{single}),\ t_c = 4,\ s_w = 1,\ c_{ax} = 0.5\ \text{mm (first estimate of the axial stack)},\]
each width is evaluated: the set is rated with rims from a first component sizing, the components are sized, and both are repeated once so that the planet rim matches the bearing bore actually chosen. The first width at which everything passes is kept. Gears are only as wide as they need to be; extra width costs length and makes the load less even across the face. If the geometry is invalid at some width, that module is abandoned.
Ranking. With the safety margin
\[\mu = \min\!\Big(\frac{S_H}{S_{H,min}},\ \frac{S_F}{S_{F,min}}\Big),\]
passing designs are sorted by the key \(\big(\mathrm{round}(|\varepsilon_i| / 0.005),\ \mathrm{round}(L_{stack}),\ -\mu\big)\): ratio error in 0.5 % steps, then axial length to the millimetre, then the larger margin first.
The search typically takes a few seconds and evaluates a few hundred designs.

design_planetary
def design_planetary(
req:PlanetaryRequirements, max_results:int=10
)->list[PlanetaryDesign]:Search tooth counts, planets, modules and face widths; return passing designs, best first (see theory).
evaluate
def evaluate(
req:PlanetaryRequirements, zs:int, zp:int, zr:int, m:float, n_planets:int, b:float
)->PlanetaryDesign | None:Build, rate and size one design; None if the geometry itself is not valid.
PlanetaryDesign
def PlanetaryDesign(
req:PlanetaryRequirements, gears:PlanetarySet, rating:PlanetaryRating, components:PlanetaryComponents,
allowances:dict
)->None:A complete checked design: requirements, gear set, rating, components and backlash allowances.
Drawing: Front View and Axial Section
layout_svg draws the stage to scale: on the left the front view with true involute teeth, carrier plate outline, pin holes, the input shaft with its key, and the ring outer diameter \(2R = D_{env} - 2t_h\); on the right the axial half-section with the carrier plates, gears, pins, bearings and thrust washers. Main dimensions are written beside the views. The teeth are drawn at the mean thickness, \(\Delta s = (A_{sne} + A_{sni})/2\).
Phasing. For the teeth to mesh in the drawing, each gear is turned to the right angle. Planet \(k\) sits at
\[\theta_k = \frac{2\pi k}{N},\qquad k = 0, \dots, N-1 .\]
With a sun tooth on the \(+x\) axis, planet 0 (at \(\theta_0 = 0\)) must face the sun with a tooth space: its tooth 0 points away from the sun, \(\pi\), turned by half a pitch, \(-\pi/z_p\). Carrying a planet round the fixed sun to \(\theta_k\) rolls it on the sun, which turns it by \(\theta_k(1 + z_s/z_p)\), so
\[\psi_k = \theta_k\Big(1 + \frac{z_s}{z_p}\Big) + \pi - \frac{\pi}{z_p}.\]
The ring is turned by \(\rho = \pi z_p / z_r\) so that a ring tooth space meets the outward tooth of planet 0; the assembly condition \((z_s + z_r)/N \in \mathbb{Z}\) (checked in gears.layout) makes every other planet mesh with the ring too.

layout_svg
def layout_svg(
d:PlanetaryDesign, width_px:int=1100
)->str:SVG text of the front view and axial section of a design (mm scale, see above).
Report and Package: Theory
The package collects the results of the earlier notebooks; the few values computed here are:
- Planet data sheet. The planet meshes with both the sun and the ring, so its active profile starts at the lower of the two: \(d_{Nf,p} = \min(d_{Nf2,sp},\ d_{Nf1,pr})\).
- Carrier pin holes. The pin-hole position is held to the centre distance tolerance: a position tolerance zone of diameter \(2f_a = IT7(a_w)\) about the nominal pin circle \(2a_w\), and the angular spacing \(360°/N\) to within \(\pm\,(f_a / a_w)\) rad, written in arc minutes, \(\pm\,60\cdot\frac{180}{\pi}\frac{f_a}{a_w}\)′. Both plates are line-bored together.
- Fits named on the parts: planet bore G6 (needle outer raceway), pin j5, pin holes N7, the sun joint (keyed: bore H7 on a k6 shaft, key groove P9; spline: DIN 5480 fit; press: the chosen H6/r5 … H7/u6 fit; adhesive: H7/k6; integral: no fit), carrier plate OD h11, ring OD h7 when bolted or s6 when pressed into an H7 housing. Their limits come from
gears.manufacturing.iso286_limits. - DXF outlines are written at the mean thickness \(\Delta s = (A_{sne} + A_{sni})/2\), with the bore (sun: \(d_{sh}\), planet: \(E_w\)) or the ring outside diameter as a circle.
write_package
def write_package(
d:PlanetaryDesign, folder:str
)->list[str]:Write the manufacturing package (see the table above) into folder; returns the file paths.
report_markdown
def report_markdown(
d:PlanetaryDesign
)->str:The design report (see the package table above).
parts_list
def parts_list(
d:PlanetaryDesign
)->list[tuple[int, str, int, str, str]]:(item, part, qty, description, material/standard).
data_sheets
def data_sheets(
d:PlanetaryDesign
)->dict[str, list[DataRow]]:Gear data tables of sun, planet and ring.
component_rows
def component_rows(
d:PlanetaryDesign
)->list[tuple[str, str, str]]:(part, feature, specification) rows with numeric limits for the part drawings.
Worked Example
These are placeholder inputs, chosen to show the method; replace them with the real envelope and shaft. A 120 mm diameter, 40 mm long envelope, a 14 mm keyed motor shaft, ratio 5, 20 N·m at the output, 3000 rpm in, 10 000 h:
import timereq = PlanetaryRequirements(ratio=5.0, torque_out=20.0, n_in=3000.0, envelope_d=120.0, envelope_length=40.0,
shaft_d=14.0, life_h=10_000)
t0 = time.time()
designs = design_planetary(req)
print(f"{len(designs)} designs in {time.time() - t0:.1f} s")
for dd in designs:
print(" ", dd.label())
best = designs[0]
assert best.rating.ok and best.components.ok and abs(best.ratio_error) <= req.ratio_tol10 designs in 1.3 s
28/42/112 ×4, m 1, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.25, S_F 7.38, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
40/60/160 ×4, m 0.7, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.25, S_F 5.81, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
32/48/128 ×4, m 0.8, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.07, S_F 6.37, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
39/59/156 ×3, m 0.7, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.05, S_F 4.84, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
39/58/156 ×3, m 0.7, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.04, S_F 4.84, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
36/54/144 ×4, m 0.7, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.04, S_F 5.37, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
28/42/112 ×4, m 0.9, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.04, S_F 7.25, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
27/41/108 ×3, m 1, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.03, S_F 7.33, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
27/40/108 ×3, m 1, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.02, S_F 7.31, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
30/45/120 ×3, m 0.9, b 6 mm: i = 5.0000 (+0.00 %), S_H 2.02, S_F 6.47, length 17.0 mm, limited by pitting of the sun (sun–planet mesh)
The chosen design, with all component checks:
print(best.gears.summary())
print(best.rating.table())
for ch in best.components.checks:
print(ch)i = 5.0000, N = 4, m = 1.0 mm, a_w = 35.0000 mm
gear z x k* d da df b
sun 28 +0.040 0.000 28.000 30.080 25.580 6.0
planet 42 -0.040 0.000 42.000 43.920 39.420 6.0
ring 112 +0.040 0.100 112.000 110.120 114.420 6.0
ε_α sun–planet 1.678, planet–ring 1.831, α_w 20.000° / 20.000°, planet tip gap 5.58 mm
checks: all pass
gear mesh cycles σH σHP S_H σF σFP S_F Y_Fa Y_Sa Y_B
sun sun–planet 5.76e+09 530 1193 2.25 70 614 12.20 2.52 1.63 1.00
planet sun–planet 9.60e+08 520 1260 2.42 69 445 9.06 2.42 1.66 1.00
planet planet–ring 9.60e+08 262 1260 4.82 71 445 8.83 2.42 1.66 1.00
ring planet–ring 1.44e+09 262 750 2.87 86 454 7.38 1.94 2.01 1.26
min S_H = 2.25 (need 1.0), min S_F = 7.38 (need 1.4); limited by pitting of the sun (sun–planet mesh)
✓ key flank pressure: 123 MPa (need ≤ 150)
✓ sun rim over hub groove / tooth depth: 1.55 (need ≥ 0.5)
✓ planet bearing L10h (estimated rating): 3.89e+04 h (need ≥ 1e+04)
✓ pin bending stress: 35.3 MPa (need ≤ 400)
✓ pin pressure on plate bore: 4.82 MPa (need ≤ 150)
✓ pin deflection per 10 mm face: 0.0016 mm (need ≤ 0.01)
✓ carrier plate inside ring tip circle: 81 mm (need ≤ 108)
✓ carrier post width between planets: 3.58 mm (need ≥ 3)
✓ carrier post bending stress: 4.41 MPa (need ≤ 120)
✓ ring rim / module (ISO 6336-3 lower limit; Y_B > 1 below 3.5): 2.79 (need ≥ 1.75)
✓ axial stack within envelope length: 17 mm (need ≤ 40)
Its layout:
from IPython.display import SVG, displaydisplay(SVG(best.svg()))And the manufacturing package written to a folder:
import tempfilewith tempfile.TemporaryDirectory() as td:
files = write_package(best, td)
for f_ in files:
print(os.path.basename(f_), os.path.getsize(f_), "bytes")
print(open(os.path.join(td, "gear_data_planet.csv")).read()[:1500])report.md 14500 bytes
gear_data_sun.csv 1635 bytes
gear_data_planet.csv 1684 bytes
gear_data_ring.csv 1570 bytes
parts.csv 1113 bytes
component_dimensions.csv 1300 bytes
layout.svg 395984 bytes
sun.dxf 115929 bytes
planet.dxf 175789 bytes
ring.dxf 245538 bytes
item,symbol,value
Gear,,planet
Type,,"spur, external"
Number of teeth,z,42
Normal module,m_n,1 mm
Pressure angle,α_n,20°
Helix angle,β,0°
Basic rack profile,,"ISO 53 profile A: h_aP = 1 m, h_fP = 1.25 m, ρ_fP = 0.38 m"
Profile shift coefficient,x,-0.0400
Reference diameter,d,42.0000 mm
Base diameter,d_b,39.4671 mm
Tip diameter,d_a,43.920 mm h11 (0/-0.160)
Root diameter,d_f,39.420 mm (max)
Root form diameter,d_Ff,≤ 40.327 mm (active profile starts at 40.363 mm)
Face width,b,6 mm ±0.1
Tooth thickness on d (arc),s,"1.5417 mm, allowances -0.045/-0.080 mm"
Span measurement,W_k (k = 5),13.8032 / 13.7703 mm
Dimension over balls,M_d (D_M = 1.73 mm),44.2459 / 44.1568 mm
Flank tolerance class,,ISO 1328-1:2013 class 6
Single pitch tolerance,f_pT,7.5 µm
Total cumulative pitch tolerance,F_pT,23 µm
Total profile tolerance,F_αT,7.5 µm
Profile slope tolerance,f_HαT,±4.8 µm
Total helix tolerance,F_βT,8 µm
Helix slope tolerance,f_HβT,±7.5 µm (crown 3–5 µm recommended on planets)
Radial runout tolerance,F_rT,21 µm
Mating gear,,"sun, z = 28, and ring z = 112"
Centre distance,a_w,35.0000 mm ±12 µm
Material,,20MnCr5 (1.7147) or 18CrNiMo7-6 (1.6587)
Heat treatment,,"case carburized, hardened and tempered"
Hardness,,"58–62 HRC surface, core 30–42 HRC"
Hardening depth,,CHD 550 HV1 = 0.30–0.45 mm after grinding (ISO 2639)
Flank roughness,,Ra ≤ 0.4 µm (Rz ≤ 3)
Root roughness,,"Ra ≤ 3.2 µm, no grinding notch in the root"
Tip edge,,chamfer or round 0.1–0.15 m (0.10–0.15 mm)
Process route,,"turn blank (bo