@rulecad/gears 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -153,6 +153,12 @@ strongest. Every tooth has a round at its root (the commonest place a tooth crac
153
153
  The defaults, each with its rule, are in `DEFAULTS`. The backlash, the chamfer, the tip round and the smallest module
154
154
  are estimates until a printed sampler measures them.
155
155
 
156
+ ## How much gets through
157
+
158
+ `stageEfficiency(kind)` is the share of the power a stage passes on: 0.95 per mesh for printed teeth (an estimate,
159
+ `DEFAULTS.efficiency`), so a planetary's two meshes pass 0.9. A worm's comes from its lead angle and friction
160
+ (`stageEfficiency('worm', { worm: wormModel(…) })`). Give your own figure with `{ efficiency }`.
161
+
156
162
  ## How strong it is
157
163
 
158
164
  `strength(model, { width, material, torque?, safety?, speed? })` reads the teeth by the Lewis equation: the bending
package/gears.d.mts CHANGED
@@ -170,6 +170,19 @@ export function printable(g: GearModel, printer: {
170
170
  nozzle?: number;
171
171
  wall_min?: number;
172
172
  }, width?: number): any[];
173
+ /**
174
+ * How much of the power a stage passes on: DEFAULTS.efficiency per mesh a tooth force goes through. A planetary's
175
+ * goes through two (sun to planet, planet to ring); a worm's is its own, from its lead angle and friction.
176
+ * @param {'spur' | 'helical' | 'herringbone' | 'rack' | 'internal' | 'bevel' | 'planetary' | 'worm'} kind
177
+ * @param {{ efficiency?: number, worm?: { efficiency: number } }} [o] efficiency: your measured figure per mesh
178
+ * @returns {number} from 0 to 1
179
+ */
180
+ export function stageEfficiency(kind: "spur" | "helical" | "herringbone" | "rack" | "internal" | "bevel" | "planetary" | "worm", o?: {
181
+ efficiency?: number;
182
+ worm?: {
183
+ efficiency: number;
184
+ };
185
+ }): number;
173
186
  /** The Lewis form factor Y for z teeth (20° full depth); Infinity for a rack. @param {number} z */
174
187
  export function lewisFactor(z: number): number;
175
188
  /**
package/gears.mjs CHANGED
@@ -27,6 +27,7 @@ export const DEFAULTS = {
27
27
  tipRound: { value: 0.1, unit: '× module', rule: 'A tip a printer can draw: rounded about a quarter line at module 1, so no corner is left to the slicer', kind: 'estimate' },
28
28
  backlash: { value: 0.15, unit: 'mm', rule: 'Play between mating teeth, split between the two: FDM gear guides give 0.1 to 0.2 mm; measure it with the sampler plate', kind: 'estimate' },
29
29
  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' },
30
+ 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' },
30
31
  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' },
31
32
  };
32
33
  const D = (k) => DEFAULTS[k].value;
@@ -556,6 +557,22 @@ export function printable(g, printer, width) {
556
557
  }
557
558
 
558
559
  // Planetary gearboxes: the teeth for a ratio, laid out in phase
560
+ /**
561
+ * How much of the power a stage passes on: DEFAULTS.efficiency per mesh a tooth force goes through. A planetary's
562
+ * goes through two (sun to planet, planet to ring); a worm's is its own, from its lead angle and friction.
563
+ * @param {'spur' | 'helical' | 'herringbone' | 'rack' | 'internal' | 'bevel' | 'planetary' | 'worm'} kind
564
+ * @param {{ efficiency?: number, worm?: { efficiency: number } }} [o] efficiency: your measured figure per mesh
565
+ * @returns {number} from 0 to 1
566
+ */
567
+ export function stageEfficiency(kind, o = {}) {
568
+ const each = o.efficiency ?? D('efficiency');
569
+ if (!(typeof each === 'number' && each > 0 && each <= 1)) throw new Error(`stageEfficiency: efficiency is from 0 to 1 (got ${shown(o.efficiency)})`);
570
+ if (kind === 'worm') { if (!o.worm || !(o.worm.efficiency > 0)) throw new Error('stageEfficiency: a worm needs its model ({ worm: wormModel(…) }), for its lead angle and friction'); return o.worm.efficiency; }
571
+ if (['spur', 'helical', 'herringbone', 'rack', 'internal', 'bevel'].includes(kind)) return each;
572
+ if (kind === 'planetary') return each ** 2;
573
+ throw new Error(`stageEfficiency: no kind of stage ${shown(kind)} (spur, helical, herringbone, rack, internal, bevel, planetary or worm)`);
574
+ }
575
+
559
576
  export { planetary, planetaryRatio } from './planetary.mjs';
560
577
  // The mesh measured from the drawn teeth: backlash, transmission error, interference
561
578
  export { contact } from './contact.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/gears",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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": {