formulab 0.13.8 → 0.14.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/CHANGELOG.md CHANGED
@@ -5,6 +5,101 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.14.1] - 2026-07-06
9
+
10
+ ### Fixed
11
+
12
+ - **`quality/gageRR()` — `status` now also considers `%GRR`-of-tolerance when a `tolerance`
13
+ is supplied.** Previously `status` was classified from `percentGRR` (the process-control
14
+ criterion, %GRR of Total Variation) alone, so a measurement system with excellent %GRR but
15
+ a tolerance far narrower than the part-to-part variation could report `'acceptable'` while
16
+ `percentTolerance` (the product-acceptance criterion) sat well above 30%. `status` is now
17
+ `worse(byPercentGRR, byPercentTolerance)` — AIAG MSA 4th Ed.'s ≤10/≤30 bands applied to
18
+ both criteria — falling back to `byPercentGRR` alone when no tolerance is given (unchanged
19
+ behavior). Reported via dogfooding (online-tools `quality/gage-rr`, ISSUE-20260705).
20
+
21
+ ## [0.14.0] - 2026-07-05
22
+
23
+ ### Changed (breaking within 0.x) — standard-table conformance sweep
24
+
25
+ Four independently transcribed lookup tables were found to diverge from their cited
26
+ standards (origin: upstream-006, forge-fmea). Each was re-verified cell-by-cell against
27
+ the standard or a cell-complete reproduction; all changes move outputs **toward the
28
+ published standard**, and every fix ships with cell-level golden tests.
29
+
30
+ - **`quality/actionPriority()` — AIAG-VDA 2019 AP table conformance** (upstream-006):
31
+ - Occurrence bands were a copy of the severity bands (`4-6/7-8/9-10`); corrected to the
32
+ handbook's `4-5/6-7/8-10`. Detection bands corrected from five bands to the handbook's
33
+ four (`1/2-4/5-6/7-10`) — **`detectionGroup` in the result now ranges 0–3 (was 0–4)**
34
+ and `occurrenceGroup` boundaries moved.
35
+ - The S=1 row is now all-L and the O=1 rows all-L per the handbook (e.g.
36
+ `{S:1, O:10, D:10}` returned `'H'`, now `'L'`). Boundary verdicts moved at O=5/6, O=7/8
37
+ and D=6/7 splits.
38
+ - Verification: Relyence FMEA user-guide reproduction of the handbook table (cell-complete,
39
+ re-extracted twice) + structural invariants; handbook hardcopy not consulted — flagged
40
+ for anyone with 1st-edition access to spot-audit.
41
+ - **`safety/ergonomicRisk()` (REBA) — Tables A/B re-transcribed from the published REBA
42
+ worksheet** (Hignett & McAtamney 2000 / Hedge worksheet): 14 of 15 Table A rows and 10 of
43
+ 12 Table B rows were a smoothed monotone pattern, not the published values (Table A even
44
+ reached 12; the standard caps at 9; the irregular cells `N3/T1 = 3,3,5,6` and the
45
+ duplicated `N1/N2` Trunk-1 rows were missing). Table C, load score, risk levels were
46
+ already correct. Trunk extension now caps at 3 and upper-arm extension at 2 per the
47
+ worksheet zones (previously |angle| symmetric).
48
+ - **`safety/nioshLifting()` — FM/CM tables conformed to NIOSH 94-110 Tables 5 & 7**:
49
+ - CM for fair coupling was inverted (`V<75: 1.0, V≥75: 0.95`; the manual says
50
+ `V<75: 0.95, V≥75: 1.00`) — and the prior test pinned the inverted value while citing
51
+ Table 7.
52
+ - FM now carries the manual's V<75/V≥75 columns: at high frequencies with V<75cm the
53
+ published FM is 0.00 (→ `rwl: 0`, `liftingIndex: Infinity`, the documented sentinel);
54
+ previously the more permissive V≥75 column was used everywhere. Invented FM values that
55
+ do not exist in Table 5 were removed (medium-duration F13-15 `0.19/0.17/0.15` → 0, long
56
+ F11-12 `0.11/0.10` → 0), and frequency >15 lifts/min now yields FM 0 (was clamped to the
57
+ F=15 value). All changes are conservative (lower or equal RWL).
58
+ - **`quality/aql()` — re-transcribed from ISO 2859-1:1999 Tables 1 & 2-A** (scanned table
59
+ images from the published standard, cell-by-cell):
60
+ - Table 1: the S-1/S-2/S-3 code-letter columns promoted one lot-size band late in many
61
+ rows (e.g. lot 281–500 at S-1 is code **B**, not A). S-4 and general levels I/II/III
62
+ were already correct.
63
+ - Table 2-A: nearly every Ac/Re pair sat one ladder step too permissive — an off-by-one
64
+ introduced by omitting the standard's 0.15 AQL column (e.g. code J at AQL 6.5 accepted
65
+ on 14 nonconforming; the standard accepts on 10). The 0.15 AQL level is now supported.
66
+ The fixed-sample-size simplification of arrow cells is unchanged and now documented in
67
+ the JSDoc.
68
+
69
+ - **`environmental/gwpCalculator()` — six cells conformed to IPCC AR6 Table 7.SM.7**
70
+ (verified against the published supplementary table itself): the whole SF6 row was
71
+ computed with the superseded 3,200-year lifetime — AR6 assesses 1,000 years — so
72
+ `18,300/25,200/34,100` → **`18,200/24,300/29,000`** (GWP20/100/500); NF3 GWP500
73
+ `20,700` → **`18,200`**; HFC-152a GWP500 `44` → **`46.8`**; CH4 GWP500 `7.6` (AR4
74
+ leftover) → **`10.0`** (AR6 fossil methane, consistent with the fossil 20/100-year
75
+ values already used). GWP100 additionally cross-checked against the GHG Protocol AR6
76
+ GWP tables v2.0. The JSDoc now states the CH4 row uses AR6 *fossil* methane values,
77
+ and Table 7.SM.7 golden tests pin the corrected cells.
78
+ - **`safety/nioshLifting()` — outputs now pass through `roundTo`** per the library-wide
79
+ convention (README "Floating-Point Handling"): `rwl`/`liftingIndex` to 2 decimals,
80
+ computed multipliers (`hm`/`vm`/`dm`/`am`) to 4. `riskLevel` is classified from the
81
+ rounded `liftingIndex` so the returned index and level always agree. The
82
+ `liftingIndex = Infinity` sentinel is unaffected (`roundTo` passes it through).
83
+
84
+ ### Added
85
+
86
+ - **`quality`: AP matrix exported for consumers** (upstream-006 feature request) —
87
+ `AP_TABLE` (`[severityGroup][occurrenceGroup][detectionGroup]`, deep-readonly) and
88
+ `AP_SEVERITY_BANDS` / `AP_OCCURRENCE_BANDS` / `AP_DETECTION_BANDS`
89
+ (`ApRatingBand { min, max }[]`, index = group), so matrix visualizations don't need a
90
+ locally duplicated table.
91
+ - **`safety/ergonomicRisk()`: REBA Step 11 coupling** — optional
92
+ `coupling?: 'good' | 'fair' | 'poor' | 'unacceptable'` input (+0…+3 to Score B, default
93
+ `'good'` preserves existing calls) and `couplingScore` in the result.
94
+
95
+ ### Docs
96
+
97
+ - README: function tables and domain counts synced to the actual exports (217 functions;
98
+ `actionPriority`/`cpkToOccurrence`/`nelsonRules` rows and the whole Industrial
99
+ Engineering section were missing); ERRORS.md quality rows completed; CLAUDE.md now
100
+ prescribes lookup-table transcription discipline (cell-level golden tests, irregular-cell
101
+ pins, invariant tests).
102
+
8
103
  ## [0.13.8] - 2026-06-21
9
104
 
10
105
  ### Fixed
package/README.md CHANGED
@@ -11,32 +11,33 @@ A comprehensive collection of engineering formulas and calculations for manufact
11
11
 
12
12
  ## Features
13
13
 
14
- - **174 industrial calculations + 8 type guards** — OEE, Cpk, SPC control charts, Gage R&R, Weibull, metal weight, CNC machining, GD&T, pipe flow, CBM, NIOSH lifting, PMV/PPD, arc flash, battery SOH, GHG emissions, PID tuning, and more
15
- - **14 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility, Battery, Environmental, Machining
14
+ - **209 industrial calculations + 8 type guards** — OEE, Cpk, SPC control charts, Gage R&R, Weibull, metal weight, CNC machining, GD&T, pipe flow, CBM, NIOSH lifting, PMV/PPD, arc flash, battery SOH, GHG emissions, PID tuning, and more
15
+ - **15 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility, Battery, Environmental, Machining, Industrial Engineering
16
16
  - **Zero dependencies** — Lightweight and fast
17
17
  - **TypeScript first** — Full type definitions included
18
18
  - **Tree-shakeable** — Import only what you need
19
- - **2,494 tests** — Coverage thresholds: 90% lines, 95% functions, 85% branches ([CI pipeline](https://github.com/iyulab/formulab/actions/workflows/ci.yml))
19
+ - **2,779 tests** — Coverage thresholds: 90% lines, 95% functions, 85% branches ([CI pipeline](https://github.com/iyulab/formulab/actions/workflows/ci.yml))
20
20
  - **Research-based** — Golden reference tests verified against NIOSH 94-110, AIAG/ASTM E2587, JIPM, ASME B16.5, ISO 22514-2, and more
21
21
 
22
22
  ## Verification Status
23
23
 
24
24
  | Domain | Functions | Golden Tests | Key References |
25
25
  |--------|-----------|-------------|----------------|
26
- | Quality | 18 | oee, cpk, controlChart, gageRR | ISO 22400-2, AIAG/ASTM E2587, JIPM, AIAG MSA |
27
- | Metal | 25 | metalWeight | Machinery's Handbook, ASME B36.10/B16.5 |
26
+ | Quality | 21 | oee, cpk, controlChart, gageRR | ISO 22400-2, AIAG/ASTM E2587, JIPM, AIAG MSA |
27
+ | Metal | 34 | metalWeight | Machinery's Handbook, ASME B36.10/B16.5 |
28
28
  | Logistics | 17 | cbm | Physical formula |
29
29
  | Safety | 14 | nioshLifting | NIOSH 94-110, ISO 7730, IEEE 1584, OSHA |
30
- | Chemical | 12 | — | Darcy-Weisbach, Fourier, API 520, ISA |
31
- | Electronics | 11 | — | IPC-2221 |
32
- | Construction | 12 | — | AISC, Timoshenko |
30
+ | Chemical | 15 | — | Darcy-Weisbach, Fourier, API 520, ISA |
31
+ | Electronics | 13 | — | IPC-2221 |
32
+ | Construction | 16 | — | AISC, Timoshenko |
33
33
  | Automotive | 9 | — | AASHTO, SAE J1772 |
34
34
  | Energy | 15 | — | NREL PVWatts, ISO 50001 |
35
- | Food | 6 | — | HACCP, ICH Q1A |
36
- | Utility | 16 | — | — |
37
- | Battery | 10 | — | IEEE 1188, IEC 62620, Battery University |
35
+ | Food | 7 | — | HACCP, ICH Q1A |
36
+ | Utility | 18 | — | — |
37
+ | Battery | 11 | — | IEEE 1188, IEC 62620, Battery University |
38
38
  | Environmental | 10 | — | GHG Protocol, IPCC AR6, IEA 2023 |
39
39
  | Machining | 12 | — | Machinery's Handbook, ASME Y14.5, Sandvik Coromant |
40
+ | IE | 5 | — | MTM/MOST, Wright's learning curve |
40
41
 
41
42
  > Functions with golden reference tests have been verified against authoritative engineering sources.
42
43
  > See each function's JSDoc for specific references.
@@ -95,7 +96,7 @@ Three functions solve NP-hard combinatorial problems using **heuristic** algorit
95
96
 
96
97
  GitHub Actions runs on every push to `main` and every pull request:
97
98
 
98
- - **Matrix**: Node.js 18, 20
99
+ - **Matrix**: Node.js 20, 22
99
100
  - **Steps**: `pnpm install` → `tsc` (type check) → `vitest run --coverage`
100
101
  - **Coverage enforcement**: Fails if below thresholds (lines 90%, functions 95%, branches 85%, statements 90%)
101
102
 
@@ -157,7 +158,7 @@ console.log(volume.totalCbm); // 0.96 m³
157
158
 
158
159
  ## Domains
159
160
 
160
- ### Quality & Production (18 functions)
161
+ ### Quality & Production (21 functions)
161
162
 
162
163
  ```typescript
163
164
  import { oee, cpk, taktTime, dpmo, controlChart, gageRR, weibull } from 'formulab/quality';
@@ -183,8 +184,11 @@ import { oee, cpk, taktTime, dpmo, controlChart, gageRR, weibull } from 'formula
183
184
  | `cmk()` | Machine capability index Cm/Cmk |
184
185
  | `weibull()` | Weibull reliability analysis |
185
186
  | `paretoAnalysis()` | Pareto 80/20 ABC classification |
187
+ | `actionPriority()` | AIAG-VDA 2019 Action Priority (AP) matrix — table exported as `AP_TABLE` + `AP_*_BANDS` |
188
+ | `cpkToOccurrence()` | Cpk → FMEA occurrence rating mapping |
189
+ | `nelsonRules()` | SPC Nelson rules (8 control-chart tests) |
186
190
 
187
- ### Metal & Machining (25 functions)
191
+ ### Metal & Machining (34 functions)
188
192
 
189
193
  ```typescript
190
194
  import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
@@ -217,8 +221,15 @@ import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
217
221
  | `materialGradeConverter()` | ASTM/EN/JIS/GB/KS grade cross-reference |
218
222
  | `pipeSpec()` | ANSI/ASME pipe dimensions lookup |
219
223
  | `flangeSpec()` | ASME B16.5 flange dimensions lookup |
224
+ | `getKFactor()` | Bolt torque K-factor by lubrication condition |
225
+ | `getStandardPitch()` | ISO metric standard thread pitch lookup |
226
+ | `getCategories()` | Material category list |
227
+ | `getGrades()` | Material grades for a category |
228
+ | `getDesignations()` | Screw thread designation list |
229
+ | `getMetricSizes()` | Metric thread size list |
230
+ | `getUnifiedSizes()` | Unified (UNC/UNF) thread size list |
220
231
 
221
- ### Chemical & Process (12 functions)
232
+ ### Chemical & Process (15 functions)
222
233
 
223
234
  ```typescript
224
235
  import { dilution, concentration, ph, reactor, pipeFlow, heatTransfer, flowControl, pid } from 'formulab/chemical';
@@ -239,7 +250,7 @@ import { dilution, concentration, ph, reactor, pipeFlow, heatTransfer, flowContr
239
250
  | `reliefValve()` | Safety relief valve sizing (API 520/526) |
240
251
  | `pid()` | PID controller tuning (Z-N / Cohen-Coon) |
241
252
 
242
- ### Electronics & SMT (11 functions)
253
+ ### Electronics & SMT (13 functions)
243
254
 
244
255
  ```typescript
245
256
  import { traceWidth, solderPaste, resistorDecode, ohmsLaw } from 'formulab/electronics';
@@ -258,8 +269,9 @@ import { traceWidth, solderPaste, resistorDecode, ohmsLaw } from 'formulab/elect
258
269
  | `ledResistor()` | LED resistor calculation |
259
270
  | `stencilAperture()` | Stencil aperture design |
260
271
  | `viaCurrent()` | Via current capacity |
272
+ | `getPasteTypes()` | Available solder paste types |
261
273
 
262
- ### Construction (12 functions)
274
+ ### Construction (16 functions)
263
275
 
264
276
  ```typescript
265
277
  import { concreteMix, rebarWeight, slope, stair, momentOfInertia } from 'formulab/construction';
@@ -279,6 +291,9 @@ import { concreteMix, rebarWeight, slope, stair, momentOfInertia } from 'formula
279
291
  | `pert()` | PERT schedule analysis |
280
292
  | `roof()` | Roof calculation |
281
293
  | `stair()` | Stair dimension calculation |
294
+ | `getAggregateDensity()` | Aggregate bulk density lookup |
295
+ | `aggregateCoverage()` | Aggregate coverage area from volume and depth |
296
+ | `getRebarUnitWeight()` | Rebar unit weight lookup (D10-D51) |
282
297
 
283
298
  ### Automotive (9 functions)
284
299
 
@@ -371,7 +386,7 @@ import { nioshLifting, noiseExposure, wbgtCalculate, ventilationRate, thermalCom
371
386
  | `ventilationRate()` | Required ventilation ACH/CFM (ASHRAE/OSHA) |
372
387
  | `wbgtCalculate()` | WBGT heat stress index |
373
388
 
374
- ### Food & HACCP (6 functions)
389
+ ### Food & HACCP (7 functions)
375
390
 
376
391
  ```typescript
377
392
  import { calorie, nutrition, haccp, waterActivity, stabilityStudy } from 'formulab/food';
@@ -385,8 +400,9 @@ import { calorie, nutrition, haccp, waterActivity, stabilityStudy } from 'formul
385
400
  | `haccp()` | HACCP checklist generation |
386
401
  | `waterActivity()` | Water activity microbial risk (HACCP) |
387
402
  | `stabilityStudy()` | Accelerated stability (Arrhenius, ICH Q1A) |
403
+ | `getHaccpCategories()` | HACCP hazard category list |
388
404
 
389
- ### Utility (16 functions)
405
+ ### Utility (18 functions)
390
406
 
391
407
  ```typescript
392
408
  import { solveAssignment, calculateUnit, statistics, regression, npv } from 'formulab/utility';
@@ -411,8 +427,9 @@ import { solveAssignment, calculateUnit, statistics, regression, npv } from 'for
411
427
  | `normalize()` | Data normalization (min-max/z-score) |
412
428
  | `histogram()` | Frequency distribution histogram |
413
429
  | `weightedScore()` | Weighted scoring model |
430
+ | `getUnitsForCategory()` | Unit definitions for a conversion category |
414
431
 
415
- ### Battery (10 functions)
432
+ ### Battery (11 functions)
416
433
 
417
434
  ```typescript
418
435
  import { energyDensity, cRate, stateOfHealth, cycleLife } from 'formulab/battery';
@@ -471,6 +488,20 @@ import { truePosition, boltCircle, toolDeflection, threadOverWires } from 'formu
471
488
  | `triangleSolver()` | Triangle solver (SSS/SAS/ASA/SSA) |
472
489
  | `cycleTimeEstimator()` | CNC cycle time estimation |
473
490
 
491
+ ### Industrial Engineering (5 functions)
492
+
493
+ ```typescript
494
+ import { standardTime, timeStudy, workSampling, learningCurve } from 'formulab/ie';
495
+ ```
496
+
497
+ | Function | Description |
498
+ |----------|-------------|
499
+ | `standardTime()` | Standard time from normal time + allowances |
500
+ | `timeStudy()` | Time study observation analysis (rating, normal/standard time) |
501
+ | `workSampling()` | Work sampling ratio and required observations |
502
+ | `vaAnalysis()` | Value-added / non-value-added activity analysis |
503
+ | `learningCurve()` | Wright's learning curve (time per unit, cumulative) |
504
+
474
505
  ## API Examples
475
506
 
476
507
  ### OEE Calculation
@@ -1 +1 @@
1
- {"version":3,"file":"gwpCalculator.d.ts","sourceRoot":"","sources":["../../src/environmental/gwpCalculator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA0B,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAiBlG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAQ5E"}
1
+ {"version":3,"file":"gwpCalculator.d.ts","sourceRoot":"","sources":["../../src/environmental/gwpCalculator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA0B,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAsBlG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAQ5E"}
@@ -1,16 +1,21 @@
1
1
  import { roundTo } from '../utils.js';
2
2
  /**
3
3
  * Global Warming Potential factors
4
- * @reference IPCC AR6 (2021), WGI Table 7.SM.7
4
+ * @reference IPCC AR6 (2021), WGI Table 7.SM.7 (verified against the published table;
5
+ * SF6 uses the AR6-assessed 1000-year lifetime per its table note). GWP100 additionally
6
+ * cross-checked against the GHG Protocol "IPCC GWP Values" v2.0 (Aug 2024, AR6-adapted).
7
+ * @remarks CH4 uses the AR6 *fossil methane* values (82.5 / 29.8 / 10.0, Table 7.15) —
8
+ * use-case: fugitive/industrial fossil sources. AR6 non-fossil CH4 is lower
9
+ * (80.8 / 27.0 / 7.2).
5
10
  */
6
11
  const GWP_TABLE = {
7
12
  CO2: { GWP20: 1, GWP100: 1, GWP500: 1 },
8
- CH4: { GWP20: 82.5, GWP100: 29.8, GWP500: 7.6 },
13
+ CH4: { GWP20: 82.5, GWP100: 29.8, GWP500: 10.0 },
9
14
  N2O: { GWP20: 273, GWP100: 273, GWP500: 130 },
10
15
  HFC134a: { GWP20: 4144, GWP100: 1526, GWP500: 436 },
11
- HFC152a: { GWP20: 591, GWP100: 164, GWP500: 44 },
12
- SF6: { GWP20: 18300, GWP100: 25200, GWP500: 34100 },
13
- NF3: { GWP20: 13400, GWP100: 17400, GWP500: 20700 },
16
+ HFC152a: { GWP20: 591, GWP100: 164, GWP500: 46.8 },
17
+ SF6: { GWP20: 18200, GWP100: 24300, GWP500: 29000 },
18
+ NF3: { GWP20: 13400, GWP100: 17400, GWP500: 18200 },
14
19
  CF4: { GWP20: 5300, GWP100: 7380, GWP500: 10600 },
15
20
  };
16
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gwpCalculator.js","sourceRoot":"","sources":["../../src/environmental/gwpCalculator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;GAGG;AACH,MAAM,SAAS,GAAmD;IAChE,GAAG,EAAM,EAAE,KAAK,EAAE,CAAC,EAAM,MAAM,EAAE,CAAC,EAAM,MAAM,EAAE,CAAC,EAAE;IACnD,GAAG,EAAM,EAAE,KAAK,EAAE,IAAI,EAAG,MAAM,EAAE,IAAI,EAAG,MAAM,EAAE,GAAG,EAAE;IACrD,GAAG,EAAM,EAAE,KAAK,EAAE,GAAG,EAAI,MAAM,EAAE,GAAG,EAAI,MAAM,EAAE,GAAG,EAAE;IACrD,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAG,MAAM,EAAE,IAAI,EAAG,MAAM,EAAE,GAAG,EAAE;IACrD,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAI,MAAM,EAAE,GAAG,EAAI,MAAM,EAAE,EAAE,EAAE;IACpD,GAAG,EAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACvD,GAAG,EAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACvD,GAAG,EA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AG,EAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACvD,GAAG,EAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACvD,GAAG,EAAM,EAAE,KAAK,EAAE,IAAI,EAAG,MAAM,EAAE,IAAI,EAAG,MAAM,EAAE,KAAK,EAAE;CACxD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IAE/C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AAC/D,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ActionPriorityInput, ActionPriorityResult } from './types.js';
1
+ import type { ActionPriorityInput, ActionPriorityResult, ActionPriorityLevel, ApRatingBand } from './types.js';
2
2
  /**
3
3
  * AIAG-VDA 2019 Action Priority (AP) Matrix
4
4
  *
@@ -8,11 +8,34 @@ import type { ActionPriorityInput, ActionPriorityResult } from './types.js';
8
8
  * @formula AP = lookup(severityGroup, occurrenceGroup, detectionGroup)
9
9
  * - RPN = S × O × D (still computed for reference)
10
10
  *
11
- * @reference AIAG & VDA (2019). "FMEA Handbook", 1st Edition.
11
+ * @reference AIAG & VDA (2019). "FMEA Handbook", 1st Edition — Action Priority table.
12
+ * Band structure and cell values cross-checked against the Relyence FMEA
13
+ * user guide reproduction (https://relyence.com/help/user-guide/fmea-ap.html).
14
+ *
15
+ * Rating bands (group index in result):
16
+ * - Severity: {1}=0, {2-3}=1, {4-6}=2, {7-8}=3, {9-10}=4
17
+ * - Occurrence: {1}=0, {2-3}=1, {4-5}=2, {6-7}=3, {8-10}=4
18
+ * - Detection: {1}=0, {2-4}=1, {5-6}=2, {7-10}=3
19
+ *
20
+ * Handbook invariants: S=1 → AP is always L; O=1 → AP is always L
21
+ * (failure prevented/eliminated needs no action regardless of S or D).
12
22
  *
13
23
  * @throws {RangeError} Severity must be between 1 and 10
14
24
  * @throws {RangeError} Occurrence must be between 1 and 10
15
25
  * @throws {RangeError} Detection must be between 1 and 10
16
26
  */
17
27
  export declare function actionPriority(input: ActionPriorityInput): ActionPriorityResult;
28
+ /** AIAG-VDA 2019 severity rating bands; array index = `severityGroup`. */
29
+ export declare const AP_SEVERITY_BANDS: readonly ApRatingBand[];
30
+ /** AIAG-VDA 2019 occurrence rating bands; array index = `occurrenceGroup`. */
31
+ export declare const AP_OCCURRENCE_BANDS: readonly ApRatingBand[];
32
+ /** AIAG-VDA 2019 detection rating bands; array index = `detectionGroup`. */
33
+ export declare const AP_DETECTION_BANDS: readonly ApRatingBand[];
34
+ /**
35
+ * AP lookup table: `AP_TABLE[severityGroup][occurrenceGroup][detectionGroup]`.
36
+ * Group indices follow `AP_SEVERITY_BANDS` / `AP_OCCURRENCE_BANDS` / `AP_DETECTION_BANDS`.
37
+ * Rows are O groups ascending {1}, {2-3}, {4-5}, {6-7}, {8-10};
38
+ * columns are D groups ascending {1}, {2-4}, {5-6}, {7-10}.
39
+ */
40
+ export declare const AP_TABLE: readonly (readonly (readonly ActionPriorityLevel[])[])[];
18
41
  //# sourceMappingURL=actionPriority.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionPriority.d.ts","sourceRoot":"","sources":["../../src/quality/actionPriority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AAEjG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CA+B/E"}
1
+ {"version":3,"file":"actionPriority.d.ts","sourceRoot":"","sources":["../../src/quality/actionPriority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CA+B/E;AAED,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EAMpD,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,EAAE,SAAS,YAAY,EAMtD,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,SAAS,YAAY,EAKrD,CAAC;AAcF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,SAAS,mBAAmB,EAAE,CAAC,EAAE,CAAC,EAyC5E,CAAC"}
@@ -7,7 +7,17 @@
7
7
  * @formula AP = lookup(severityGroup, occurrenceGroup, detectionGroup)
8
8
  * - RPN = S × O × D (still computed for reference)
9
9
  *
10
- * @reference AIAG & VDA (2019). "FMEA Handbook", 1st Edition.
10
+ * @reference AIAG & VDA (2019). "FMEA Handbook", 1st Edition — Action Priority table.
11
+ * Band structure and cell values cross-checked against the Relyence FMEA
12
+ * user guide reproduction (https://relyence.com/help/user-guide/fmea-ap.html).
13
+ *
14
+ * Rating bands (group index in result):
15
+ * - Severity: {1}=0, {2-3}=1, {4-6}=2, {7-8}=3, {9-10}=4
16
+ * - Occurrence: {1}=0, {2-3}=1, {4-5}=2, {6-7}=3, {8-10}=4
17
+ * - Detection: {1}=0, {2-4}=1, {5-6}=2, {7-10}=3
18
+ *
19
+ * Handbook invariants: S=1 → AP is always L; O=1 → AP is always L
20
+ * (failure prevented/eliminated needs no action regardless of S or D).
11
21
  *
12
22
  * @throws {RangeError} Severity must be between 1 and 10
13
23
  * @throws {RangeError} Occurrence must be between 1 and 10
@@ -27,9 +37,9 @@ export function actionPriority(input) {
27
37
  const s = Math.round(severity);
28
38
  const o = Math.round(occurrence);
29
39
  const d = Math.round(detection);
30
- const sGroup = getGroup(s, S_GROUPS);
31
- const oGroup = getGroup(o, O_GROUPS);
32
- const dGroup = getGroup(d, D_GROUPS);
40
+ const sGroup = getGroup(s, AP_SEVERITY_BANDS);
41
+ const oGroup = getGroup(o, AP_OCCURRENCE_BANDS);
42
+ const dGroup = getGroup(d, AP_DETECTION_BANDS);
33
43
  const ap = AP_TABLE[sGroup][oGroup][dGroup];
34
44
  const rpn = s * o * d;
35
45
  return {
@@ -40,89 +50,85 @@ export function actionPriority(input) {
40
50
  detectionGroup: dGroup,
41
51
  };
42
52
  }
43
- // Group mapping: value group index (0-4)
44
- const S_GROUPS = [[1, 0], [3, 1], [6, 2], [8, 3], [10, 4]];
45
- const O_GROUPS = [[1, 0], [3, 1], [6, 2], [8, 3], [10, 4]];
46
- const D_GROUPS = [[1, 0], [4, 1], [6, 2], [8, 3], [10, 4]];
47
- function getGroup(value, groups) {
48
- for (const [max, group] of groups) {
49
- if (value <= max)
50
- return group;
53
+ /** AIAG-VDA 2019 severity rating bands; array index = `severityGroup`. */
54
+ export const AP_SEVERITY_BANDS = [
55
+ { min: 1, max: 1 },
56
+ { min: 2, max: 3 },
57
+ { min: 4, max: 6 },
58
+ { min: 7, max: 8 },
59
+ { min: 9, max: 10 },
60
+ ];
61
+ /** AIAG-VDA 2019 occurrence rating bands; array index = `occurrenceGroup`. */
62
+ export const AP_OCCURRENCE_BANDS = [
63
+ { min: 1, max: 1 },
64
+ { min: 2, max: 3 },
65
+ { min: 4, max: 5 },
66
+ { min: 6, max: 7 },
67
+ { min: 8, max: 10 },
68
+ ];
69
+ /** AIAG-VDA 2019 detection rating bands; array index = `detectionGroup`. */
70
+ export const AP_DETECTION_BANDS = [
71
+ { min: 1, max: 1 },
72
+ { min: 2, max: 4 },
73
+ { min: 5, max: 6 },
74
+ { min: 7, max: 10 },
75
+ ];
76
+ function getGroup(value, bands) {
77
+ for (let i = 0; i < bands.length; i++) {
78
+ if (value <= bands[i].max)
79
+ return i;
51
80
  }
52
- return groups[groups.length - 1][1];
81
+ return bands.length - 1;
53
82
  }
54
83
  const H = 'H';
55
84
  const M = 'M';
56
85
  const L = 'L';
57
86
  /**
58
- * AP lookup table: AP_TABLE[sGroup][oGroup][dGroup]
59
- * S groups: {1}=0, {2-3}=1, {4-6}=2, {7-8}=3, {9-10}=4
60
- * O groups: {1}=0, {2-3}=1, {4-6}=2, {7-8}=3, {9-10}=4
61
- * D groups: {1}=0, {2-4}=1, {5-6}=2, {7-8}=3, {9-10}=4
62
- *
63
- * Table columns are D in order: {9-10}, {7-8}, {5-6}, {2-4}, {1}
64
- * So dGroup 4→col0, 3→col1, 2→col2, 1→col3, 0→col4
87
+ * AP lookup table: `AP_TABLE[severityGroup][occurrenceGroup][detectionGroup]`.
88
+ * Group indices follow `AP_SEVERITY_BANDS` / `AP_OCCURRENCE_BANDS` / `AP_DETECTION_BANDS`.
89
+ * Rows are O groups ascending {1}, {2-3}, {4-5}, {6-7}, {8-10};
90
+ * columns are D groups ascending {1}, {2-4}, {5-6}, {7-10}.
65
91
  */
66
- const AP_TABLE = buildApTable();
67
- function buildApTable() {
68
- // Raw table: [sGroup][oGroup] → [D={9-10}, D={7-8}, D={5-6}, D={2-4}, D={1}]
69
- const raw = [
70
- // S=1 (sGroup=0)
71
- [
72
- /* O=1 */ [L, L, L, L, L],
73
- /* O=2-3 */ [L, L, L, L, L],
74
- /* O=4-6 */ [M, L, L, L, L],
75
- /* O=7-8 */ [M, M, L, L, L],
76
- /* O=9-10 */ [H, M, M, L, L],
77
- ],
78
- // S=2-3 (sGroup=1)
79
- [
80
- /* O=1 */ [L, L, L, L, L],
81
- /* O=2-3 */ [M, L, L, L, L],
82
- /* O=4-6 */ [M, M, L, L, L],
83
- /* O=7-8 */ [H, M, M, L, L],
84
- /* O=9-10 */ [H, H, M, M, L],
85
- ],
86
- // S=4-6 (sGroup=2)
87
- [
88
- /* O=1 */ [M, L, L, L, L],
89
- /* O=2-3 */ [M, M, L, L, L],
90
- /* O=4-6 */ [H, M, M, L, L],
91
- /* O=7-8 */ [H, H, M, M, L],
92
- /* O=9-10 */ [H, H, H, M, M],
93
- ],
94
- // S=7-8 (sGroup=3)
95
- [
96
- /* O=1 */ [M, M, L, L, L],
97
- /* O=2-3 */ [H, M, M, L, L],
98
- /* O=4-6 */ [H, H, M, M, L],
99
- /* O=7-8 */ [H, H, H, M, M],
100
- /* O=9-10 */ [H, H, H, H, H],
101
- ],
102
- // S=9-10 (sGroup=4)
103
- [
104
- /* O=1 */ [H, M, M, L, L],
105
- /* O=2-3 */ [H, H, M, M, L],
106
- /* O=4-6 */ [H, H, H, M, M],
107
- /* O=7-8 */ [H, H, H, H, H],
108
- /* O=9-10 */ [H, H, H, H, H],
109
- ],
110
- ];
111
- // Convert raw table: columns are D={9-10}(4), D={7-8}(3), D={5-6}(2), D={2-4}(1), D={1}(0)
112
- // We need AP_TABLE[s][o][dGroup] where dGroup 0={1}, 1={2-4}, 2={5-6}, 3={7-8}, 4={9-10}
113
- const table = [];
114
- for (let s = 0; s < 5; s++) {
115
- table[s] = [];
116
- for (let o = 0; o < 5; o++) {
117
- table[s][o] = [
118
- raw[s][o][4], // dGroup 0 ({1}) ← col 4
119
- raw[s][o][3], // dGroup 1 ({2-4}) ← col 3
120
- raw[s][o][2], // dGroup 2 ({5-6}) ← col 2
121
- raw[s][o][1], // dGroup 3 ({7-8}) ← col 1
122
- raw[s][o][0], // dGroup 4 ({9-10}) ← col 0
123
- ];
124
- }
125
- }
126
- return table;
127
- }
92
+ export const AP_TABLE = [
93
+ // S=1 (sGroup=0) — always L regardless of O/D
94
+ [
95
+ /* O=1 */ [L, L, L, L],
96
+ /* O=2-3 */ [L, L, L, L],
97
+ /* O=4-5 */ [L, L, L, L],
98
+ /* O=6-7 */ [L, L, L, L],
99
+ /* O=8-10 */ [L, L, L, L],
100
+ ],
101
+ // S=2-3 (sGroup=1)
102
+ [
103
+ /* O=1 */ [L, L, L, L],
104
+ /* O=2-3 */ [L, L, L, L],
105
+ /* O=4-5 */ [L, L, L, L],
106
+ /* O=6-7 */ [L, L, L, L],
107
+ /* O=8-10 */ [L, L, M, M],
108
+ ],
109
+ // S=4-6 (sGroup=2)
110
+ [
111
+ /* O=1 */ [L, L, L, L],
112
+ /* O=2-3 */ [L, L, L, L],
113
+ /* O=4-5 */ [L, L, L, M],
114
+ /* O=6-7 */ [L, M, M, M],
115
+ /* O=8-10 */ [M, M, H, H],
116
+ ],
117
+ // S=7-8 (sGroup=3)
118
+ [
119
+ /* O=1 */ [L, L, L, L],
120
+ /* O=2-3 */ [L, L, M, M],
121
+ /* O=4-5 */ [M, M, M, H],
122
+ /* O=6-7 */ [M, H, H, H],
123
+ /* O=8-10 */ [H, H, H, H],
124
+ ],
125
+ // S=9-10 (sGroup=4)
126
+ [
127
+ /* O=1 */ [L, L, L, L],
128
+ /* O=2-3 */ [L, L, M, H],
129
+ /* O=4-5 */ [M, H, H, H],
130
+ /* O=6-7 */ [H, H, H, H],
131
+ /* O=8-10 */ [H, H, H, H],
132
+ ],
133
+ ];
128
134
  //# sourceMappingURL=actionPriority.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionPriority.js","sourceRoot":"","sources":["../../src/quality/actionPriority.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAElD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,IAA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AAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACzB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KAC1B;IACD,oBAAoB;IACpB;QACE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACzB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACzB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACzB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACzB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KAC1B;CACF,CAAC"}
@@ -1,7 +1,12 @@
1
1
  import type { AqlInput, AqlResult } from './types.js';
2
2
  /**
3
3
  * Calculate AQL (Acceptable Quality Level) sampling plan
4
- * Based on ISO 2859-1 / ANSI Z1.4 standards
4
+ *
5
+ * @reference ISO 2859-1:1999, Table 1 (sample size code letters) and Table 2-A
6
+ * (single sampling plans for normal inspection). Equivalent to ANSI/ASQ Z1.4.
7
+ * @remarks Simplified relative to the standard: the sample size is always the code
8
+ * letter's own size — Table 2-A arrow cells (which redirect to a plan with a
9
+ * different sample size) reuse the redirected plan's Ac/Re with this letter's size.
5
10
  *
6
11
  * @param input - AQL input parameters
7
12
  * @returns AQL sampling plan result
@@ -1 +1 @@
1
- {"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../../src/quality/aql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AA2EvE;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAkC9C"}
1
+ {"version":3,"file":"aql.d.ts","sourceRoot":"","sources":["../../src/quality/aql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AA6EvE;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAkC9C"}