@rulecad/gears 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +28 -1
- package/core.mjs +2 -0
- package/gears.d.mts +1 -1
- package/gears.mjs +1 -1
- package/package.json +1 -1
- package/planetary.d.mts +38 -2
- package/planetary.mjs +67 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ What changed in each release, for someone upgrading a workspace. A **printed siz
|
|
|
4
4
|
print (a gear's tip diameter, a tooth's thickness). Each release says whether any printed size moved, and why.
|
|
5
5
|
Releases before this file was started are described in their pull requests on GitHub.
|
|
6
6
|
|
|
7
|
+
## 0.3.4: the compound planetary printed in place (#162)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `compoundPlanetary({ ..., printInPlace: true, gap, helix })` (#162): a compound planetary drawn to print in one
|
|
12
|
+
piece. Every gap is the print gap (`gap`, default `DEFAULTS.printGap`, 0.3 mm, an estimate): the backlash that
|
|
13
|
+
leaves it normal to every flank, 2 gap / (cos α cos β_b), and a dedendum that leaves it under every tip; herringbone
|
|
14
|
+
teeth (`helix`, default `DEFAULTS.helix`, 30°), the sun of one hand and the planets and rings of the other; no
|
|
15
|
+
carrier. `best.printInPlace` gives what it was drawn to, and a `compound.inPlace` finding says so. A `backlash` given
|
|
16
|
+
with it is refused by name, as are `gap` and `helix` without it.
|
|
17
|
+
- `compoundPlay(teeth, backlash)` and `best.play`: how far the output ring turns with the sun and the held ring still,
|
|
18
|
+
in mm at its pitch circle and in degrees, with a `compound.play` finding. Chapter 11's 38:1: 0.65°; the 44:1 printed
|
|
19
|
+
in place: 2.92°.
|
|
20
|
+
- `DEFAULTS.printGap` and `DEFAULTS.helix`, each with its rule.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- `compoundPlanetary` laid out a planet out of phase with the output ring where its teeth put it there (#162): with
|
|
25
|
+
57/39/36/135/132 (ratio 60, step -1, 3 planets) the planet at 120° cut 0.004 mm into the output ring at the
|
|
26
|
+
default backlash, and stood 0.11 mm off it where 0.3 mm was drawn, printed in place, with no finding. Each planet
|
|
27
|
+
after the first now takes the first tooth of its first step that also meshes the output ring (there, 12 teeth on),
|
|
28
|
+
and a `compound.phase` finding fails where no tooth does. Layouts already in phase (chapter 11's 38:1, the 44:1
|
|
29
|
+
printed in place) are unchanged.
|
|
30
|
+
|
|
31
|
+
No printed size moved: a gearbox not printed in place is drawn as before. Where a planet was out of phase, it now
|
|
32
|
+
stands turned a whole number of its first step's teeth.
|
|
33
|
+
|
|
7
34
|
## 0.3.3: no import loops (#278)
|
|
8
35
|
|
|
9
36
|
### Fixed
|
package/README.md
CHANGED
|
@@ -109,11 +109,36 @@ gives the ratio exactly, the nearest is returned and `planetary.ratio` says how
|
|
|
109
109
|
the output, each meshing its own step of a stepped planet, so a ratio of 30 to 200 fits in one stage. The ratio is
|
|
110
110
|
Willis's twice over, `(S + R1) / S / (1 − R1 P2 / (P1 R2))` (`compoundRatio`). The planets' steps differ by what the
|
|
111
111
|
rings do, so one centre distance serves both, and every tooth count is a multiple of the planets, so identical planets
|
|
112
|
-
go in evenly and in phase.
|
|
112
|
+
go in evenly and in phase. The rings are set from the first planet; each other planet takes the first tooth of its
|
|
113
|
+
first step (on the sun and the held ring) that also puts its second step in a space of the output ring, and a
|
|
114
|
+
`compound.phase` finding fails where none does. (Profile shift can't do this job alone: moving one ring by three teeth on one set of planets
|
|
113
115
|
needs a shift near two modules at the sizes that print, far past what a tooth takes.) It finds the efficiency too,
|
|
114
116
|
`compoundEfficiency`, an estimate: the rings pass power relative to the carrier many times the output's, so a high ratio is
|
|
115
117
|
well under 50%, and can't be driven backwards.
|
|
116
118
|
|
|
119
|
+
`best.play` is how far the output ring turns with the sun and the held ring still, the three meshes' backlash taken
|
|
120
|
+
up all one way (`compoundPlay`): with planets of pitch radii r1 on the sun and the held ring and r2 on the output
|
|
121
|
+
ring, and no carrier, the output ring travels j_sun |1 − r2/r1| / 2 + j_ring (1 + r2/r1) / 2 + j_ring2 at its pitch
|
|
122
|
+
circle. Chapter 11's 38:1 at the 0.15 mm backlash: 0.325 mm, 0.65°. That is play only: the teeth bending under a load
|
|
123
|
+
add to it.
|
|
124
|
+
|
|
125
|
+
### Printed in place
|
|
126
|
+
|
|
127
|
+
`compoundPlanetary({ module, ratio, planets, printInPlace: true, gap, helix })` draws the gearbox to come off the bed
|
|
128
|
+
in one piece, nothing to put together but the motor:
|
|
129
|
+
|
|
130
|
+
- **Every gap is the print gap** (`gap`, mm each side; default `DEFAULTS.printGap`, 0.3 mm, the X1C's `print_gap`, an
|
|
131
|
+
estimate). The backlash is the one that leaves that gap normal to every flank, 2 gap / (cos α cos β_b), β_b being
|
|
132
|
+
the base helix angle (0.726 mm at 0.3 mm, 20° and 30°); the dedendum leaves it under every tip (1.3 modules at
|
|
133
|
+
module 1, where ISO 53's 1.25 leaves 0.25 mm). A backlash given as well is refused: it comes from the gap.
|
|
134
|
+
- **Herringbone teeth** (`helix`, default 30°): the sun of one hand, the planets and rings of the other, so the rings
|
|
135
|
+
can't walk off the planets along the axis.
|
|
136
|
+
- **No carrier**: the two rings hold the planets.
|
|
137
|
+
|
|
138
|
+
The play grows with it: 18/21 planets on rings of 60 and 57 at 44:1 turn 1.45 mm (2.92°) at the output, about four
|
|
139
|
+
and a half times chapter 11's. The gaps between the printed parts, and whether each stands on the bed, are checked in
|
|
140
|
+
cad, on the object drawn with them (`"printInPlace": true`).
|
|
141
|
+
|
|
117
142
|
## Worms and bevel gears
|
|
118
143
|
|
|
119
144
|
A **worm** is a screw whose thread, cut along its axis, is the basic rack's tooth: `worm({ module, starts, diameter,
|
|
@@ -223,6 +248,8 @@ a point.
|
|
|
223
248
|
| Ring and pinion | at least 10 teeth apart (12 to be safe) at 20° | KHK, internal gears |
|
|
224
249
|
| Planetary ratio | (ω_s − ω_c) / (ω_r − ω_c) = −R / S; ring held, sun in: 1 + R / S | Willis; Dudley (1984), ch. 3 |
|
|
225
250
|
| Planetary assembly | R = S + 2P; (S + R) / n whole; 2a sin(π / n) > d_a,planet | KHK, planetary gears |
|
|
251
|
+
| Compound play at the output | j_s \|1 − r2/r1\| / 2 + j_r1 (1 + r2/r1) / 2 + j_r2, over the output ring's pitch radius | The three contacts' slips along their pitch circles, planets free of a carrier (this package) |
|
|
252
|
+
| Backlash for a gap normal to the flanks | j_t = 2 g / (cos α_t cos β_b), tan β_b = tan β cos α_t | ISO/TR 10064-2:1996 (j_bn = j_wt cos α_wt cos β_b) |
|
|
226
253
|
| Tooth bending (Lewis) | σ = K_v F_t / (b m Y); helical: m cos β, z / cos³β teeth | Budynas and Nisbett, Shigley's Mechanical Engineering Design, 10th ed., §14-1 and Table 14-2 |
|
|
227
254
|
| Velocity factor (Barth, cut profile) | K_v = (3.05 + V) / 3.05, V in m/s | Shigley, eq. 14-4b |
|
|
228
255
|
| Tooth by finite elements | plane stress, 32 cells a module, load F_t / cos α along the line of action at the tip | `@rulecad/fea`; AGMA 908-B89 for the geometry factor it is compared with |
|
package/core.mjs
CHANGED
|
@@ -33,6 +33,8 @@ export const DEFAULTS = {
|
|
|
33
33
|
chamfer: { value: 0.3, unit: 'mm', rule: 'A chamfer round the bed face, so the first layer\'s squish (elephant\'s foot) doesn\'t widen the teeth there', kind: 'estimate' },
|
|
34
34
|
efficiency: { value: 0.95, unit: 'per mesh', rule: 'Power a printed mesh passes on, dry: metal spur gears pass 98 to 99%, and dry plastic teeth rub more. Measure yours', kind: 'estimate' },
|
|
35
35
|
module: { value: 0.8, unit: 'mm at a 0.4 mm nozzle', rule: 'The smallest module worth printing: twice the nozzle, so a tooth is three lines at the pitch circle', kind: 'estimate' },
|
|
36
|
+
printGap: { value: 0.3, unit: 'mm', rule: 'The gap each side between gears printed in place, in mesh, that still prints apart: the X1C\'s print_gap. An estimate until the fit test plate measures it; the sampler plate\'s gears bound on pegs printed 0.105 mm clear each side, so it is no smaller than that', kind: 'estimate' },
|
|
37
|
+
helix: { value: 30, unit: 'deg', rule: 'The helix angle of a herringbone printed in place: steep enough that the rings cannot walk off the planets, and each half prints at 30° from the layers', kind: 'default' },
|
|
36
38
|
};
|
|
37
39
|
const D = (k) => DEFAULTS[k].value;
|
|
38
40
|
|
package/gears.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./core.mjs";
|
|
2
2
|
export { contact } from "./contact.mjs";
|
|
3
3
|
export { toothStress } from "./tooth.mjs";
|
|
4
|
-
export { planetary, planetaryRatio, compoundPlanetary, compoundRatio, compoundEfficiency } from "./planetary.mjs";
|
|
4
|
+
export { planetary, planetaryRatio, compoundPlanetary, compoundRatio, compoundEfficiency, compoundPlay } from "./planetary.mjs";
|
|
5
5
|
export { wormModel, worm, wormWheel, wormMesh } from "./worm.mjs";
|
package/gears.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// The package's main module: it only gathers the others. The code shared by all of them is in core.mjs.
|
|
11
11
|
export * from './core.mjs';
|
|
12
12
|
// Planetary gearboxes, plain and compound
|
|
13
|
-
export { planetary, planetaryRatio, compoundPlanetary, compoundRatio, compoundEfficiency } from './planetary.mjs';
|
|
13
|
+
export { planetary, planetaryRatio, compoundPlanetary, compoundRatio, compoundEfficiency, compoundPlay } from './planetary.mjs';
|
|
14
14
|
// The mesh measured from the drawn teeth: backlash, transmission error, interference
|
|
15
15
|
export { contact } from './contact.mjs';
|
|
16
16
|
// A tooth's root stress by finite elements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/gears",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Gears for printed parts: involute spur gears, racks and ring gears drawn from their rules, with their numbers, how a pair meshes (centre distance, ratio, contact ratio, phase) and how they print.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/planetary.d.mts
CHANGED
|
@@ -66,9 +66,16 @@ export function compoundEfficiency({ planet: P1, planet2: P2, ring: R1, ring2: R
|
|
|
66
66
|
* what printed robot joints use. Stepped planets (P2 = P1 + the rings' difference) keep one centre distance with no
|
|
67
67
|
* profile shift: a single planet on two rings can't, at sizes that print, without a shift far past what a tooth takes.
|
|
68
68
|
* Every tooth count is a multiple of the planets, so identical planets go in evenly and in phase on both rings.
|
|
69
|
-
*
|
|
69
|
+
*
|
|
70
|
+
* Printed in place (printInPlace: true), the gearbox comes off the bed in one piece with nothing to assemble but the
|
|
71
|
+
* motor: every gap is widened to the print gap (gap, mm each side, default DEFAULTS.printGap), so the backlash is
|
|
72
|
+
* the one that leaves that gap normal to every flank, 2 gap / (cos α cos β_b), and the dedendum leaves it under every
|
|
73
|
+
* tip; the teeth are herringbones (helix, default DEFAULTS.helix), the sun's one hand and the planets' and rings' the
|
|
74
|
+
* other, so the rings can't walk off the planets; and there is no carrier: the two rings hold the planets.
|
|
75
|
+
* @param {{ module: number, ratio: number, planets?: number, size?: number, least?: number, most?: number, step?: number, pressureAngle?: number, backlash?: number, printInPlace?: boolean, gap?: number, helix?: number }} spec
|
|
70
76
|
* ratio: turns of the sun for one of the output ring, in size (a negative one turns the other way); step: the rings' difference, in planets (default tries 1 and 2)
|
|
71
|
-
* @returns {{ best: object, others: object[], findings: object[] }}
|
|
77
|
+
* @returns {{ best: object, others: object[], findings: object[] }} best.play: the output ring's free turn with the
|
|
78
|
+
* sun and the held ring still (compoundPlay); best.printInPlace: the gap, backlash, dedendum and helix it was drawn to
|
|
72
79
|
*/
|
|
73
80
|
export function compoundPlanetary(spec: {
|
|
74
81
|
module: number;
|
|
@@ -80,8 +87,37 @@ export function compoundPlanetary(spec: {
|
|
|
80
87
|
step?: number;
|
|
81
88
|
pressureAngle?: number;
|
|
82
89
|
backlash?: number;
|
|
90
|
+
printInPlace?: boolean;
|
|
91
|
+
gap?: number;
|
|
92
|
+
helix?: number;
|
|
83
93
|
}): {
|
|
84
94
|
best: object;
|
|
85
95
|
others: object[];
|
|
86
96
|
findings: object[];
|
|
87
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* How far a compound planetary's output ring turns with the sun and the held ring still: the three meshes' backlash
|
|
100
|
+
* taken up all one way. With stepped planets of pitch radii r1 (on the sun and the held ring) and r2 (on the output
|
|
101
|
+
* ring), the planets float on their two meshes (no carrier), and the output ring's travel at its pitch circle is
|
|
102
|
+
* j_sun |1 − r2/r1| / 2 + j_ring (1 + r2/r1) / 2 + j_ring2. Worked out from the three contacts' slips along the pitch
|
|
103
|
+
* circles; a play, not a twist: the teeth bending under load add to it.
|
|
104
|
+
* @param {{ sun: number, planet: number, planet2: number, ring: number, ring2: number, module: number }} t
|
|
105
|
+
* @param {{ sun: number, ring: number, ring2: number }} backlash each mesh's, mm at the pitch circle
|
|
106
|
+
* @returns {{ mm: number, degrees: number, radians: number }} mm at the output ring's pitch circle
|
|
107
|
+
*/
|
|
108
|
+
export function compoundPlay({ planet: P1, planet2: P2, ring2: R2, module: m }: {
|
|
109
|
+
sun: number;
|
|
110
|
+
planet: number;
|
|
111
|
+
planet2: number;
|
|
112
|
+
ring: number;
|
|
113
|
+
ring2: number;
|
|
114
|
+
module: number;
|
|
115
|
+
}, backlash: {
|
|
116
|
+
sun: number;
|
|
117
|
+
ring: number;
|
|
118
|
+
ring2: number;
|
|
119
|
+
}): {
|
|
120
|
+
mm: number;
|
|
121
|
+
degrees: number;
|
|
122
|
+
radians: number;
|
|
123
|
+
};
|
package/planetary.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// −R / S). planetary() finds the teeth for a wanted ratio that also put together: the ring is the sun and two planets
|
|
4
4
|
// across (R = S + 2P), the planets go in evenly spaced ((S + R) a whole number of times the planets), and they clear
|
|
5
5
|
// each other. It lays the gearbox out with every planet in phase with the sun and the ring.
|
|
6
|
-
import { gearModel, internalModel, mesh, phase } from './core.mjs';
|
|
6
|
+
import { gearModel, internalModel, mesh, phase, DEFAULTS } from './core.mjs';
|
|
7
7
|
|
|
8
8
|
const DEG = Math.PI / 180;
|
|
9
9
|
const MEMBERS = ['sun', 'carrier', 'ring'];
|
|
@@ -103,9 +103,16 @@ export function compoundEfficiency({ planet: P1, planet2: P2, ring: R1, ring2: R
|
|
|
103
103
|
* what printed robot joints use. Stepped planets (P2 = P1 + the rings' difference) keep one centre distance with no
|
|
104
104
|
* profile shift: a single planet on two rings can't, at sizes that print, without a shift far past what a tooth takes.
|
|
105
105
|
* Every tooth count is a multiple of the planets, so identical planets go in evenly and in phase on both rings.
|
|
106
|
-
*
|
|
106
|
+
*
|
|
107
|
+
* Printed in place (printInPlace: true), the gearbox comes off the bed in one piece with nothing to assemble but the
|
|
108
|
+
* motor: every gap is widened to the print gap (gap, mm each side, default DEFAULTS.printGap), so the backlash is
|
|
109
|
+
* the one that leaves that gap normal to every flank, 2 gap / (cos α cos β_b), and the dedendum leaves it under every
|
|
110
|
+
* tip; the teeth are herringbones (helix, default DEFAULTS.helix), the sun's one hand and the planets' and rings' the
|
|
111
|
+
* other, so the rings can't walk off the planets; and there is no carrier: the two rings hold the planets.
|
|
112
|
+
* @param {{ module: number, ratio: number, planets?: number, size?: number, least?: number, most?: number, step?: number, pressureAngle?: number, backlash?: number, printInPlace?: boolean, gap?: number, helix?: number }} spec
|
|
107
113
|
* ratio: turns of the sun for one of the output ring, in size (a negative one turns the other way); step: the rings' difference, in planets (default tries 1 and 2)
|
|
108
|
-
* @returns {{ best: object, others: object[], findings: object[] }}
|
|
114
|
+
* @returns {{ best: object, others: object[], findings: object[] }} best.play: the output ring's free turn with the
|
|
115
|
+
* sun and the held ring still (compoundPlay); best.printInPlace: the gap, backlash, dedendum and helix it was drawn to
|
|
109
116
|
*/
|
|
110
117
|
export function compoundPlanetary(spec) {
|
|
111
118
|
const what = 'compoundPlanetary';
|
|
@@ -115,7 +122,8 @@ export function compoundPlanetary(spec) {
|
|
|
115
122
|
if (!(typeof ratio === 'number' && Number.isFinite(ratio) && Math.abs(ratio) > 1)) throw new Error(`${what}: ratio is turns of the sun for one of the output, more than 1 either way (got ${JSON.stringify(ratio)})`);
|
|
116
123
|
if (!(Number.isInteger(n) && n >= 2 && n <= 6)) throw new Error(`${what}: planets is a whole number from 2 to 6 (got ${JSON.stringify(n)})`);
|
|
117
124
|
const least = spec.least ?? 17, most = spec.most ?? 90, pa = spec.pressureAngle ?? 20, steps = spec.step != null ? [spec.step] : [1, -1, 2, -2];
|
|
118
|
-
const
|
|
125
|
+
const inPlace = printedInPlace(what, spec, m, pa);
|
|
126
|
+
const common = { module: m, pressureAngle: pa, ...(inPlace ? { backlash: inPlace.backlash, dedendum: inPlace.dedendum, helix: inPlace.helix, herringbone: true } : spec.backlash != null ? { backlash: spec.backlash } : {}) };
|
|
119
127
|
const multiple = (x, k) => Math.ceil(x / k) * k, sets = [];
|
|
120
128
|
for (let S = multiple(least, n); S <= most; S += n) for (let P1 = multiple(least, n); P1 <= most; P1 += n) {
|
|
121
129
|
const R1 = S + 2 * P1;
|
|
@@ -131,13 +139,66 @@ export function compoundPlanetary(spec) {
|
|
|
131
139
|
}
|
|
132
140
|
if (!sets.length) throw new Error(`${what}: no teeth put together${spec.size != null ? ` within a rim of ${spec.size} mm` : ''} with ${n} planets of ${least} teeth or more: a larger size, or a smaller module`);
|
|
133
141
|
sets.sort((x, y) => x.off - y.off || x.rim - y.rim);
|
|
134
|
-
|
|
142
|
+
// (helical teeth: two outer gears in mesh are of opposite hands, a ring and its pinion of the same)
|
|
143
|
+
const hand = (h) => (inPlace ? { hand: h } : {});
|
|
144
|
+
const b = sets[0], sun = gearModel({ ...common, ...hand('right'), teeth: b.sun }), planet = gearModel({ ...common, ...hand('left'), teeth: b.planet }), planet2 = gearModel({ ...common, ...hand('left'), teeth: b.planet2 }), ring = internalModel({ ...common, ...hand('left'), teeth: b.ring }), ring2 = internalModel({ ...common, ...hand('left'), teeth: b.ring2 });
|
|
135
145
|
const sunMesh = mesh(sun, planet), ringMesh = mesh(planet, ring), ring2Mesh = mesh(planet2, ring2), a = sunMesh.centre, out = [], f = (level, text, code, values) => out.push({ level, text, code, ...(values ? { values } : {}) });
|
|
136
146
|
const planets = Array.from({ length: n }, (_, k) => { const at = (360 * k) / n; return { at: [a * Math.cos(at * DEG), a * Math.sin(at * DEG)], angle: phase(sun, planet, at), place: at }; });
|
|
137
147
|
const ringAngle = (b.planet / b.ring) * planets[0].angle + phase(planet, ring, 180), ring2Angle = (b.planet2 / b.ring2) * planets[0].angle + phase(planet2, ring2, 180);
|
|
148
|
+
// Each planet's second step in phase with the output ring. The rings are set from the first planet; another planet
|
|
149
|
+
// meshes the sun and the held ring as well a whole tooth of its first step on (360 / P1 degrees), and that turns its
|
|
150
|
+
// second step too, so it takes the first such tooth that also puts its second step in a space of the output ring,
|
|
151
|
+
// whose angle for a planet at place θ turned ψ is (P2 / R2) ψ + phase(planet2, ring2, θ + 180), to a whole pitch
|
|
152
|
+
// (360 / R2). Every tooth count a multiple of the planets puts some in phase as they stand (chapter 11's 18/21 and
|
|
153
|
+
// 54/57 all are) and others not: 57/39/36/135/132's second planet stood 0.11 mm from the output ring at a 0.3 mm gap.
|
|
154
|
+
const pitch2 = 360 / b.ring2, missAt = (p, t) => { const d = (b.planet2 / b.ring2) * (p.angle + (360 * t) / b.planet) + phase(planet2, ring2, p.place + 180) - ring2Angle; return ((((d % pitch2) + pitch2 * 1.5) % pitch2) - pitch2 / 2); };
|
|
155
|
+
for (const p of planets.slice(1)) {
|
|
156
|
+
const t = Array.from({ length: b.planet }, (_, i) => i).find((i) => Math.abs(missAt(p, i)) < 1e-6);
|
|
157
|
+
if (t == null) f('fail', `the planet at ${fmt(p.place, 1)}° can't mesh with the output ring, whichever tooth of its first step meets the sun`, 'compound.phase', { place: p.place });
|
|
158
|
+
else p.angle += (360 * t) / b.planet;
|
|
159
|
+
}
|
|
138
160
|
f(b.off < 0.05 ? 'pass' : b.off < 0.2 ? 'warn' : 'fail', `${fmt(b.ratio, 2)} : 1 (sun to the output ring, the other ring held), ${b.off < 0.01 ? 'as asked' : `${fmt(b.off * 100, 1)}% from the ${fmt(ratio)} asked`}: sun ${b.sun}, stepped planets ${b.planet}/${b.planet2} × ${n}, rings ${b.ring} and ${b.ring2}`, 'compound.ratio', { ratio: b.ratio, asked: ratio });
|
|
139
161
|
f('info', `about ${fmt(b.efficiency * 100, 0)}% efficient (an estimate): ${b.efficiency <= 0.5 ? 'under 50%, so it can\'t be driven backwards' : 'it can be driven backwards'}`, 'compound.efficiency', { efficiency: b.efficiency });
|
|
140
162
|
if (Math.abs(ring2Mesh.centre - a) > 1e-9) f('fail', `the output ring's centre distance is ${fmt(ring2Mesh.centre)} mm and the planets' ${fmt(a)} mm: the rings' difference must equal the planets'`, 'compound.centre');
|
|
141
163
|
for (const [pair, ms] of [['sun and planet', sunMesh], ['planet and held ring', ringMesh], ['planet and output ring', ring2Mesh]]) for (const x of ms.findings) out.push({ ...x, text: `${pair}: ${x.text}` });
|
|
142
|
-
|
|
164
|
+
const play = compoundPlay({ sun: b.sun, planet: b.planet, planet2: b.planet2, ring: b.ring, ring2: b.ring2, module: m }, { sun: sunMesh.backlash, ring: ringMesh.backlash, ring2: ring2Mesh.backlash });
|
|
165
|
+
if (inPlace) f('info', `printed in place: ${fmt(inPlace.gap)} mm clear normal to every flank and under every tip (a backlash of ${fmt(inPlace.backlash)} mm and a dedendum of ${fmt(inPlace.dedendum)} modules), herringbone teeth at ${fmt(inPlace.helix)}° so the rings stay on the planets, and no carrier: the rings hold the planets`, 'compound.inPlace', { gap: inPlace.gap, backlash: inPlace.backlash, dedendum: inPlace.dedendum, helix: inPlace.helix });
|
|
166
|
+
f('info', `the output ring turns ${fmt(play.degrees, 2)}° (${fmt(play.mm)} mm at its pitch circle) with the sun and the held ring still: its play, from the three meshes' backlash`, 'compound.play', { degrees: play.degrees, mm: play.mm });
|
|
167
|
+
return { best: { sun: { teeth: b.sun, model: sun }, planet: { teeth: b.planet, model: planet }, planet2: { teeth: b.planet2, model: planet2 }, ring: { teeth: b.ring, model: ring, angle: ringAngle }, ring2: { teeth: b.ring2, model: ring2, angle: ring2Angle }, planets, centre: a, ratio: b.ratio, efficiency: b.efficiency, rim: Math.max(ring.rim, ring2.rim), module: m, play, ...(inPlace ? { printInPlace: inPlace } : {}) }, others: sets.slice(1, 6).map(({ off, ...x }) => x), findings: out };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Printed in place: the gap, checked by name, and the backlash, dedendum and helix it sets
|
|
171
|
+
function printedInPlace(what, spec, m, pa) {
|
|
172
|
+
if (spec.printInPlace == null || spec.printInPlace === false) {
|
|
173
|
+
for (const k of ['gap', 'helix']) if (spec[k] != null) throw new Error(`${what}: ${k} is for a gearbox printed in place: add printInPlace: true, or leave ${k} out`);
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
if (spec.printInPlace !== true) throw new Error(`${what}: printInPlace is true or false (got ${JSON.stringify(spec.printInPlace)})`);
|
|
177
|
+
if (spec.backlash != null) throw new Error(`${what}: printed in place, the backlash comes from the gap (2 gap / (cos α cos β_b)): give gap, the print gap each side in mm, not backlash`);
|
|
178
|
+
const gap = spec.gap ?? DEFAULTS.printGap.value, helix = spec.helix ?? DEFAULTS.helix.value;
|
|
179
|
+
if (!(typeof gap === 'number' && gap > 0 && gap < m / 2)) throw new Error(`${what}: gap is the print gap each side, above 0 and under half the module (${fmt(m / 2)} mm) (got ${JSON.stringify(spec.gap)})`);
|
|
180
|
+
if (!(typeof helix === 'number' && helix >= 10 && helix <= 45)) throw new Error(`${what}: helix is the herringbone's angle, from 10 to 45° (got ${JSON.stringify(spec.helix)})`);
|
|
181
|
+
// The gap normal to a flank: the transverse backlash j_t at the pitch circle, times cos α_t across the involute,
|
|
182
|
+
// times cos β_b along the helix (ISO/TR 10064-2: j_bn = j_t cos α_t cos β_b), shared by the two flanks of a space
|
|
183
|
+
const a = pa * DEG, betaB = Math.atan(Math.tan(helix * DEG) * Math.cos(a)), backlash = (2 * gap) / (Math.cos(a) * Math.cos(betaB));
|
|
184
|
+
// Under each tip: the dedendum less the addendum, in modules
|
|
185
|
+
const dedendum = Math.max(DEFAULTS.dedendum.value, DEFAULTS.addendum.value + gap / m);
|
|
186
|
+
return { gap, helix, backlash, dedendum, carrier: false };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* How far a compound planetary's output ring turns with the sun and the held ring still: the three meshes' backlash
|
|
191
|
+
* taken up all one way. With stepped planets of pitch radii r1 (on the sun and the held ring) and r2 (on the output
|
|
192
|
+
* ring), the planets float on their two meshes (no carrier), and the output ring's travel at its pitch circle is
|
|
193
|
+
* j_sun |1 − r2/r1| / 2 + j_ring (1 + r2/r1) / 2 + j_ring2. Worked out from the three contacts' slips along the pitch
|
|
194
|
+
* circles; a play, not a twist: the teeth bending under load add to it.
|
|
195
|
+
* @param {{ sun: number, planet: number, planet2: number, ring: number, ring2: number, module: number }} t
|
|
196
|
+
* @param {{ sun: number, ring: number, ring2: number }} backlash each mesh's, mm at the pitch circle
|
|
197
|
+
* @returns {{ mm: number, degrees: number, radians: number }} mm at the output ring's pitch circle
|
|
198
|
+
*/
|
|
199
|
+
export function compoundPlay({ planet: P1, planet2: P2, ring2: R2, module: m }, backlash) {
|
|
200
|
+
for (const k of ['sun', 'ring', 'ring2']) if (!(typeof backlash?.[k] === 'number' && backlash[k] >= 0)) throw new Error(`compoundPlay: backlash.${k} is the ${k === 'sun' ? 'sun\'s' : k === 'ring' ? 'held ring\'s' : 'output ring\'s'} mesh's, 0 or more mm (got ${JSON.stringify(backlash?.[k])})`);
|
|
201
|
+
if (!(typeof m === 'number' && m > 0)) throw new Error(`compoundPlay: module is a size above 0 (got ${JSON.stringify(m)})`);
|
|
202
|
+
const k = P2 / P1, mm = (backlash.sun * Math.abs(1 - k)) / 2 + (backlash.ring * (1 + k)) / 2 + backlash.ring2, radians = mm / ((m * R2) / 2);
|
|
203
|
+
return { mm, radians, degrees: radians / DEG };
|
|
143
204
|
}
|