formulab 0.9.0 → 0.10.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 +42 -0
- package/README.md +36 -10
- package/dist/automotive/brakingDistance.d.ts +4 -0
- package/dist/automotive/brakingDistance.d.ts.map +1 -1
- package/dist/automotive/brakingDistance.js +8 -4
- package/dist/automotive/brakingDistance.js.map +1 -1
- package/dist/battery/cRate.d.ts.map +1 -1
- package/dist/battery/cRate.js +6 -0
- package/dist/battery/cRate.js.map +1 -1
- package/dist/chemical/dilution.js +4 -4
- package/dist/chemical/dilution.js.map +1 -1
- package/dist/chemical/heatTransfer.d.ts +6 -0
- package/dist/chemical/heatTransfer.d.ts.map +1 -1
- package/dist/chemical/heatTransfer.js +15 -9
- package/dist/chemical/heatTransfer.js.map +1 -1
- package/dist/chemical/pipeFlow.d.ts +6 -0
- package/dist/chemical/pipeFlow.d.ts.map +1 -1
- package/dist/chemical/pipeFlow.js +12 -6
- package/dist/chemical/pipeFlow.js.map +1 -1
- package/dist/construction/aggregate.d.ts +4 -0
- package/dist/construction/aggregate.d.ts.map +1 -1
- package/dist/construction/aggregate.js +8 -4
- package/dist/construction/aggregate.js.map +1 -1
- package/dist/construction/momentOfInertia.d.ts +7 -0
- package/dist/construction/momentOfInertia.d.ts.map +1 -1
- package/dist/construction/momentOfInertia.js +19 -12
- package/dist/construction/momentOfInertia.js.map +1 -1
- package/dist/construction/roof.js +2 -2
- package/dist/construction/roof.js.map +1 -1
- package/dist/electronics/awg.d.ts +3 -2
- package/dist/electronics/awg.d.ts.map +1 -1
- package/dist/electronics/awg.js +3 -3
- package/dist/electronics/awg.js.map +1 -1
- package/dist/electronics/capacitor.js +1 -1
- package/dist/electronics/capacitor.js.map +1 -1
- package/dist/electronics/led.js +2 -2
- package/dist/electronics/led.js.map +1 -1
- package/dist/electronics/ohmsLaw.d.ts +3 -0
- package/dist/electronics/ohmsLaw.d.ts.map +1 -1
- package/dist/electronics/ohmsLaw.js +11 -8
- package/dist/electronics/ohmsLaw.js.map +1 -1
- package/dist/electronics/stencil.d.ts +2 -1
- package/dist/electronics/stencil.d.ts.map +1 -1
- package/dist/electronics/stencil.js +4 -3
- package/dist/electronics/stencil.js.map +1 -1
- package/dist/energy/solarOutput.d.ts +4 -0
- package/dist/energy/solarOutput.d.ts.map +1 -1
- package/dist/energy/solarOutput.js +8 -4
- package/dist/energy/solarOutput.js.map +1 -1
- package/dist/environmental/scope2Emissions.d.ts +1 -0
- package/dist/environmental/scope2Emissions.d.ts.map +1 -1
- package/dist/environmental/scope2Emissions.js +2 -1
- package/dist/environmental/scope2Emissions.js.map +1 -1
- package/dist/machining/boringBarDeflection.d.ts.map +1 -1
- package/dist/machining/boringBarDeflection.js +7 -1
- package/dist/machining/boringBarDeflection.js.map +1 -1
- package/dist/machining/toolDeflection.d.ts.map +1 -1
- package/dist/machining/toolDeflection.js +7 -1
- package/dist/machining/toolDeflection.js.map +1 -1
- package/dist/machining/triangleSolver.d.ts +2 -1
- package/dist/machining/triangleSolver.d.ts.map +1 -1
- package/dist/machining/triangleSolver.js +6 -5
- package/dist/machining/triangleSolver.js.map +1 -1
- package/dist/metal/flangeSpec.d.ts +3 -0
- package/dist/metal/flangeSpec.d.ts.map +1 -1
- package/dist/metal/flangeSpec.js +6 -3
- package/dist/metal/flangeSpec.js.map +1 -1
- package/dist/metal/metalWeight.d.ts.map +1 -1
- package/dist/metal/metalWeight.js +20 -0
- package/dist/metal/metalWeight.js.map +1 -1
- package/dist/metal/pipeSpec.d.ts +3 -0
- package/dist/metal/pipeSpec.d.ts.map +1 -1
- package/dist/metal/pipeSpec.js +6 -3
- package/dist/metal/pipeSpec.js.map +1 -1
- package/dist/quality/controlChart.d.ts +3 -0
- package/dist/quality/controlChart.d.ts.map +1 -1
- package/dist/quality/controlChart.js +6 -3
- package/dist/quality/controlChart.js.map +1 -1
- package/dist/quality/oee.js +2 -2
- package/dist/quality/oee.js.map +1 -1
- package/dist/safety/ventilationRate.d.ts +3 -0
- package/dist/safety/ventilationRate.d.ts.map +1 -1
- package/dist/safety/ventilationRate.js +6 -3
- package/dist/safety/ventilationRate.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,48 @@ 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.10.1] - 2026-02-09
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`throw new Error` → `throw new RangeError`** across all 18 remaining files — runtime error type now matches `@throws {RangeError}` JSDoc and ERRORS.md policy. Affected domains: automotive, chemical, construction, electronics, energy, environmental, machining, metal, quality, safety.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **README.md** — Updated test count (2,494), error handling section (no legacy NaN/Infinity), utility domain (3 → 16 functions).
|
|
17
|
+
|
|
18
|
+
## [0.10.0] - 2026-02-09
|
|
19
|
+
|
|
20
|
+
### Breaking Changes
|
|
21
|
+
|
|
22
|
+
- **`awgProperties()` return type** — Changed from `AwgResult | null` to `AwgResult`. Invalid AWG range (< 0 or > 40) now throws `RangeError` instead of returning `null`.
|
|
23
|
+
- **`metalWeight()`** — Now throws `RangeError` on non-positive dimensions (length, width, thickness, diameter) and when outerDiameter ≤ innerDiameter for pipes.
|
|
24
|
+
- **`cRate()`** — Now throws `RangeError` when capacityAh ≤ 0, currentA ≤ 0, or cRate ≤ 0. Previously returned `Infinity`.
|
|
25
|
+
- **`toolDeflection()`** — Now throws `RangeError` on non-positive toolDiameter/stickout or negative cuttingForce. Stiffness is computed as `3EI/L³` (beam property) instead of `F/δ`.
|
|
26
|
+
- **`boringBarDeflection()`** — Same changes as `toolDeflection()`: validation + stiffness formula fix.
|
|
27
|
+
- **`heatTransfer()`** — All `throw new Error()` changed to `throw new RangeError()`. Removed `Infinity` fallback in radiation thermal resistance.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **`@throws` JSDoc annotations** for 14 functions across 10 domains — documents every throw condition for IDE/editor hints:
|
|
32
|
+
- automotive: `brakingDistance`
|
|
33
|
+
- chemical: `heatTransfer`, `pipeFlow`
|
|
34
|
+
- construction: `aggregate`, `momentOfInertia`
|
|
35
|
+
- electronics: `ohmsLaw`, `stencil`
|
|
36
|
+
- energy: `solarOutput`
|
|
37
|
+
- environmental: `scope2Emissions`
|
|
38
|
+
- machining: `triangleSolver`
|
|
39
|
+
- metal: `flangeSpec`, `pipeSpec`
|
|
40
|
+
- quality: `controlChart`
|
|
41
|
+
- safety: `ventilationRate`
|
|
42
|
+
|
|
43
|
+
- **26 new validation tests** — error path coverage for `metalWeight`, `cRate`, `toolDeflection`, `boringBarDeflection`, `heatTransfer`, `awgProperties`
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **ERRORS.md** — Removed legacy migration roadmap (all NaN/Infinity patterns resolved). Updated all 6 function entries to reflect `throw` behavior.
|
|
48
|
+
- Total test count: 2468 → 2494 (+26)
|
|
49
|
+
|
|
8
50
|
## [0.9.0] - 2026-02-09
|
|
9
51
|
|
|
10
52
|
### Added
|
package/README.md
CHANGED
|
@@ -11,12 +11,12 @@ A comprehensive collection of engineering formulas and calculations for manufact
|
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **174 industrial calculations** — 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
|
|
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
15
|
- **14 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility, Battery, Environmental, Machining
|
|
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
|
-
- **
|
|
19
|
+
- **2,494 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
|
|
@@ -33,7 +33,7 @@ A comprehensive collection of engineering formulas and calculations for manufact
|
|
|
33
33
|
| Automotive | 9 | — | AASHTO, SAE J1772 |
|
|
34
34
|
| Energy | 15 | — | NREL PVWatts, ISO 50001 |
|
|
35
35
|
| Food | 6 | — | HACCP, ICH Q1A |
|
|
36
|
-
| Utility |
|
|
36
|
+
| Utility | 16 | — | — |
|
|
37
37
|
| Battery | 10 | — | 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 |
|
|
@@ -52,7 +52,7 @@ roundTo(0.615, 2) // → 0.62 (not 0.61)
|
|
|
52
52
|
roundTo(-2.555, 2) // → -2.56 (sign-aware)
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Non-finite values (`NaN`, `Infinity`) pass through unchanged. Each function's JSDoc specifies output precision (typically 2-4 decimal places).
|
|
55
|
+
Non-finite values (`NaN`, `Infinity`) pass through unchanged. All validation errors throw `RangeError` — no function returns NaN or Infinity for invalid inputs. Each function's JSDoc specifies output precision (typically 2-4 decimal places) and `@throws` conditions.
|
|
56
56
|
|
|
57
57
|
### Golden Reference Tests
|
|
58
58
|
|
|
@@ -386,17 +386,31 @@ import { calorie, nutrition, haccp, waterActivity, stabilityStudy } from 'formul
|
|
|
386
386
|
| `waterActivity()` | Water activity microbial risk (HACCP) |
|
|
387
387
|
| `stabilityStudy()` | Accelerated stability (Arrhenius, ICH Q1A) |
|
|
388
388
|
|
|
389
|
-
### Utility (
|
|
389
|
+
### Utility (16 functions)
|
|
390
390
|
|
|
391
391
|
```typescript
|
|
392
|
-
import { solveAssignment, calculateUnit } from 'formulab/utility';
|
|
392
|
+
import { solveAssignment, calculateUnit, statistics, regression, npv } from 'formulab/utility';
|
|
393
393
|
```
|
|
394
394
|
|
|
395
395
|
| Function | Description |
|
|
396
396
|
|----------|-------------|
|
|
397
397
|
| `solveAssignment()` | Hungarian algorithm optimization |
|
|
398
|
-
| `calculateUnit()` | Unit conversion |
|
|
398
|
+
| `calculateUnit()` | Unit conversion (7 categories) |
|
|
399
399
|
| `getUnitCategories()` | Get unit categories |
|
|
400
|
+
| `statistics()` | Descriptive statistics (mean, median, stdDev, etc.) |
|
|
401
|
+
| `percentile()` | Percentile/quantile calculation |
|
|
402
|
+
| `correlation()` | Pearson correlation coefficient |
|
|
403
|
+
| `regression()` | Simple linear regression |
|
|
404
|
+
| `movingAverage()` | SMA/EMA/WMA moving average |
|
|
405
|
+
| `linearInterpolation()` | 1D linear interpolation |
|
|
406
|
+
| `bilinearInterpolation()` | 2D bilinear interpolation |
|
|
407
|
+
| `roi()` | Return on Investment |
|
|
408
|
+
| `npv()` | Net Present Value |
|
|
409
|
+
| `depreciation()` | Asset depreciation (SL/DDB/SYD) |
|
|
410
|
+
| `lcc()` | Life Cycle Cost analysis |
|
|
411
|
+
| `normalize()` | Data normalization (min-max/z-score) |
|
|
412
|
+
| `histogram()` | Frequency distribution histogram |
|
|
413
|
+
| `weightedScore()` | Weighted scoring model |
|
|
400
414
|
|
|
401
415
|
### Battery (10 functions)
|
|
402
416
|
|
|
@@ -559,9 +573,21 @@ if (isCRateInput(formData)) {
|
|
|
559
573
|
|
|
560
574
|
See [ERRORS.md](./ERRORS.md) for the complete error behavior specification. Key points:
|
|
561
575
|
|
|
562
|
-
- **
|
|
563
|
-
- **
|
|
564
|
-
-
|
|
576
|
+
- **All validation failures** throw `RangeError` with descriptive messages
|
|
577
|
+
- **No silent NaN/Infinity** — every function guarantees finite outputs for valid inputs
|
|
578
|
+
- Every `@throws` condition is documented in each function's JSDoc
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
import { metalWeight } from 'formulab/metal';
|
|
582
|
+
|
|
583
|
+
try {
|
|
584
|
+
const result = metalWeight({ shape: 'plate', materialName: 'steel', length: 0, width: 100, thickness: 10 });
|
|
585
|
+
} catch (e) {
|
|
586
|
+
if (e instanceof RangeError) {
|
|
587
|
+
console.log(e.message); // "length must be positive"
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
```
|
|
565
591
|
|
|
566
592
|
## Tree Shaking
|
|
567
593
|
|
|
@@ -9,6 +9,10 @@ import type { BrakingDistanceInput, BrakingDistanceResult } from './types.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Reference: AASHTO "A Policy on Geometric Design of Highways and Streets"
|
|
11
11
|
*
|
|
12
|
+
* @throws {RangeError} Speed must be positive
|
|
13
|
+
* @throws {RangeError} Friction coefficient must be positive
|
|
14
|
+
* @throws {RangeError} Reaction time must be non-negative
|
|
15
|
+
* @throws {RangeError} Effective friction (friction + grade) must be positive — vehicle cannot stop on this grade
|
|
12
16
|
* @param input - speed, friction, reaction time, grade
|
|
13
17
|
* @returns stopping distance components
|
|
14
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brakingDistance.d.ts","sourceRoot":"","sources":["../../src/automotive/brakingDistance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E
|
|
1
|
+
{"version":3,"file":"brakingDistance.d.ts","sourceRoot":"","sources":["../../src/automotive/brakingDistance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAqClF"}
|
|
@@ -9,17 +9,21 @@ import { roundTo } from '../utils.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Reference: AASHTO "A Policy on Geometric Design of Highways and Streets"
|
|
11
11
|
*
|
|
12
|
+
* @throws {RangeError} Speed must be positive
|
|
13
|
+
* @throws {RangeError} Friction coefficient must be positive
|
|
14
|
+
* @throws {RangeError} Reaction time must be non-negative
|
|
15
|
+
* @throws {RangeError} Effective friction (friction + grade) must be positive — vehicle cannot stop on this grade
|
|
12
16
|
* @param input - speed, friction, reaction time, grade
|
|
13
17
|
* @returns stopping distance components
|
|
14
18
|
*/
|
|
15
19
|
export function brakingDistance(input) {
|
|
16
20
|
const { speed, friction, reactionTime, grade } = input;
|
|
17
21
|
if (speed <= 0)
|
|
18
|
-
throw new
|
|
22
|
+
throw new RangeError('Speed must be positive');
|
|
19
23
|
if (friction <= 0)
|
|
20
|
-
throw new
|
|
24
|
+
throw new RangeError('Friction coefficient must be positive');
|
|
21
25
|
if (reactionTime < 0)
|
|
22
|
-
throw new
|
|
26
|
+
throw new RangeError('Reaction time must be non-negative');
|
|
23
27
|
const g = 9.81; // m/s²
|
|
24
28
|
const speedMps = speed / 3.6; // km/h → m/s
|
|
25
29
|
const gradeDecimal = grade / 100; // % → decimal
|
|
@@ -29,7 +33,7 @@ export function brakingDistance(input) {
|
|
|
29
33
|
// Uphill (positive grade) helps braking, downhill (negative) hinders
|
|
30
34
|
const effectiveFriction = friction + gradeDecimal;
|
|
31
35
|
if (effectiveFriction <= 0) {
|
|
32
|
-
throw new
|
|
36
|
+
throw new RangeError('Effective friction (friction + grade) must be positive — vehicle cannot stop on this grade');
|
|
33
37
|
}
|
|
34
38
|
// Deceleration: a = g × (f ± G)
|
|
35
39
|
const deceleration = g * effectiveFriction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brakingDistance.js","sourceRoot":"","sources":["../../src/automotive/brakingDistance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC
|
|
1
|
+
{"version":3,"file":"brakingDistance.js","sourceRoot":"","sources":["../../src/automotive/brakingDistance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEvD,IAAI,KAAK,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAC/D,IAAI,QAAQ,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAC;IACjF,IAAI,YAAY,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;IAEjF,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO;IACvB,MAAM,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,aAAa;IAC3C,MAAM,YAAY,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,cAAc;IAEhD,+BAA+B;IAC/B,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAC;IAE7C,uCAAuC;IACvC,qEAAqE;IACrE,MAAM,iBAAiB,GAAG,QAAQ,GAAG,YAAY,CAAC;IAElD,IAAI,iBAAiB,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,UAAU,CAAC,4FAA4F,CAAC,CAAC;IACrH,CAAC;IAED,gCAAgC;IAChC,MAAM,YAAY,GAAG,CAAC,GAAG,iBAAiB,CAAC;IAE3C,qCAAqC;IACrC,MAAM,WAAW,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC;IAE/D,MAAM,qBAAqB,GAAG,YAAY,GAAG,WAAW,CAAC;IAEzD,OAAO;QACL,gBAAgB,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAC1C,eAAe,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QACxC,qBAAqB,EAAE,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;QACxD,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cRate.d.ts","sourceRoot":"","sources":["../../src/battery/cRate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"cRate.d.ts","sourceRoot":"","sources":["../../src/battery/cRate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAyBpD"}
|
package/dist/battery/cRate.js
CHANGED
|
@@ -7,13 +7,19 @@ import { roundTo } from '../utils.js';
|
|
|
7
7
|
* @returns C-rate, current, and theoretical charge/discharge time
|
|
8
8
|
*/
|
|
9
9
|
export function cRate(input) {
|
|
10
|
+
if (input.capacityAh <= 0)
|
|
11
|
+
throw new RangeError('capacityAh must be positive');
|
|
10
12
|
let cRateValue;
|
|
11
13
|
let currentA;
|
|
12
14
|
if (input.mode === 'currentToRate') {
|
|
15
|
+
if (input.currentA <= 0)
|
|
16
|
+
throw new RangeError('currentA must be positive');
|
|
13
17
|
currentA = input.currentA;
|
|
14
18
|
cRateValue = currentA / input.capacityAh;
|
|
15
19
|
}
|
|
16
20
|
else {
|
|
21
|
+
if (input.cRate <= 0)
|
|
22
|
+
throw new RangeError('cRate must be positive');
|
|
17
23
|
cRateValue = input.cRate;
|
|
18
24
|
currentA = cRateValue * input.capacityAh;
|
|
19
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cRate.js","sourceRoot":"","sources":["../../src/battery/cRate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,IAAI,UAAkB,CAAC;IACvB,IAAI,QAAgB,CAAC;IAErB,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACnC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC1B,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QACzB,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,GAAG,UAAU,CAAC;IACxC,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,EAAE,CAAC;IAEjD,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC9C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;KACnD,CAAC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
|
16
16
|
case 'c2':
|
|
17
17
|
// C2 = C1 * V1 / V2
|
|
18
18
|
if (input.v2 === 0) {
|
|
19
|
-
throw new
|
|
19
|
+
throw new RangeError('Cannot solve for c2: v2 must be non-zero');
|
|
20
20
|
}
|
|
21
21
|
resultC1 = input.c1;
|
|
22
22
|
resultV1 = input.v1;
|
|
@@ -26,7 +26,7 @@ export function dilution(input) {
|
|
|
26
26
|
case 'v2':
|
|
27
27
|
// V2 = C1 * V1 / C2
|
|
28
28
|
if (input.c2 === 0) {
|
|
29
|
-
throw new
|
|
29
|
+
throw new RangeError('Cannot solve for v2: c2 must be non-zero');
|
|
30
30
|
}
|
|
31
31
|
resultC1 = input.c1;
|
|
32
32
|
resultV1 = input.v1;
|
|
@@ -36,7 +36,7 @@ export function dilution(input) {
|
|
|
36
36
|
case 'c1':
|
|
37
37
|
// C1 = C2 * V2 / V1
|
|
38
38
|
if (input.v1 === 0) {
|
|
39
|
-
throw new
|
|
39
|
+
throw new RangeError('Cannot solve for c1: v1 must be non-zero');
|
|
40
40
|
}
|
|
41
41
|
resultV1 = input.v1;
|
|
42
42
|
resultC2 = input.c2;
|
|
@@ -46,7 +46,7 @@ export function dilution(input) {
|
|
|
46
46
|
case 'v1':
|
|
47
47
|
// V1 = C2 * V2 / C1
|
|
48
48
|
if (input.c1 === 0) {
|
|
49
|
-
throw new
|
|
49
|
+
throw new RangeError('Cannot solve for v1: c1 must be non-zero');
|
|
50
50
|
}
|
|
51
51
|
resultC1 = input.c1;
|
|
52
52
|
resultC2 = input.c2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dilution.js","sourceRoot":"","sources":["../../src/chemical/dilution.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,IAAI,QAAgB,CAAC;IACrB,IAAI,QAAgB,CAAC;IACrB,IAAI,QAAgB,CAAC;IACrB,IAAI,QAAgB,CAAC;IAErB,QAAQ,K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AAoB;YACpB,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBACnB,MAAM,IAAI,UAAU,CAAC,0CAA0C,CAAC,CAAC;YACnE,CAAC;YACD,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM;QAER,KAAK,IAAI;YACP,oBAAoB;YACpB,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBACnB,MAAM,IAAI,UAAU,CAAC,0CAA0C,CAAC,CAAC;YACnE,CAAC;YACD,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM;IACV,CAAC;IAED,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,QAAQ;QACZ,YAAY,EAAE,QAAQ,GAAG,QAAQ;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -9,6 +9,12 @@ import type { HeatTransferInput, HeatTransferResult } from './types.js';
|
|
|
9
9
|
*
|
|
10
10
|
* All temperatures in °C internally converted to K for radiation.
|
|
11
11
|
*
|
|
12
|
+
* @throws {RangeError} Thermal conductivity must be positive
|
|
13
|
+
* @throws {RangeError} Area must be positive
|
|
14
|
+
* @throws {RangeError} Thickness must be positive
|
|
15
|
+
* @throws {RangeError} Convection coefficient must be positive
|
|
16
|
+
* @throws {RangeError} Emissivity must be between 0 and 1
|
|
17
|
+
* @throws {RangeError} Absolute temperature must be positive
|
|
12
18
|
* @param input - discriminated union by `mode`
|
|
13
19
|
* @returns heat transfer rate and related quantities
|
|
14
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatTransfer.d.ts","sourceRoot":"","sources":["../../src/chemical/heatTransfer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAOxE
|
|
1
|
+
{"version":3,"file":"heatTransfer.d.ts","sourceRoot":"","sources":["../../src/chemical/heatTransfer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAOxE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA4DzE"}
|
|
@@ -13,6 +13,12 @@ const STEFAN_BOLTZMANN = 5.670374419e-8;
|
|
|
13
13
|
*
|
|
14
14
|
* All temperatures in °C internally converted to K for radiation.
|
|
15
15
|
*
|
|
16
|
+
* @throws {RangeError} Thermal conductivity must be positive
|
|
17
|
+
* @throws {RangeError} Area must be positive
|
|
18
|
+
* @throws {RangeError} Thickness must be positive
|
|
19
|
+
* @throws {RangeError} Convection coefficient must be positive
|
|
20
|
+
* @throws {RangeError} Emissivity must be between 0 and 1
|
|
21
|
+
* @throws {RangeError} Absolute temperature must be positive
|
|
16
22
|
* @param input - discriminated union by `mode`
|
|
17
23
|
* @returns heat transfer rate and related quantities
|
|
18
24
|
*/
|
|
@@ -26,11 +32,11 @@ export function heatTransfer(input) {
|
|
|
26
32
|
const { conductivity, thickness, tempHot, tempCold } = input;
|
|
27
33
|
area = input.area;
|
|
28
34
|
if (conductivity <= 0)
|
|
29
|
-
throw new
|
|
35
|
+
throw new RangeError('Thermal conductivity must be positive');
|
|
30
36
|
if (area <= 0)
|
|
31
|
-
throw new
|
|
37
|
+
throw new RangeError('Area must be positive');
|
|
32
38
|
if (thickness <= 0)
|
|
33
|
-
throw new
|
|
39
|
+
throw new RangeError('Thickness must be positive');
|
|
34
40
|
tempDifference = tempHot - tempCold;
|
|
35
41
|
// Fourier's Law: Q = k × A × ΔT / L
|
|
36
42
|
heatRate = (conductivity * area * tempDifference) / thickness;
|
|
@@ -42,9 +48,9 @@ export function heatTransfer(input) {
|
|
|
42
48
|
const { coefficient, tempSurface, tempFluid } = input;
|
|
43
49
|
area = input.area;
|
|
44
50
|
if (coefficient <= 0)
|
|
45
|
-
throw new
|
|
51
|
+
throw new RangeError('Convection coefficient must be positive');
|
|
46
52
|
if (area <= 0)
|
|
47
|
-
throw new
|
|
53
|
+
throw new RangeError('Area must be positive');
|
|
48
54
|
tempDifference = tempSurface - tempFluid;
|
|
49
55
|
// Newton's Law of Cooling: Q = h × A × ΔT
|
|
50
56
|
heatRate = coefficient * area * tempDifference;
|
|
@@ -56,21 +62,21 @@ export function heatTransfer(input) {
|
|
|
56
62
|
const { emissivity, tempHot, tempCold } = input;
|
|
57
63
|
area = input.area;
|
|
58
64
|
if (emissivity <= 0 || emissivity > 1)
|
|
59
|
-
throw new
|
|
65
|
+
throw new RangeError('Emissivity must be between 0 and 1');
|
|
60
66
|
if (area <= 0)
|
|
61
|
-
throw new
|
|
67
|
+
throw new RangeError('Area must be positive');
|
|
62
68
|
tempDifference = tempHot - tempCold;
|
|
63
69
|
// Convert to Kelvin for Stefan-Boltzmann
|
|
64
70
|
const tHotK = tempHot + 273.15;
|
|
65
71
|
const tColdK = tempCold + 273.15;
|
|
66
72
|
if (tHotK <= 0 || tColdK <= 0)
|
|
67
|
-
throw new
|
|
73
|
+
throw new RangeError('Absolute temperature must be positive');
|
|
68
74
|
// Stefan-Boltzmann Law: Q = ε × σ × A × (T_h⁴ - T_c⁴)
|
|
69
75
|
heatRate = emissivity * STEFAN_BOLTZMANN * area * (Math.pow(tHotK, 4) - Math.pow(tColdK, 4));
|
|
70
76
|
// Linearized thermal resistance (approximate): R ≈ 1 / (h_rad × A)
|
|
71
77
|
// where h_rad = ε × σ × (T_h² + T_c²) × (T_h + T_c)
|
|
72
78
|
const hRad = emissivity * STEFAN_BOLTZMANN * (tHotK * tHotK + tColdK * tColdK) * (tHotK + tColdK);
|
|
73
|
-
thermalResistance =
|
|
79
|
+
thermalResistance = 1 / (hRad * area);
|
|
74
80
|
break;
|
|
75
81
|
}
|
|
76
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatTransfer.js","sourceRoot":"","sources":["../../src/chemical/heatTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"heatTransfer.js","sourceRoot":"","sources":["../../src/chemical/heatTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,IAAI,QAAgB,CAAC;IACrB,IAAI,IAAY,CAAC;IACjB,IAAI,cAAsB,CAAC;IAC3B,IAAI,iBAAyB,CAAC;IAE9B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;YAC7D,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAClB,IAAI,YAAY,IAAI,CAAC;gBAAE,MAAM,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAC;YACrF,IAAI,IAAI,IAAI,CAAC;gBAAE,MAAM,IAAI,UA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/2)
|
|
12
12
|
*
|
|
13
|
+
* @throws {RangeError} Flow rate must be positive
|
|
14
|
+
* @throws {RangeError} Pipe diameter must be positive
|
|
15
|
+
* @throws {RangeError} Pipe length must be positive
|
|
16
|
+
* @throws {RangeError} Fluid density must be positive
|
|
17
|
+
* @throws {RangeError} Fluid viscosity must be positive
|
|
18
|
+
* @throws {RangeError} Custom roughness must be provided and non-negative
|
|
13
19
|
* @param input - flow rate, pipe geometry, fluid properties
|
|
14
20
|
* @returns pressure drop, velocity, Reynolds number, flow regime
|
|
15
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeFlow.d.ts","sourceRoot":"","sources":["../../src/chemical/pipeFlow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAiC9E
|
|
1
|
+
{"version":3,"file":"pipeFlow.d.ts","sourceRoot":"","sources":["../../src/chemical/pipeFlow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAiC9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAoE7D"}
|
|
@@ -39,26 +39,32 @@ function swameeJainFriction(Re, epsilonM, diameterM) {
|
|
|
39
39
|
*
|
|
40
40
|
* Darcy-Weisbach: ΔP = f × (L/D) × (ρv²/2)
|
|
41
41
|
*
|
|
42
|
+
* @throws {RangeError} Flow rate must be positive
|
|
43
|
+
* @throws {RangeError} Pipe diameter must be positive
|
|
44
|
+
* @throws {RangeError} Pipe length must be positive
|
|
45
|
+
* @throws {RangeError} Fluid density must be positive
|
|
46
|
+
* @throws {RangeError} Fluid viscosity must be positive
|
|
47
|
+
* @throws {RangeError} Custom roughness must be provided and non-negative
|
|
42
48
|
* @param input - flow rate, pipe geometry, fluid properties
|
|
43
49
|
* @returns pressure drop, velocity, Reynolds number, flow regime
|
|
44
50
|
*/
|
|
45
51
|
export function pipeFlow(input) {
|
|
46
52
|
const { flowRate, pipeDiameter, pipeLength, pipeMaterial, fluidDensity, fluidViscosity, customRoughness } = input;
|
|
47
53
|
if (flowRate <= 0)
|
|
48
|
-
throw new
|
|
54
|
+
throw new RangeError('Flow rate must be positive');
|
|
49
55
|
if (pipeDiameter <= 0)
|
|
50
|
-
throw new
|
|
56
|
+
throw new RangeError('Pipe diameter must be positive');
|
|
51
57
|
if (pipeLength <= 0)
|
|
52
|
-
throw new
|
|
58
|
+
throw new RangeError('Pipe length must be positive');
|
|
53
59
|
if (fluidDensity <= 0)
|
|
54
|
-
throw new
|
|
60
|
+
throw new RangeError('Fluid density must be positive');
|
|
55
61
|
if (fluidViscosity <= 0)
|
|
56
|
-
throw new
|
|
62
|
+
throw new RangeError('Fluid viscosity must be positive');
|
|
57
63
|
// Get pipe roughness
|
|
58
64
|
let roughnessMm;
|
|
59
65
|
if (pipeMaterial === 'custom') {
|
|
60
66
|
if (customRoughness == null || customRoughness < 0) {
|
|
61
|
-
throw new
|
|
67
|
+
throw new RangeError('Custom roughness must be provided and non-negative');
|
|
62
68
|
}
|
|
63
69
|
roughnessMm = customRoughness;
|
|
64
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeFlow.js","sourceRoot":"","sources":["../../src/chemical/pipeFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;GAGG;AACH,MAAM,cAAc,GAAoD;IACtE,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,KAAK;IACrB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,MAAM;IACd,GAAG,EAAE,MAAM;IACX,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CAAC,EAAU,EAAE,QAAgB,EAAE,SAAiB;IAC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AAe,EAAE,OAAO,CAAC,YAAY,GAAG,IAAI,EAAE,CAAC,CAAC;QAChD,eAAe,EAAE,OAAO,CAAC,YAAY,GAAG,MAAM,EAAE,CAAC,CAAC;QAClD,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -13,6 +13,7 @@ export declare function getAggregateDensity(type: AggregateType): number;
|
|
|
13
13
|
/**
|
|
14
14
|
* Calculate how much area can be covered with a given volume at a specific depth
|
|
15
15
|
*
|
|
16
|
+
* @throws {RangeError} Volume and depth must be greater than zero
|
|
16
17
|
* @param volumeM3 - Volume in cubic meters
|
|
17
18
|
* @param depthCm - Depth in centimeters
|
|
18
19
|
* @returns Coverage area in square meters
|
|
@@ -26,6 +27,9 @@ export declare function aggregateCoverage(volumeM3: number, depthCm: number): nu
|
|
|
26
27
|
* - Weight = volume × density
|
|
27
28
|
* - Coverage area = length × width (footprint)
|
|
28
29
|
*
|
|
30
|
+
* @throws {RangeError} All dimensions must be greater than zero
|
|
31
|
+
* @throws {RangeError} Custom density must be provided and greater than zero
|
|
32
|
+
* @throws {RangeError} Unknown aggregate type: {aggregateType}
|
|
29
33
|
* @param input - Aggregate input parameters
|
|
30
34
|
* @returns Aggregate calculation results
|
|
31
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/construction/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnG;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAOjD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAG/D;AAED
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/construction/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnG;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAOjD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAG/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM3E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAmDhE"}
|
|
@@ -23,13 +23,14 @@ export function getAggregateDensity(type) {
|
|
|
23
23
|
/**
|
|
24
24
|
* Calculate how much area can be covered with a given volume at a specific depth
|
|
25
25
|
*
|
|
26
|
+
* @throws {RangeError} Volume and depth must be greater than zero
|
|
26
27
|
* @param volumeM3 - Volume in cubic meters
|
|
27
28
|
* @param depthCm - Depth in centimeters
|
|
28
29
|
* @returns Coverage area in square meters
|
|
29
30
|
*/
|
|
30
31
|
export function aggregateCoverage(volumeM3, depthCm) {
|
|
31
32
|
if (volumeM3 <= 0 || depthCm <= 0) {
|
|
32
|
-
throw new
|
|
33
|
+
throw new RangeError('Volume and depth must be greater than zero');
|
|
33
34
|
}
|
|
34
35
|
const depthM = depthCm / 100;
|
|
35
36
|
return roundTo(volumeM3 / depthM, 2);
|
|
@@ -42,6 +43,9 @@ export function aggregateCoverage(volumeM3, depthCm) {
|
|
|
42
43
|
* - Weight = volume × density
|
|
43
44
|
* - Coverage area = length × width (footprint)
|
|
44
45
|
*
|
|
46
|
+
* @throws {RangeError} All dimensions must be greater than zero
|
|
47
|
+
* @throws {RangeError} Custom density must be provided and greater than zero
|
|
48
|
+
* @throws {RangeError} Unknown aggregate type: {aggregateType}
|
|
45
49
|
* @param input - Aggregate input parameters
|
|
46
50
|
* @returns Aggregate calculation results
|
|
47
51
|
*/
|
|
@@ -49,7 +53,7 @@ export function aggregate(input) {
|
|
|
49
53
|
const { length, width, depth, depthUnit, aggregateType, customDensity } = input;
|
|
50
54
|
// Validate inputs
|
|
51
55
|
if (length <= 0 || width <= 0 || depth <= 0) {
|
|
52
|
-
throw new
|
|
56
|
+
throw new RangeError('All dimensions must be greater than zero');
|
|
53
57
|
}
|
|
54
58
|
// Convert depth to meters if in centimeters
|
|
55
59
|
const depthInMeters = depthUnit === 'centimeters' ? depth / 100 : depth;
|
|
@@ -57,14 +61,14 @@ export function aggregate(input) {
|
|
|
57
61
|
let density;
|
|
58
62
|
if (aggregateType === 'custom') {
|
|
59
63
|
if (customDensity === undefined || customDensity <= 0) {
|
|
60
|
-
throw new
|
|
64
|
+
throw new RangeError('Custom density must be provided and greater than zero');
|
|
61
65
|
}
|
|
62
66
|
density = customDensity;
|
|
63
67
|
}
|
|
64
68
|
else {
|
|
65
69
|
const aggregateInfo = AGGREGATE_DENSITIES.find(a => a.type === aggregateType);
|
|
66
70
|
if (!aggregateInfo) {
|
|
67
|
-
throw new
|
|
71
|
+
throw new RangeError(`Unknown aggregate type: ${aggregateType}`);
|
|
68
72
|
}
|
|
69
73
|
density = aggregateInfo.density;
|
|
70
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../src/construction/aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB;IACrD,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;IAClD,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IAC9C,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,I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C;QAChF,CAAC;QACD,OAAO,GAAG,aAAa,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,MAAM,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,2BAA2B,aAAa,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,wBAAwB;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,GAAG,aAAa,EAAE,CAAC,CAAC,CAAC;IAE1D,wBAAwB;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;IAE5C,2BAA2B;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IAE/C,yDAAyD;IACzD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;IAEhD,wBAAwB;IACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAExC,OAAO;QACL,MAAM;QACN,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,OAAO;QACP,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -10,6 +10,13 @@ import type { MomentOfInertiaInput, MomentOfInertiaResult } from './types.js';
|
|
|
10
10
|
* Formulas from: Timoshenko "Mechanics of Materials", AISC Steel Manual,
|
|
11
11
|
* Roark's "Formulas for Stress and Strain"
|
|
12
12
|
*
|
|
13
|
+
* @throws {RangeError} Dimensions must be positive
|
|
14
|
+
* @throws {RangeError} Diameter must be positive
|
|
15
|
+
* @throws {RangeError} Diameters must be positive
|
|
16
|
+
* @throws {RangeError} Inner dimensions must be smaller than outer
|
|
17
|
+
* @throws {RangeError} Inner diameter must be smaller than outer
|
|
18
|
+
* @throws {RangeError} Web thickness must be less than flange width
|
|
19
|
+
* @throws {RangeError} 2 x flange thickness must be less than total height
|
|
13
20
|
* @param input - discriminated union by `shape`
|
|
14
21
|
* @returns section properties
|
|
15
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentOfInertia.d.ts","sourceRoot":"","sources":["../../src/construction/momentOfInertia.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E
|
|
1
|
+
{"version":3,"file":"momentOfInertia.d.ts","sourceRoot":"","sources":["../../src/construction/momentOfInertia.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAiBlF"}
|