@rulecad/gears 0.3.3 → 0.3.5
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 +33 -0
- package/README.md +68 -12
- package/contact.d.mts +8 -0
- package/contact.mjs +57 -24
- package/core.mjs +85 -24
- package/gears.d.mts +1 -1
- package/gears.mjs +1 -1
- package/package.json +6 -17
- package/planetary.d.mts +38 -2
- package/planetary.mjs +67 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ 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.5: follows @rulecad/fea 0.3.0
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Takes @rulecad/fea 0.3.0.
|
|
12
|
+
|
|
13
|
+
## 0.3.4: the compound planetary printed in place (#162)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `compoundPlanetary({ ..., printInPlace: true, gap, helix })` (#162): a compound planetary drawn to print in one
|
|
18
|
+
piece. Every gap is the print gap (`gap`, default `DEFAULTS.printGap`, 0.3 mm, an estimate): the backlash that
|
|
19
|
+
leaves it normal to every flank, 2 gap / (cos α cos β_b), and a dedendum that leaves it under every tip; herringbone
|
|
20
|
+
teeth (`helix`, default `DEFAULTS.helix`, 30°), the sun of one hand and the planets and rings of the other; no
|
|
21
|
+
carrier. `best.printInPlace` gives what it was drawn to, and a `compound.inPlace` finding says so. A `backlash` given
|
|
22
|
+
with it is refused by name, as are `gap` and `helix` without it.
|
|
23
|
+
- `compoundPlay(teeth, backlash)` and `best.play`: how far the output ring turns with the sun and the held ring still,
|
|
24
|
+
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
|
|
25
|
+
in place: 2.92°.
|
|
26
|
+
- `DEFAULTS.printGap` and `DEFAULTS.helix`, each with its rule.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- `compoundPlanetary` laid out a planet out of phase with the output ring where its teeth put it there (#162): with
|
|
31
|
+
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
|
|
32
|
+
default backlash, and stood 0.11 mm off it where 0.3 mm was drawn, printed in place, with no finding. Each planet
|
|
33
|
+
after the first now takes the first tooth of its first step that also meshes the output ring (there, 12 teeth on),
|
|
34
|
+
and a `compound.phase` finding fails where no tooth does. Layouts already in phase (chapter 11's 38:1, the 44:1
|
|
35
|
+
printed in place) are unchanged.
|
|
36
|
+
|
|
37
|
+
No printed size moved: a gearbox not printed in place is drawn as before. Where a planet was out of phase, it now
|
|
38
|
+
stands turned a whole number of its first step's teeth.
|
|
39
|
+
|
|
7
40
|
## 0.3.3: no import loops (#278)
|
|
8
41
|
|
|
9
42
|
### Fixed
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ const solid = spur({ module: 1, teeth: 18, width: 6, bore: 5 }); // a JSCAD soli
|
|
|
24
24
|
|
|
25
25
|
```text
|
|
26
26
|
30 -0.4286 1.63 0.15
|
|
27
|
-
pass mesh.contact, pass mesh.centre
|
|
27
|
+
pass mesh.contact, pass mesh.tipClearance, pass mesh.centre
|
|
28
28
|
4.286
|
|
29
29
|
18 16.914 20 15.5
|
|
30
30
|
pass: module 1: 3.6 lines across a tooth at its pitch circle
|
|
@@ -75,14 +75,36 @@ What every gear takes:
|
|
|
75
75
|
- **`centre`**: how far apart the axes must be (for a rack, the pinion's axis above the rack's pitch line). Shifted
|
|
76
76
|
gears move apart by their working pressure angle.
|
|
77
77
|
- **`ratio`**: turns of b for each turn of a, negative when they turn opposite ways. For a rack, mm of travel a turn.
|
|
78
|
-
- **`contact`**: the contact ratio, how many pairs of teeth share the load on average
|
|
79
|
-
1.2 it is rough.
|
|
78
|
+
- **`contact`**: the contact ratio, how many pairs of teeth share the load on average, where the axes are: at the
|
|
79
|
+
`centre` you gave, or else at the one they need. Under 1 the drive jumps; under 1.2 it is rough. Apart from their
|
|
80
|
+
place the gears roll at a new working pressure angle (cos α_w = (r_b1 ± r_b2) / a) and the teeth overlap less: 20
|
|
81
|
+
teeth on 40 at module 1 share 1.63 pairs at their 30 mm, 1.17 at 30.5 mm and 0.74 at 31 mm, where the drive jumps.
|
|
82
|
+
`pressureAngle` is the working angle at that centre too. A pair whose teeth don't reach across fails, whatever a
|
|
83
|
+
helical's twist would add, and so do axes so close that the base circles overlap.
|
|
84
|
+
- **`clearance`**: the room under the tips, in mm, at that centre (0.25 module as drawn).
|
|
80
85
|
- **`backlash`**: the play, with the centre you gave.
|
|
81
86
|
- **`overlap`** and **`thrust`**: for helical gears, with `width` given, how much the twist adds to the contact ratio, and the push along the axis for each newton driven (none for a herringbone).
|
|
82
|
-
- **`findings`**: `mesh.contact
|
|
83
|
-
it jam the teeth; too far apart,
|
|
84
|
-
`mesh.pressure` (gears that can't mesh), `mesh.interference`
|
|
85
|
-
gears that cross: outer gears that mesh are of opposite
|
|
87
|
+
- **`findings`**: `mesh.contact` (each finding names the centre when you gave one off the gears' own), `mesh.centre`
|
|
88
|
+
(axes closer than the gears need eat their backlash, 2 Δa tan α of it, and past it jam the teeth; too far apart,
|
|
89
|
+
they knock), `mesh.tipClearance`, `mesh.module` and `mesh.pressure` (gears that can't mesh), `mesh.interference`
|
|
90
|
+
(a pinion's tips fouling its ring's), `mesh.helix` (helical gears that cross: outer gears that mesh are of opposite
|
|
91
|
+
hands; a pinion and its ring or rack, of the same hand).
|
|
92
|
+
|
|
93
|
+
**Tips of shifted gears.** Profile shift pushes a gear's tips out further than it pushes the pair apart, so two
|
|
94
|
+
shifted gears lose the room under their tips they were drawn with: 18 teeth on 18, both shifted a whole module, have
|
|
95
|
+
none, and the tips dig 0.165 mm into the roots. ISO 21771 and KHK shorten each tip by (x₁ + x₂ − y) modules, y being
|
|
96
|
+
how far the shift moved the centre. Each gear is drawn on its own, without its mate, so its tips are drawn full;
|
|
97
|
+
`mesh.tipClearance` fails a pair whose tips reach the mate's roots, warns under a tenth of a module of room, and says
|
|
98
|
+
the `addendum` that gives the room back (it is in the finding's `values.addendum`, the first gear's and the
|
|
99
|
+
second's, reckoned at the centre the gears need: tips that dig in only because the axes are set too close are told to
|
|
100
|
+
move the axes). For KHK's worked pair (module 3, 12 and 24 teeth shifted 0.6 and 0.36) that is 0.873 on both, which gives
|
|
101
|
+
the tips KHK lists, 44.84 and 79.40 mm.
|
|
102
|
+
|
|
103
|
+
**A pinion in a ring.** As each pinion tooth leaves the ring's space its tip swings out past the corner of the ring's
|
|
104
|
+
tooth. `mesh.interference` tests that by KHK's trochoid condition, which honours the shift and the centre, and
|
|
105
|
+
allows each flank a quarter of each gear's backlash: 20 teeth in a ring of 26 or 27 fail, 28 clear by the backlash
|
|
106
|
+
alone (a warn), 30 clear outright. It no longer goes by the number of teeth between them, which failed rings that
|
|
107
|
+
clear and passed shifted pinions that don't (12 shifted 0.3 in 24).
|
|
86
108
|
|
|
87
109
|
`phase(a, b, angle)` is the turn that puts a tooth of a in a space of b: b's angle is `ratio × a's angle + phase`,
|
|
88
110
|
with `angle` the direction from a's centre to b's. `rackPhase(pinion, at)` does the same for a rack.
|
|
@@ -109,11 +131,36 @@ gives the ratio exactly, the nearest is returned and `planetary.ratio` says how
|
|
|
109
131
|
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
132
|
Willis's twice over, `(S + R1) / S / (1 − R1 P2 / (P1 R2))` (`compoundRatio`). The planets' steps differ by what the
|
|
111
133
|
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.
|
|
134
|
+
go in evenly and in phase. The rings are set from the first planet; each other planet takes the first tooth of its
|
|
135
|
+
first step (on the sun and the held ring) that also puts its second step in a space of the output ring, and a
|
|
136
|
+
`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
137
|
needs a shift near two modules at the sizes that print, far past what a tooth takes.) It finds the efficiency too,
|
|
114
138
|
`compoundEfficiency`, an estimate: the rings pass power relative to the carrier many times the output's, so a high ratio is
|
|
115
139
|
well under 50%, and can't be driven backwards.
|
|
116
140
|
|
|
141
|
+
`best.play` is how far the output ring turns with the sun and the held ring still, the three meshes' backlash taken
|
|
142
|
+
up all one way (`compoundPlay`): with planets of pitch radii r1 on the sun and the held ring and r2 on the output
|
|
143
|
+
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
|
|
144
|
+
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
|
|
145
|
+
add to it.
|
|
146
|
+
|
|
147
|
+
### Printed in place
|
|
148
|
+
|
|
149
|
+
`compoundPlanetary({ module, ratio, planets, printInPlace: true, gap, helix })` draws the gearbox to come off the bed
|
|
150
|
+
in one piece, nothing to put together but the motor:
|
|
151
|
+
|
|
152
|
+
- **Every gap is the print gap** (`gap`, mm each side; default `DEFAULTS.printGap`, 0.3 mm, the X1C's `print_gap`, an
|
|
153
|
+
estimate). The backlash is the one that leaves that gap normal to every flank, 2 gap / (cos α cos β_b), β_b being
|
|
154
|
+
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
|
|
155
|
+
module 1, where ISO 53's 1.25 leaves 0.25 mm). A backlash given as well is refused: it comes from the gap.
|
|
156
|
+
- **Herringbone teeth** (`helix`, default 30°): the sun of one hand, the planets and rings of the other, so the rings
|
|
157
|
+
can't walk off the planets along the axis.
|
|
158
|
+
- **No carrier**: the two rings hold the planets.
|
|
159
|
+
|
|
160
|
+
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
|
|
161
|
+
and a half times chapter 11's. The gaps between the printed parts, and whether each stands on the bed, are checked in
|
|
162
|
+
cad, on the object drawn with them (`"printInPlace": true`).
|
|
163
|
+
|
|
117
164
|
## Worms and bevel gears
|
|
118
165
|
|
|
119
166
|
A **worm** is a screw whose thread, cut along its axis, is the basic rack's tooth: `worm({ module, starts, diameter,
|
|
@@ -141,7 +188,13 @@ and at each step turns the driven gear each way until its outline meets the driv
|
|
|
141
188
|
- **backlash**: the turn between the two meetings, as play at the pitch circle (`mesh.backlash`, a warn when it falls
|
|
142
189
|
under 0.02 mm);
|
|
143
190
|
- **transmission error**: how far the driven gear's forward meeting wanders across a tooth (`mesh.error`);
|
|
144
|
-
- **interference**: steps where the outlines already cross where the ratio puts them (`mesh.interference`)
|
|
191
|
+
- **interference**: steps where the outlines already cross where the ratio puts them (`mesh.interference`);
|
|
192
|
+
- **lost contact**: steps where the driven gear turns half a tooth either way without meeting the driver, so the axes
|
|
193
|
+
are too far apart for the teeth to drive (`mesh.contact`, a fail). The backlash is then left out, and `backlash` is
|
|
194
|
+
`{ least: null, most: null }` if no step touched.
|
|
195
|
+
|
|
196
|
+
It tests every edge where the teeth can meet: inside both tip circles, which for outer gears is close round the pitch
|
|
197
|
+
point and for a pinion in a ring can be much of the way round.
|
|
145
198
|
|
|
146
199
|
`a` and `b` are the parameters the models take; `b.kind` is `'internal'` for a ring or `'rack'` for a rack. For 18
|
|
147
200
|
teeth on 30 at module 1 it measures 0.150 to 0.152 mm of play against the 0.15 mm drawn, and 1 µm of transmission
|
|
@@ -213,16 +266,19 @@ a point.
|
|
|
213
266
|
| Undercut | none when z sin²α / 2 ≥ h_a − x (17 teeth at 20°) | ISO 21771; KHK |
|
|
214
267
|
| Working pressure angle | inv α_w = inv α + 2 tan α (x₁ + x₂) / (z₁ + z₂) | ISO 21771 |
|
|
215
268
|
| Centre distance | a = m (z₁ + z₂) cos α / 2 cos α_w; a ring: z₂ − z₁ | ISO 21771 |
|
|
216
|
-
| Contact ratio | (√(r_a1² − r_b1²) + √(r_a2² − r_b2²) − a sin α_w) / (π m cos α) | Dudley (1984); KHK |
|
|
217
|
-
| Rack contact | (√(r_a² − r_b²) − r sin α + m
|
|
269
|
+
| Contact ratio | (√(r_a1² − r_b1²) + √(r_a2² − r_b2²) − a sin α_w) / (π m cos α), at the centre a used, cos α_w = (r_b1 + r_b2) / a | Dudley (1984); KHK |
|
|
270
|
+
| Rack contact | (√(r_a² − r_b²) − r sin α + (m h_a − (a − r)) / sin α) / (π m cos α), a the pinion's axis above the pitch line | KHK |
|
|
271
|
+
| Room under the tips | a − r_a1 − r_f2 (a ring: r_f2 − a − r_a1 and r_a2 − a − r_f1); shifted tips shortened by (x₁ + x₂ − y) m | ISO 21771; KHK |
|
|
218
272
|
| Root fillet | 0.38 m | ISO 53 profile A |
|
|
219
273
|
| Helical twist | the profile turns z tan β / r up the width | ISO 21771 (transverse module) |
|
|
220
274
|
| Overlap ratio | ε_β = b tan β / π m (each half of a herringbone on its own) | ISO 21771 |
|
|
221
275
|
| Thrust | F_a = F_t tan β | Dudley (1984) |
|
|
222
276
|
| Flank lean at the tip | tan β_a = tan β · r_a / r | ISO 21771 |
|
|
223
|
-
| Ring and pinion |
|
|
277
|
+
| Ring and pinion (trochoid interference) | θ₁ z₁/z₂ + inv α_w − inv α_a2 ≥ θ₂; θ₁ = acos((r_a2² − r_a1² − a²) / 2a r_a1) + inv α_a1 − inv α_w, θ₂ = acos((a² + r_a2² − r_a1²) / 2a r_a2) | KHK, internal gears |
|
|
224
278
|
| Planetary ratio | (ω_s − ω_c) / (ω_r − ω_c) = −R / S; ring held, sun in: 1 + R / S | Willis; Dudley (1984), ch. 3 |
|
|
225
279
|
| Planetary assembly | R = S + 2P; (S + R) / n whole; 2a sin(π / n) > d_a,planet | KHK, planetary gears |
|
|
280
|
+
| 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) |
|
|
281
|
+
| 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
282
|
| 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
283
|
| Velocity factor (Barth, cut profile) | K_v = (3.05 + V) / 3.05, V in m/s | Shigley, eq. 14-4b |
|
|
228
284
|
| 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/contact.d.mts
CHANGED
|
@@ -13,6 +13,13 @@ export function contact(a: object, b: object & {
|
|
|
13
13
|
rows: ({
|
|
14
14
|
angle: number;
|
|
15
15
|
interferes: boolean;
|
|
16
|
+
apart?: undefined;
|
|
17
|
+
backlash?: undefined;
|
|
18
|
+
error?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
angle: number;
|
|
21
|
+
apart: boolean;
|
|
22
|
+
interferes?: undefined;
|
|
16
23
|
backlash?: undefined;
|
|
17
24
|
error?: undefined;
|
|
18
25
|
} | {
|
|
@@ -20,6 +27,7 @@ export function contact(a: object, b: object & {
|
|
|
20
27
|
backlash: any;
|
|
21
28
|
error: any;
|
|
22
29
|
interferes?: undefined;
|
|
30
|
+
apart?: undefined;
|
|
23
31
|
})[];
|
|
24
32
|
backlash: {
|
|
25
33
|
least: number;
|
package/contact.mjs
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
// The mesh measured, not reckoned: the drawn teeth turned through a pitch, and at each step the driven gear turned
|
|
2
2
|
// each way until its outline meets the driver's. The turn between the two meetings is the backlash as drawn (with the
|
|
3
3
|
// real fillets, rounds and centre distance); how far the forward meeting is from where the ratio puts it is the
|
|
4
|
-
// transmission error; outlines that cross where the ratio puts them interfere
|
|
5
|
-
// edges
|
|
4
|
+
// transmission error; outlines that cross where the ratio puts them interfere; a driven gear that turns half a tooth
|
|
5
|
+
// either way and meets nothing has lost contact. Plain 2D geometry: the outlines' edges where the teeth can meet (the
|
|
6
|
+
// lens where each gear's teeth reach inside the other's tip circle: by the pitch point for outer gears, round much of
|
|
7
|
+
// the ring for a pinion close in a ring), tested for crossing.
|
|
6
8
|
import { spurProfile, internalProfile, rackProfile, gearModel, internalModel, rackModel, mesh, phase, rackPhase } from './core.mjs';
|
|
7
9
|
|
|
8
10
|
const DEG = Math.PI / 180;
|
|
9
11
|
const fmt = (x, d = 3) => String(+x.toFixed(d));
|
|
10
12
|
|
|
11
|
-
//
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
// Two edges crossing (each strictly through the other)
|
|
14
|
+
function crosses([p, q], [r, s]) {
|
|
15
|
+
const d1 = (s[0] - r[0]) * (p[1] - r[1]) - (s[1] - r[1]) * (p[0] - r[0]), d2 = (s[0] - r[0]) * (q[1] - r[1]) - (s[1] - r[1]) * (q[0] - r[0]);
|
|
16
|
+
const d3 = (q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0]), d4 = (q[0] - p[0]) * (s[1] - p[1]) - (q[1] - p[1]) * (s[0] - p[0]);
|
|
17
|
+
return d1 * d2 < 0 && d3 * d4 < 0;
|
|
18
|
+
}
|
|
19
|
+
// A set of edges filed in square cells of side h, so each edge of the other set is tested only against those near it
|
|
20
|
+
// (a pinion close in a ring meets it round much of its turn, and every edge against every edge is slow)
|
|
21
|
+
function filed(A, h) {
|
|
22
|
+
const cells = new Map();
|
|
23
|
+
for (const e of A) {
|
|
24
|
+
const [p, q] = e;
|
|
25
|
+
for (let i = Math.floor(Math.min(p[0], q[0]) / h); i <= Math.floor(Math.max(p[0], q[0]) / h); i++) {
|
|
26
|
+
for (let j = Math.floor(Math.min(p[1], q[1]) / h); j <= Math.floor(Math.max(p[1], q[1]) / h); j++) {
|
|
27
|
+
const k = i * 65536 + j, list = cells.get(k);
|
|
28
|
+
if (list) list.push(e); else cells.set(k, [e]);
|
|
29
|
+
}
|
|
20
30
|
}
|
|
21
31
|
}
|
|
22
|
-
return
|
|
32
|
+
return (B) => {
|
|
33
|
+
for (const e of B) {
|
|
34
|
+
const [r, s] = e;
|
|
35
|
+
for (let i = Math.floor(Math.min(r[0], s[0]) / h); i <= Math.floor(Math.max(r[0], s[0]) / h); i++) {
|
|
36
|
+
for (let j = Math.floor(Math.min(r[1], s[1]) / h); j <= Math.floor(Math.max(r[1], s[1]) / h); j++) {
|
|
37
|
+
const list = cells.get(i * 65536 + j);
|
|
38
|
+
if (list) for (const d of list) if (crosses(d, e)) return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
};
|
|
23
44
|
}
|
|
24
45
|
const turn = (pts, a, [cx, cy] = [0, 0], [dx, dy] = [0, 0]) => { const c = Math.cos(a), s = Math.sin(a); return pts.map(([x, y]) => [x * c - y * s + cx + dx, x * s + y * c + cy + dy]); };
|
|
25
|
-
// Only the loop's edges
|
|
26
|
-
const
|
|
46
|
+
// Only the loop's edges with an end where the mate's teeth can reach (the rest never meet)
|
|
47
|
+
const edgesWhere = (pts, by) => { const out = []; for (let i = 0; i < pts.length; i++) { const p = pts[i], q = pts[(i + 1) % pts.length]; if (by(p) || by(q)) out.push([p, q]); } return out; };
|
|
27
48
|
|
|
28
49
|
/**
|
|
29
50
|
* The mesh of a pair as drawn: backlash, transmission error and interference across one pitch of the driver.
|
|
@@ -41,39 +62,51 @@ export function contact(a, b, { centre, steps = 24 } = {}) {
|
|
|
41
62
|
const per = kind === 'rack' ? (Math.PI * ga.pitch) / 360 : m.ratio, r2 = kind === 'rack' ? null : gb.pitch / 2;
|
|
42
63
|
const base = kind === 'rack' ? rackPhase(ga, 0) : phase(ga, gb, kind === 'internal' ? 180 : 0);
|
|
43
64
|
const O2 = kind === 'internal' ? [-c, 0] : kind === 'rack' ? null : [c, 0];
|
|
44
|
-
|
|
65
|
+
// Where the teeth can meet: the driver's edges inside the driven's tip circle (outside it, for a ring; under the
|
|
66
|
+
// rack's tip line), the driven's inside the driver's tip circle, each with a little to spare for the edges' length.
|
|
67
|
+
// (It was once a circle of 3.5 modules round the pitch point, which missed a pinion fouling its ring further round.)
|
|
68
|
+
const O1 = kind === 'rack' ? [0, c] : [0, 0], spare = 0.25 * mod, ra1 = ga.tip / 2 + spare;
|
|
69
|
+
const d2 = ([x, y], [px, py]) => (x - px) ** 2 + (y - py) ** 2;
|
|
70
|
+
const inDriven = kind === 'rack' ? ([, y]) => y < gb.tipLine + spare
|
|
71
|
+
: kind === 'internal' ? (p) => d2(p, O2) > (gb.tip / 2 - spare) ** 2
|
|
72
|
+
: (p) => d2(p, O2) < (gb.tip / 2 + spare) ** 2;
|
|
73
|
+
const inDriver = (p) => d2(p, O1) < ra1 * ra1, cell = 0.5 * mod;
|
|
45
74
|
const drivenAt = (deg, nudge) => kind === 'rack'
|
|
46
75
|
? B.map(([x, y]) => [x + per * deg + base + nudge - Math.PI * mod * Math.round(gb.teeth / 2), y]) // the rack under the pinion, its middle under the pitch point
|
|
47
76
|
: turn(B, (m.ratio * deg + base + nudge) * DEG, O2);
|
|
48
|
-
const driverAt = (deg) => turn(A, deg * DEG,
|
|
77
|
+
const driverAt = (deg) => turn(A, deg * DEG, O1);
|
|
49
78
|
// the turn (degrees, or mm for a rack) each way from the ratio's place to where the outlines first meet
|
|
50
79
|
const span = kind === 'rack' ? Math.PI * mod / 2 : 180 / gb.teeth;
|
|
51
80
|
const meet = (deg, dir) => {
|
|
52
|
-
const D =
|
|
53
|
-
if (!
|
|
81
|
+
const D = filed(edgesWhere(driverAt(deg), inDriven), cell), hits = (x) => D(edgesWhere(drivenAt(deg, dir * x), inDriver));
|
|
82
|
+
if (!hits(span)) return Infinity;
|
|
54
83
|
let lo = 0, hi = span;
|
|
55
|
-
for (let i = 0; i < 40; i++) { const mid = (lo + hi) / 2; if (
|
|
84
|
+
for (let i = 0; i < 40; i++) { const mid = (lo + hi) / 2; if (hits(mid)) hi = mid; else lo = mid; }
|
|
56
85
|
return lo;
|
|
57
86
|
};
|
|
58
87
|
const rows = [];
|
|
59
88
|
for (let i = 0; i < steps; i++) {
|
|
60
|
-
const deg = (i * 360) / ga.teeth / steps, D =
|
|
61
|
-
const clash =
|
|
89
|
+
const deg = (i * 360) / ga.teeth / steps, D = filed(edgesWhere(driverAt(deg), inDriven), cell);
|
|
90
|
+
const clash = D(edgesWhere(drivenAt(deg, 0), inDriver));
|
|
62
91
|
if (clash) { rows.push({ angle: deg, interferes: true }); continue; }
|
|
63
92
|
// the driven pushed on (it lags until its flank meets the driver's: the driver turning +, the driven its way)
|
|
64
93
|
const ahead = meet(deg, Math.sign(per)), behind = meet(deg, -Math.sign(per));
|
|
94
|
+
// half a tooth either way and nothing met: no tooth is there to push (or to hold it back)
|
|
95
|
+
if (!Number.isFinite(ahead) || !Number.isFinite(behind)) { rows.push({ angle: deg, apart: true }); continue; }
|
|
65
96
|
const toMm = (x) => (kind === 'rack' ? x : x * DEG * r2);
|
|
66
97
|
rows.push({ angle: deg, backlash: toMm(ahead + behind), error: toMm(behind) });
|
|
67
98
|
}
|
|
68
99
|
const out = [], f = (level, text, code, values) => out.push({ level, text, code, ...(values ? { values } : {}) });
|
|
69
|
-
const bad = rows.filter((x) => x.interferes);
|
|
70
|
-
const ok = rows.filter((x) => !x.interferes), bl = ok.map((x) => x.backlash), te = ok.map((x) => x.error);
|
|
71
|
-
const least = Math.min(...bl), most = Math.max(...bl), swing = te.length ? Math.max(...te) - Math.min(...te) : 0;
|
|
100
|
+
const bad = rows.filter((x) => x.interferes), apart = rows.filter((x) => x.apart);
|
|
101
|
+
const ok = rows.filter((x) => !x.interferes && !x.apart), bl = ok.map((x) => x.backlash), te = ok.map((x) => x.error);
|
|
102
|
+
const least = ok.length ? Math.min(...bl) : null, most = ok.length ? Math.max(...bl) : null, swing = te.length ? Math.max(...te) - Math.min(...te) : 0;
|
|
72
103
|
if (bad.length) f('fail', `the teeth cross where the ratio puts them at ${bad.length} of ${steps} steps (from ${fmt(bad[0].angle, 2)}° of the driver): they interfere, and jam`, 'mesh.interference', { at: bad.map((x) => x.angle) });
|
|
104
|
+
if (apart.length) f('fail', `the teeth don't touch at ${apart.length} of ${steps} steps (from ${fmt(apart[0].angle, 2)}° of the driver): turned half a tooth either way, the driven meets nothing, so at the ${fmt(c)} mm centre${centre !== undefined && Math.abs(c - m.centre) > 0.005 ? ` (${fmt(m.centre)} mm is where they mesh)` : ''} they lose contact and slip: bring the axes closer`, 'mesh.contact', { at: apart.map((x) => x.angle), centre: c });
|
|
73
105
|
if (ok.length) {
|
|
74
106
|
if (least < 0.02) f('warn', `as drawn, the play falls to ${fmt(least)} mm: printed teeth that come out a little fat will bind`, 'mesh.backlash', { least, most });
|
|
75
107
|
else f('pass', `as drawn, ${fmt(least)}${fmt(most) !== fmt(least) ? ` to ${fmt(most)}` : ''} mm of play at the pitch circle (${fmt(m.backlash)} mm reckoned)`, 'mesh.backlash', { least, most });
|
|
76
108
|
f('info', `transmission error ${fmt(swing * 1000, 0)} µm across a tooth, as drawn (outlines of ${A.length / ga.teeth} points a tooth)`, 'mesh.error', { swing });
|
|
77
109
|
}
|
|
110
|
+
// (least and most are null when no step had the teeth touching both ways)
|
|
78
111
|
return { rows, backlash: { least, most }, error: swing, reckoned: m.backlash, findings: out };
|
|
79
112
|
}
|
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
|
|
|
@@ -441,55 +443,114 @@ export function mesh(a, b, { centre, width } = {}) {
|
|
|
441
443
|
if ((a.hand === b.hand) !== same) f('fail', `both are ${a.hand}-handed: ${same ? `a pinion and its ${b.kind === 'rack' ? 'rack' : 'ring'} are of the same hand` : 'outer gears that mesh are of opposite hands'}`, 'mesh.helix');
|
|
442
444
|
if (!!a.herringbone !== !!b.herringbone) f('fail', 'a herringbone meshes only with a herringbone', 'mesh.helix');
|
|
443
445
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
+
if (centre !== undefined && !isNum(centre)) throw new Error(`mesh: centre is a distance in mm (got ${shown(centre)})`);
|
|
447
|
+
const ra1 = a.tip / 2, rb1 = a.base / 2, r1 = a.pitch / 2, rf1 = a.root / 2;
|
|
448
|
+
let need, ratio, aw = al;
|
|
446
449
|
if (b.kind === 'external') {
|
|
447
450
|
aw = working(al, a.shift + b.shift, a.teeth + b.teeth);
|
|
448
451
|
need = ((a.teeth + b.teeth) * m * Math.cos(al)) / (2 * Math.cos(aw));
|
|
449
452
|
ratio = -a.teeth / b.teeth;
|
|
450
|
-
contact = (Math.sqrt(ra1 ** 2 - rb1 ** 2) + Math.sqrt((b.tip / 2) ** 2 - (b.base / 2) ** 2) - need * Math.sin(aw)) / pb;
|
|
451
453
|
} else if (b.kind === 'internal') {
|
|
452
454
|
if (b.teeth <= a.teeth) throw new Error(`mesh: a ring of ${b.teeth} teeth can't hold a pinion of ${a.teeth}`);
|
|
453
455
|
aw = working(al, b.shift - a.shift, b.teeth - a.teeth);
|
|
454
456
|
need = ((b.teeth - a.teeth) * m * Math.cos(al)) / (2 * Math.cos(aw));
|
|
455
457
|
ratio = a.teeth / b.teeth;
|
|
456
|
-
const rb2 = b.base / 2, ra2 = Math.max(b.tip / 2, rb2); // (a ring's tip under its base circle doesn't roll)
|
|
457
|
-
contact = (Math.sqrt(ra1 ** 2 - rb1 ** 2) - Math.sqrt(ra2 ** 2 - rb2 ** 2) + need * Math.sin(aw)) / pb;
|
|
458
|
-
const gap = b.teeth - a.teeth;
|
|
459
|
-
// Rule of thumb (KHK, Gear Technical Reference, internal gears): with full-depth 20° teeth and no shift, a ring
|
|
460
|
-
// under about 10 teeth more than its pinion fouls it (involute or trochoid interference); 12 is the safe side
|
|
461
|
-
if (gap < 10) f('fail', `the ring has ${gap} teeth more than its pinion: under 10, their tips foul each other (interference); more teeth on the ring, or fewer on the pinion`, 'mesh.interference', { gap });
|
|
462
|
-
else if (gap < 12) f('warn', `the ring has ${gap} teeth more than its pinion: near the limit of 10 where tips foul; check it by contact`, 'mesh.interference', { gap });
|
|
463
458
|
} else { // a rack
|
|
464
459
|
need = r1 + a.shift * m; // the pinion's centre above the rack's pitch line
|
|
465
460
|
ratio = Math.PI * a.pitch; // mm a turn
|
|
466
|
-
contact = (Math.sqrt(ra1 ** 2 - rb1 ** 2) - r1 * Math.sin(al) + (m * (b.rack.addendum - a.shift)) / Math.sin(al)) / pb;
|
|
467
461
|
}
|
|
462
|
+
// Everything from here is judged where the axes are: at the centre given, or else at the one they need. Apart from
|
|
463
|
+
// their nominal place the gears roll on new pitch circles at a new working pressure angle, cos αw = (rb1 ± rb2) / a
|
|
464
|
+
// (the line of action stays tangent to both base circles), and the path of contact, cut by the two tip circles,
|
|
465
|
+
// shortens: a 20 and 40 tooth pair at module 1 has a contact ratio of 1.63 at its 30 mm and 0.74 at 31 mm. (A rack's
|
|
466
|
+
// flanks keep their slope: moving the pinion off it shortens the rack's share of the path instead.)
|
|
467
|
+
const at = centre ?? need, given = centre !== undefined && Math.abs(centre - need) > 0.005;
|
|
468
|
+
let awAt = al, path;
|
|
469
|
+
// (two outer gears closer than their base circles' radii together, or axes at or past each other, can't roll at all)
|
|
470
|
+
const crowded = !(at > 0) || (b.kind === 'external' && at < rb1 + b.base / 2);
|
|
471
|
+
if (b.kind === 'external') {
|
|
472
|
+
awAt = Math.acos(Math.min(1, (rb1 + b.base / 2) / at));
|
|
473
|
+
path = Math.sqrt(ra1 ** 2 - rb1 ** 2) + Math.sqrt((b.tip / 2) ** 2 - (b.base / 2) ** 2) - at * Math.sin(awAt);
|
|
474
|
+
} else if (b.kind === 'internal') {
|
|
475
|
+
const rb2 = b.base / 2, ra2 = Math.max(b.tip / 2, rb2); // (a ring's tip under its base circle doesn't roll)
|
|
476
|
+
awAt = Math.acos(Math.min(1, (rb2 - rb1) / at));
|
|
477
|
+
path = Math.sqrt(ra1 ** 2 - rb1 ** 2) - Math.sqrt(ra2 ** 2 - rb2 ** 2) + at * Math.sin(awAt);
|
|
478
|
+
} else {
|
|
479
|
+
path = Math.sqrt(ra1 ** 2 - rb1 ** 2) - r1 * Math.sin(al) + (m * b.rack.addendum - (at - r1)) / Math.sin(al);
|
|
480
|
+
}
|
|
481
|
+
let contact = path / pb;
|
|
468
482
|
// the overlap ratio: how far a tooth's own twist carries the contact on across the width (εβ = b tan β / π m, each
|
|
469
483
|
// half of a herringbone on its own)
|
|
470
484
|
const overlap = ha > 0 && width !== undefined ? ((a.herringbone ? width / 2 : width) * Math.tan(ha * DEG)) / (Math.PI * m) : 0;
|
|
471
485
|
if (overlap) contact += overlap;
|
|
472
486
|
const sense = b.kind === 'rack' ? `${fmt(ratio)} mm of rack a turn (${fmt(ratio / 360, 4)} mm a degree)` : `${fmt(Math.abs(ratio), 4)} turns of the second for each turn of the first (${a.teeth}:${b.teeth}), ${ratio < 0 ? 'turning opposite ways' : 'the same way'}`;
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
487
|
+
const where = given ? ` at the ${fmt(at, 3)} mm centre given (${fmt(need, 3)} mm is where they mesh as drawn)` : '';
|
|
488
|
+
// (judged on the path across the teeth: a helical's twist carries on a contact that is there, it makes none)
|
|
489
|
+
if (crowded) f('fail', `the axes are too close${where || ` at ${fmt(at, 3)} mm`}: ${at > 0 ? 'the gears\' base circles overlap, so the teeth can\'t roll on each other' : 'the distance between them has to be above 0'}, and they jam: bring the axes to ${fmt(need, 3)} mm`, 'mesh.contact', { contact, centre: at });
|
|
490
|
+
else if (!(path > 0)) f('fail', `the teeth don't reach each other${where || ` at ${fmt(at, 3)} mm`}: no pair ever takes up the drive, and the gears slip round: bring the axes to ${fmt(need, 3)} mm`, 'mesh.contact', { contact, centre: at });
|
|
491
|
+
else if (contact < 1) f('fail', `contact ratio ${fmt(contact)}${where}: under 1, a pair of teeth lets go before the next takes up, and the drive jumps: ${given && centre > need ? `bring the axes closer, to ${fmt(need, 3)} mm, or ` : ''}more teeth, or a longer addendum`, 'mesh.contact', { contact, centre: at });
|
|
492
|
+
else if (contact < 1.2) f('warn', `contact ratio ${fmt(contact)}${where}: under 1.2 the drive is rough, and a printed tooth's errors can make it jump`, 'mesh.contact', { contact, centre: at });
|
|
493
|
+
else f('pass', `contact ratio ${fmt(contact)}${overlap ? ` (${fmt(contact - overlap)} across the teeth and ${fmt(overlap)} along their twist)` : ''}${where}: ${fmt(contact)} pairs of teeth share the load on average`, 'mesh.contact', { contact, centre: at });
|
|
494
|
+
// The room under each tip, where the axes are: the centre distance less one gear's tip and the other's root (for a
|
|
495
|
+
// ring, its root less the pinion's far tip, and its own tips outside the pinion's roots). Profile shift pushes the
|
|
496
|
+
// tips out and the gears apart by less than it pushes the tips, so a shifted pair loses the 0.25 module it was drawn
|
|
497
|
+
// with: ISO 21771 and KHK shorten each tip by (x1 + x2 − y) modules, y being how far the shift moved the centre.
|
|
498
|
+
// The tips are drawn full, as each gear is drawn without its mate, so this says how much to take off.
|
|
499
|
+
const clear = b.kind === 'external' ? [at - ra1 - b.root / 2, at - b.tip / 2 - rf1]
|
|
500
|
+
: b.kind === 'internal' ? [b.root / 2 - at - ra1, b.tip / 2 - at - rf1]
|
|
501
|
+
: [at - ra1 - b.rootLine, at - rf1 - b.tipLine];
|
|
502
|
+
const least = Math.min(...clear), drawn = m * (a.rack.dedendum - a.rack.addendum), names = ['the first gear\'s tips', `the ${b.kind === 'internal' ? 'ring' : b.kind === 'rack' ? 'rack' : 'second gear'}'s tips`];
|
|
503
|
+
// The shortening is reckoned where the gears belong: axes set tighter than that (outer gears or a rack closer, a
|
|
504
|
+
// pinion further out in its ring) want moving back, not shorter tips; at a looser centre, the room there
|
|
505
|
+
const tighter = (b.kind === 'internal' ? at - need : need - at) > 0.005, room = tighter ? clear.map((x) => x + Math.abs(need - at)) : clear;
|
|
506
|
+
const addenda = [a.rack.addendum, b.rack.addendum], short = room.map((x) => Math.max(0, drawn - x) / m), cut = short.map((k, i) => +(addenda[i] - k).toFixed(3));
|
|
507
|
+
const shorten = short.some((k) => k > 1e-3) ? `shorten ${short.every((k) => k > 1e-3) ? 'both gears\' tips' : names[short[0] > 1e-3 ? 0 : 1]} to give back the ${fmt(drawn, 3)} mm of room they were drawn with (${short.map((k, i) => (k > 1e-3 ? `addendum: ${cut[i]} on ${i ? 'the second' : 'the first'}` : '')).filter(Boolean).join(', ')}), or less profile shift` : '';
|
|
508
|
+
const advice = tighter ? `${b.kind === 'internal' ? `bring the pinion's axis to ${fmt(need, 3)} mm from the ring's` : b.kind === 'rack' ? `lift the pinion's axis to ${fmt(need, 3)} mm from the rack's pitch line` : `move the axes apart, to ${fmt(need, 3)} mm`}${shorten ? `, and ${shorten}` : ''}` : shorten || 'less profile shift';
|
|
509
|
+
const worst = names[clear[0] <= clear[1] ? 0 : 1];
|
|
510
|
+
if (least < 0) f('fail', `${worst} reach ${fmt(-least, 3)} mm into the mate's roots${where || ` at ${fmt(at, 3)} mm`}: the teeth jam: ${advice}`, 'mesh.tipClearance', { clearance: least, centre: at, addendum: cut });
|
|
511
|
+
else if (least < 0.1 * m) f('warn', `${fmt(least, 3)} mm of room under ${worst}${where} (drawn with ${fmt(drawn, 3)}): a print that comes out a little fat rubs there: ${advice}`, 'mesh.tipClearance', { clearance: least, centre: at, addendum: cut });
|
|
512
|
+
else f('pass', `${fmt(least, 3)} mm of room under the tips${where}`, 'mesh.tipClearance', { clearance: least, centre: at, addendum: cut });
|
|
513
|
+
if (b.kind === 'internal') {
|
|
514
|
+
// A pinion in a ring: as a pinion tooth leaves the ring's space its tip swings out past the ring tooth's corner
|
|
515
|
+
// (trochoid interference). KHK's condition (Gear Technical Reference, internal gears), which honours shift and the
|
|
516
|
+
// centre: θ1 z1/z2 + inv αw − inv αa2 ≥ θ2, with θ1 = acos((ra2² − ra1² − a²) / 2a ra1) + inv αa1 − inv αw and
|
|
517
|
+
// θ2 = acos((a² + ra2² − ra1²) / 2a ra2), in radians of the ring's turn. It replaces the rule of thumb that a ring
|
|
518
|
+
// needs 10 teeth more than its pinion, which failed rings that clear (20 in 28) and passed shifted ones that don't.
|
|
519
|
+
// KHK's other condition, involute interference, assumes a cutter's root under the pinion's base circle; the kit's
|
|
520
|
+
// flanks run straight in there, and contact() tests the outlines as drawn.
|
|
521
|
+
const ra2 = b.tip / 2, rb2 = b.base / 2, z = a.teeth / b.teeth;
|
|
522
|
+
const k1 = (ra2 ** 2 - ra1 ** 2 - at ** 2) / (2 * at * ra1), k2 = (at ** 2 + ra2 ** 2 - ra1 ** 2) / (2 * at * ra2);
|
|
523
|
+
if (Math.abs(k1) <= 1 && Math.abs(k2) <= 1) {
|
|
524
|
+
const aa1 = Math.acos(rb1 / ra1), aa2 = Math.acos(rb2 / Math.max(ra2, rb2));
|
|
525
|
+
const t1 = Math.acos(k1) + inv(aa1) - inv(awAt), t2 = Math.acos(k2);
|
|
526
|
+
const margin = t1 * z + inv(awAt) - inv(aa2) - t2;
|
|
527
|
+
// each tooth's share of the backlash on one flank (a quarter of each gear's), as the same angle of the ring
|
|
528
|
+
const play = (a.backlash / 4 / r1) * z + b.backlash / 4 / (b.pitch / 2), mm = (x) => fmt(x * (b.pitch / 2), 3);
|
|
529
|
+
const gap = b.teeth - a.teeth, values = { gap, margin: margin * (b.pitch / 2), play: play * (b.pitch / 2) };
|
|
530
|
+
if (margin + play < 0) f('fail', `the pinion's tips foul the ring's as they leave (${mm(-(margin + play))} mm of overlap at the ring's pitch circle, with the backlash${where}): a ring of ${gap} teeth more than its pinion is too close for these teeth: more teeth on the ring, fewer on the pinion, or shift the ring out (a positive shift)`, 'mesh.interference', values);
|
|
531
|
+
else if (margin < 0) f('warn', `the pinion's tips clear the ring's as they leave by the backlash alone (${mm(margin + play)} mm at the ring's pitch circle${where}): teeth that print a little fat foul; check the pair with contact()`, 'mesh.interference', values);
|
|
532
|
+
else f('pass', `the pinion's tips clear the ring's as they leave, by ${mm(margin)} mm at the ring's pitch circle with no backlash`, 'mesh.interference', values);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
476
535
|
let backlash = a.backlash / 2 + b.backlash / 2;
|
|
477
536
|
if (centre !== undefined) {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
537
|
+
// how much looser than they need: further apart for outer gears and a rack; for a pinion in a ring, nearer the
|
|
538
|
+
// ring's centre, as moving it out pushes its teeth into the ring's
|
|
539
|
+
const ring = b.kind === 'internal', off = (ring ? -1 : 1) * (centre - need), by = fmt(Math.abs(centre - need), 3);
|
|
540
|
+
const tight = ring ? `the pinion's axis is ${by} mm further from the ring's than these gears need (${fmt(need, 3)} mm)` : `the axes are ${by} mm closer than these gears need (${fmt(need, 3)} mm${b.kind === 'rack' ? ', centre to the rack\'s pitch line' : ''})`;
|
|
541
|
+
const loose = ring ? `the pinion's axis is ${by} mm nearer the ring's than these gears need (${fmt(need, 3)} mm)` : `the axes are ${by} mm further apart than these gears need (${fmt(need, 3)} mm)`;
|
|
542
|
+
// looser opens a gap along the line of action of 2 Δa sin αw, which is 2 Δa tan αw round the pitch circle
|
|
481
543
|
const added = 2 * off * Math.tan(aw);
|
|
482
544
|
backlash += added;
|
|
483
|
-
//
|
|
484
|
-
// either, the teeth jam
|
|
545
|
+
// tighter eats the backlash (2 Δa tan αw of it) and the clearance under the tips (0.25 m); past either, the teeth jam
|
|
485
546
|
const tipRoom = m * (Math.min(a.rack.dedendum, b.rack?.dedendum ?? a.rack.dedendum) - Math.max(a.rack.addendum, b.rack?.addendum ?? a.rack.addendum)) + off;
|
|
486
|
-
if (backlash < 0 || tipRoom < 0) f('fail',
|
|
487
|
-
else if (off < -0.005 && backlash < 0.05) f('warn',
|
|
488
|
-
else if (backlash > 0.4) f('warn',
|
|
489
|
-
else f('pass', `centre distance ${fmt(centre, 3)} mm, ${Math.abs(
|
|
547
|
+
if (backlash < 0 || tipRoom < 0) f('fail', `${tight}: ${backlash < 0 ? `more than their ${fmt(a.backlash / 2 + b.backlash / 2, 2)} mm of backlash allows` : 'the tips reach the roots'}, and the teeth jam`, 'mesh.centre', { centre, need });
|
|
548
|
+
else if (off < -0.005 && backlash < 0.05) f('warn', `${tight}: ${fmt(backlash, 3)} mm of play left, tight enough to bind as printed`, 'mesh.centre', { centre, need });
|
|
549
|
+
else if (backlash > 0.4) f('warn', `${loose}: ${fmt(backlash, 2)} mm of backlash, loose enough to knock`, 'mesh.centre', { centre, need });
|
|
550
|
+
else f('pass', `centre distance ${fmt(centre, 3)} mm, ${Math.abs(centre - need) > 0.005 ? `${by} mm ${centre > need ? 'further apart' : 'closer'} than the ${fmt(need, 3)} they need` : 'as they need'}: ${fmt(backlash, 2)} mm of backlash`, 'mesh.centre', { centre, need });
|
|
490
551
|
}
|
|
491
552
|
const thrust = a.herringbone || !ha ? 0 : Math.tan(ha * DEG);
|
|
492
|
-
return { kind: b.kind, centre: need, ratio, contact, overlap, thrust, pressureAngle:
|
|
553
|
+
return { kind: b.kind, centre: need, ratio, contact, overlap, thrust, pressureAngle: awAt / DEG, clearance: least, backlash, text: sense, findings: out };
|
|
493
554
|
}
|
|
494
555
|
const flip = (r) => ({ ...r, ratio: r.kind === 'rack' ? r.ratio : 1 / r.ratio });
|
|
495
556
|
const fmt = (x, d = 2) => String(+x.toFixed(d));
|
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.5",
|
|
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": {
|
|
@@ -14,23 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"planetary.mjs",
|
|
20
|
-
"contact.mjs",
|
|
21
|
-
"tooth.mjs",
|
|
22
|
-
"worm.mjs",
|
|
23
|
-
"diagram.mjs",
|
|
24
|
-
"gears.d.mts",
|
|
25
|
-
"core.d.mts",
|
|
26
|
-
"planetary.d.mts",
|
|
27
|
-
"contact.d.mts",
|
|
28
|
-
"tooth.d.mts",
|
|
29
|
-
"worm.d.mts",
|
|
30
|
-
"diagram.d.mts",
|
|
17
|
+
"*.mjs",
|
|
18
|
+
"*.d.mts",
|
|
31
19
|
"README.md",
|
|
32
20
|
"CHANGELOG.md",
|
|
33
|
-
"LICENSE"
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"!test.mjs"
|
|
34
23
|
],
|
|
35
24
|
"license": "MIT",
|
|
36
25
|
"keywords": [
|
|
@@ -62,6 +51,6 @@
|
|
|
62
51
|
},
|
|
63
52
|
"types": "./gears.d.mts",
|
|
64
53
|
"dependencies": {
|
|
65
|
-
"@rulecad/fea": "^0.
|
|
54
|
+
"@rulecad/fea": "^0.3.0"
|
|
66
55
|
}
|
|
67
56
|
}
|
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
|
}
|