formulab 0.1.11 → 0.5.0
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 +107 -10
- package/README.md +109 -17
- package/dist/automotive/brakingDistance.d.ts +16 -0
- package/dist/automotive/brakingDistance.d.ts.map +1 -0
- package/dist/automotive/brakingDistance.js +47 -0
- package/dist/automotive/brakingDistance.js.map +1 -0
- package/dist/automotive/index.d.ts +2 -1
- package/dist/automotive/index.d.ts.map +1 -1
- package/dist/automotive/index.js +1 -0
- package/dist/automotive/index.js.map +1 -1
- package/dist/automotive/types.d.ts +16 -0
- package/dist/automotive/types.d.ts.map +1 -1
- package/dist/battery/batteryPackConfig.d.ts +10 -0
- package/dist/battery/batteryPackConfig.d.ts.map +1 -0
- package/dist/battery/batteryPackConfig.js +28 -0
- package/dist/battery/batteryPackConfig.js.map +1 -0
- package/dist/battery/bmsBalancing.d.ts +11 -0
- package/dist/battery/bmsBalancing.d.ts.map +1 -0
- package/dist/battery/bmsBalancing.js +47 -0
- package/dist/battery/bmsBalancing.js.map +1 -0
- package/dist/battery/cRate.d.ts +10 -0
- package/dist/battery/cRate.d.ts.map +1 -0
- package/dist/battery/cRate.js +29 -0
- package/dist/battery/cRate.js.map +1 -0
- package/dist/battery/chargingProfile.d.ts +11 -0
- package/dist/battery/chargingProfile.d.ts.map +1 -0
- package/dist/battery/chargingProfile.js +38 -0
- package/dist/battery/chargingProfile.js.map +1 -0
- package/dist/battery/cycleLife.d.ts +11 -0
- package/dist/battery/cycleLife.d.ts.map +1 -0
- package/dist/battery/cycleLife.js +70 -0
- package/dist/battery/cycleLife.js.map +1 -0
- package/dist/battery/energyDensity.d.ts +10 -0
- package/dist/battery/energyDensity.d.ts.map +1 -0
- package/dist/battery/energyDensity.js +20 -0
- package/dist/battery/energyDensity.js.map +1 -0
- package/dist/battery/index.d.ts +12 -0
- package/dist/battery/index.d.ts.map +1 -0
- package/dist/battery/index.js +12 -0
- package/dist/battery/index.js.map +1 -0
- package/dist/battery/internalResistance.d.ts +11 -0
- package/dist/battery/internalResistance.d.ts.map +1 -0
- package/dist/battery/internalResistance.js +18 -0
- package/dist/battery/internalResistance.js.map +1 -0
- package/dist/battery/selfDischarge.d.ts +10 -0
- package/dist/battery/selfDischarge.d.ts.map +1 -0
- package/dist/battery/selfDischarge.js +17 -0
- package/dist/battery/selfDischarge.js.map +1 -0
- package/dist/battery/stateOfHealth.d.ts +11 -0
- package/dist/battery/stateOfHealth.d.ts.map +1 -0
- package/dist/battery/stateOfHealth.js +33 -0
- package/dist/battery/stateOfHealth.js.map +1 -0
- package/dist/battery/thermalRunaway.d.ts +11 -0
- package/dist/battery/thermalRunaway.d.ts.map +1 -0
- package/dist/battery/thermalRunaway.js +28 -0
- package/dist/battery/thermalRunaway.js.map +1 -0
- package/dist/battery/types.d.ts +175 -0
- package/dist/battery/types.d.ts.map +1 -0
- package/dist/battery/types.js +5 -0
- package/dist/battery/types.js.map +1 -0
- package/dist/chemical/dilution.d.ts.map +1 -1
- package/dist/chemical/dilution.js +21 -24
- package/dist/chemical/dilution.js.map +1 -1
- package/dist/chemical/heatTransfer.d.ts +16 -0
- package/dist/chemical/heatTransfer.d.ts.map +1 -0
- package/dist/chemical/heatTransfer.js +85 -0
- package/dist/chemical/heatTransfer.js.map +1 -0
- package/dist/chemical/index.d.ts +3 -1
- package/dist/chemical/index.d.ts.map +1 -1
- package/dist/chemical/index.js +2 -0
- package/dist/chemical/index.js.map +1 -1
- package/dist/chemical/pipeFlow.d.ts +17 -0
- package/dist/chemical/pipeFlow.d.ts.map +1 -0
- package/dist/chemical/pipeFlow.js +112 -0
- package/dist/chemical/pipeFlow.js.map +1 -0
- package/dist/chemical/reactor.js +2 -2
- package/dist/chemical/reactor.js.map +1 -1
- package/dist/chemical/types.d.ts +82 -10
- package/dist/chemical/types.d.ts.map +1 -1
- package/dist/construction/index.d.ts +2 -1
- package/dist/construction/index.d.ts.map +1 -1
- package/dist/construction/index.js +1 -0
- package/dist/construction/index.js.map +1 -1
- package/dist/construction/momentOfInertia.d.ts +17 -0
- package/dist/construction/momentOfInertia.d.ts.map +1 -0
- package/dist/construction/momentOfInertia.js +204 -0
- package/dist/construction/momentOfInertia.js.map +1 -0
- package/dist/construction/pert.d.ts.map +1 -1
- package/dist/construction/pert.js +1 -17
- package/dist/construction/pert.js.map +1 -1
- package/dist/construction/types.d.ts +50 -0
- package/dist/construction/types.d.ts.map +1 -1
- package/dist/electronics/index.d.ts +2 -1
- package/dist/electronics/index.d.ts.map +1 -1
- package/dist/electronics/index.js +1 -0
- package/dist/electronics/index.js.map +1 -1
- package/dist/electronics/ohmsLaw.d.ts +12 -0
- package/dist/electronics/ohmsLaw.d.ts.map +1 -0
- package/dist/electronics/ohmsLaw.js +69 -0
- package/dist/electronics/ohmsLaw.js.map +1 -0
- package/dist/electronics/types.d.ts +24 -0
- package/dist/electronics/types.d.ts.map +1 -1
- package/dist/energy/carbonFootprint.d.ts.map +1 -1
- package/dist/energy/carbonFootprint.js +2 -1
- package/dist/energy/carbonFootprint.js.map +1 -1
- package/dist/energy/index.d.ts +2 -1
- package/dist/energy/index.d.ts.map +1 -1
- package/dist/energy/index.js +1 -0
- package/dist/energy/index.js.map +1 -1
- package/dist/energy/powerCost.d.ts.map +1 -1
- package/dist/energy/powerCost.js +2 -1
- package/dist/energy/powerCost.js.map +1 -1
- package/dist/energy/solarOutput.d.ts +14 -0
- package/dist/energy/solarOutput.d.ts.map +1 -0
- package/dist/energy/solarOutput.js +54 -0
- package/dist/energy/solarOutput.js.map +1 -0
- package/dist/energy/types.d.ts +20 -0
- package/dist/energy/types.d.ts.map +1 -1
- package/dist/environmental/emissionsIntensity.d.ts +11 -0
- package/dist/environmental/emissionsIntensity.d.ts.map +1 -0
- package/dist/environmental/emissionsIntensity.js +26 -0
- package/dist/environmental/emissionsIntensity.js.map +1 -0
- package/dist/environmental/energyIntensity.d.ts +11 -0
- package/dist/environmental/energyIntensity.d.ts.map +1 -0
- package/dist/environmental/energyIntensity.js +19 -0
- package/dist/environmental/energyIntensity.js.map +1 -0
- package/dist/environmental/esgSummary.d.ts +11 -0
- package/dist/environmental/esgSummary.d.ts.map +1 -0
- package/dist/environmental/esgSummary.js +39 -0
- package/dist/environmental/esgSummary.js.map +1 -0
- package/dist/environmental/gwpCalculator.d.ts +11 -0
- package/dist/environmental/gwpCalculator.d.ts.map +1 -0
- package/dist/environmental/gwpCalculator.js +31 -0
- package/dist/environmental/gwpCalculator.js.map +1 -0
- package/dist/environmental/index.d.ts +12 -0
- package/dist/environmental/index.d.ts.map +1 -0
- package/dist/environmental/index.js +12 -0
- package/dist/environmental/index.js.map +1 -0
- package/dist/environmental/productCarbonFootprint.d.ts +11 -0
- package/dist/environmental/productCarbonFootprint.d.ts.map +1 -0
- package/dist/environmental/productCarbonFootprint.js +29 -0
- package/dist/environmental/productCarbonFootprint.js.map +1 -0
- package/dist/environmental/scope1Emissions.d.ts +11 -0
- package/dist/environmental/scope1Emissions.d.ts.map +1 -0
- package/dist/environmental/scope1Emissions.js +35 -0
- package/dist/environmental/scope1Emissions.js.map +1 -0
- package/dist/environmental/scope2Emissions.d.ts +11 -0
- package/dist/environmental/scope2Emissions.d.ts.map +1 -0
- package/dist/environmental/scope2Emissions.js +49 -0
- package/dist/environmental/scope2Emissions.js.map +1 -0
- package/dist/environmental/scope3Emissions.d.ts +11 -0
- package/dist/environmental/scope3Emissions.d.ts.map +1 -0
- package/dist/environmental/scope3Emissions.js +36 -0
- package/dist/environmental/scope3Emissions.js.map +1 -0
- package/dist/environmental/types.d.ts +165 -0
- package/dist/environmental/types.d.ts.map +1 -0
- package/dist/environmental/types.js +5 -0
- package/dist/environmental/types.js.map +1 -0
- package/dist/environmental/vocEmissions.d.ts +11 -0
- package/dist/environmental/vocEmissions.d.ts.map +1 -0
- package/dist/environmental/vocEmissions.js +23 -0
- package/dist/environmental/vocEmissions.js.map +1 -0
- package/dist/environmental/waterFootprint.d.ts +11 -0
- package/dist/environmental/waterFootprint.d.ts.map +1 -0
- package/dist/environmental/waterFootprint.js +21 -0
- package/dist/environmental/waterFootprint.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/logistics/cbm.d.ts +7 -2
- package/dist/logistics/cbm.d.ts.map +1 -1
- package/dist/logistics/cbm.js +7 -2
- package/dist/logistics/cbm.js.map +1 -1
- package/dist/logistics/fillRate.d.ts.map +1 -1
- package/dist/logistics/fillRate.js +1 -17
- package/dist/logistics/fillRate.js.map +1 -1
- package/dist/logistics/safetyStock.d.ts.map +1 -1
- package/dist/logistics/safetyStock.js +2 -55
- package/dist/logistics/safetyStock.js.map +1 -1
- package/dist/machining/boltCircle.d.ts +16 -0
- package/dist/machining/boltCircle.d.ts.map +1 -0
- package/dist/machining/boltCircle.js +36 -0
- package/dist/machining/boltCircle.js.map +1 -0
- package/dist/machining/boringBarDeflection.d.ts +17 -0
- package/dist/machining/boringBarDeflection.d.ts.map +1 -0
- package/dist/machining/boringBarDeflection.js +54 -0
- package/dist/machining/boringBarDeflection.js.map +1 -0
- package/dist/machining/cuspHeight.d.ts +15 -0
- package/dist/machining/cuspHeight.d.ts.map +1 -0
- package/dist/machining/cuspHeight.js +23 -0
- package/dist/machining/cuspHeight.js.map +1 -0
- package/dist/machining/cycleTimeEstimator.d.ts +18 -0
- package/dist/machining/cycleTimeEstimator.d.ts.map +1 -0
- package/dist/machining/cycleTimeEstimator.js +62 -0
- package/dist/machining/cycleTimeEstimator.js.map +1 -0
- package/dist/machining/effectiveDiameter.d.ts +17 -0
- package/dist/machining/effectiveDiameter.d.ts.map +1 -0
- package/dist/machining/effectiveDiameter.js +24 -0
- package/dist/machining/effectiveDiameter.js.map +1 -0
- package/dist/machining/gaugeBlockStack.d.ts +16 -0
- package/dist/machining/gaugeBlockStack.d.ts.map +1 -0
- package/dist/machining/gaugeBlockStack.js +138 -0
- package/dist/machining/gaugeBlockStack.js.map +1 -0
- package/dist/machining/index.d.ts +14 -0
- package/dist/machining/index.d.ts.map +1 -0
- package/dist/machining/index.js +14 -0
- package/dist/machining/index.js.map +1 -0
- package/dist/machining/radialChipThinning.d.ts +18 -0
- package/dist/machining/radialChipThinning.d.ts.map +1 -0
- package/dist/machining/radialChipThinning.js +30 -0
- package/dist/machining/radialChipThinning.js.map +1 -0
- package/dist/machining/sineBarHeight.d.ts +16 -0
- package/dist/machining/sineBarHeight.d.ts.map +1 -0
- package/dist/machining/sineBarHeight.js +32 -0
- package/dist/machining/sineBarHeight.js.map +1 -0
- package/dist/machining/threadOverWires.d.ts +21 -0
- package/dist/machining/threadOverWires.d.ts.map +1 -0
- package/dist/machining/threadOverWires.js +54 -0
- package/dist/machining/threadOverWires.js.map +1 -0
- package/dist/machining/toolDeflection.d.ts +16 -0
- package/dist/machining/toolDeflection.d.ts.map +1 -0
- package/dist/machining/toolDeflection.js +36 -0
- package/dist/machining/toolDeflection.js.map +1 -0
- package/dist/machining/triangleSolver.d.ts +21 -0
- package/dist/machining/triangleSolver.d.ts.map +1 -0
- package/dist/machining/triangleSolver.js +120 -0
- package/dist/machining/triangleSolver.js.map +1 -0
- package/dist/machining/truePosition.d.ts +19 -0
- package/dist/machining/truePosition.d.ts.map +1 -0
- package/dist/machining/truePosition.js +44 -0
- package/dist/machining/truePosition.js.map +1 -0
- package/dist/machining/types.d.ts +201 -0
- package/dist/machining/types.d.ts.map +1 -0
- package/dist/machining/types.js +2 -0
- package/dist/machining/types.js.map +1 -0
- package/dist/math.d.ts +26 -0
- package/dist/math.d.ts.map +1 -0
- package/dist/math.js +95 -0
- package/dist/math.js.map +1 -0
- package/dist/metal/bendAllowance.d.ts.map +1 -1
- package/dist/metal/bendAllowance.js +2 -1
- package/dist/metal/bendAllowance.js.map +1 -1
- package/dist/metal/bolt.d.ts.map +1 -1
- package/dist/metal/bolt.js +3 -3
- package/dist/metal/bolt.js.map +1 -1
- package/dist/metal/flangeSpec.d.ts +10 -0
- package/dist/metal/flangeSpec.d.ts.map +1 -0
- package/dist/metal/flangeSpec.js +81 -0
- package/dist/metal/flangeSpec.js.map +1 -0
- package/dist/metal/index.d.ts +4 -1
- package/dist/metal/index.d.ts.map +1 -1
- package/dist/metal/index.js +3 -0
- package/dist/metal/index.js.map +1 -1
- package/dist/metal/materialGradeConverter.d.ts +10 -0
- package/dist/metal/materialGradeConverter.d.ts.map +1 -0
- package/dist/metal/materialGradeConverter.js +78 -0
- package/dist/metal/materialGradeConverter.js.map +1 -0
- package/dist/metal/metalWeight.d.ts +13 -3
- package/dist/metal/metalWeight.d.ts.map +1 -1
- package/dist/metal/metalWeight.js +24 -35
- package/dist/metal/metalWeight.js.map +1 -1
- package/dist/metal/pipeSpec.d.ts +10 -0
- package/dist/metal/pipeSpec.d.ts.map +1 -0
- package/dist/metal/pipeSpec.js +96 -0
- package/dist/metal/pipeSpec.js.map +1 -0
- package/dist/metal/roughness.js +1 -1
- package/dist/metal/roughness.js.map +1 -1
- package/dist/metal/types.d.ts +86 -13
- package/dist/metal/types.d.ts.map +1 -1
- package/dist/metal/weldHeat.js +1 -1
- package/dist/metal/weldHeat.js.map +1 -1
- package/dist/metal/welding.d.ts.map +1 -1
- package/dist/metal/welding.js +3 -2
- package/dist/metal/welding.js.map +1 -1
- package/dist/quality/controlChart.d.ts +26 -0
- package/dist/quality/controlChart.d.ts.map +1 -0
- package/dist/quality/controlChart.js +216 -0
- package/dist/quality/controlChart.js.map +1 -0
- package/dist/quality/cpk.d.ts +16 -4
- package/dist/quality/cpk.d.ts.map +1 -1
- package/dist/quality/cpk.js +16 -4
- package/dist/quality/cpk.js.map +1 -1
- package/dist/quality/dpmo.d.ts.map +1 -1
- package/dist/quality/dpmo.js +1 -61
- package/dist/quality/dpmo.js.map +1 -1
- package/dist/quality/index.d.ts +2 -1
- package/dist/quality/index.d.ts.map +1 -1
- package/dist/quality/index.js +1 -0
- package/dist/quality/index.js.map +1 -1
- package/dist/quality/oee.d.ts +12 -1
- package/dist/quality/oee.d.ts.map +1 -1
- package/dist/quality/oee.js +21 -9
- package/dist/quality/oee.js.map +1 -1
- package/dist/quality/ppk.d.ts.map +1 -1
- package/dist/quality/ppk.js +1 -16
- package/dist/quality/ppk.js.map +1 -1
- package/dist/quality/ppm.d.ts.map +1 -1
- package/dist/quality/ppm.js +1 -80
- package/dist/quality/ppm.js.map +1 -1
- package/dist/quality/types.d.ts +31 -0
- package/dist/quality/types.d.ts.map +1 -1
- package/dist/safety/fallClearance.d.ts.map +1 -1
- package/dist/safety/fallClearance.js +5 -4
- package/dist/safety/fallClearance.js.map +1 -1
- package/dist/safety/index.d.ts +2 -1
- package/dist/safety/index.d.ts.map +1 -1
- package/dist/safety/index.js +1 -0
- package/dist/safety/index.js.map +1 -1
- package/dist/safety/nioshLifting.d.ts +19 -10
- package/dist/safety/nioshLifting.d.ts.map +1 -1
- package/dist/safety/nioshLifting.js +19 -10
- package/dist/safety/nioshLifting.js.map +1 -1
- package/dist/safety/types.d.ts +19 -0
- package/dist/safety/types.d.ts.map +1 -1
- package/dist/safety/ventilationRate.d.ts +12 -0
- package/dist/safety/ventilationRate.d.ts.map +1 -0
- package/dist/safety/ventilationRate.js +71 -0
- package/dist/safety/ventilationRate.js.map +1 -0
- package/dist/utility/index.d.ts +1 -1
- package/dist/utility/index.d.ts.map +1 -1
- package/dist/utility/types.d.ts +0 -16
- package/dist/utility/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/package.json +34 -3
- package/dist/utility/qrcode.d.ts +0 -30
- package/dist/utility/qrcode.d.ts.map +0 -1
- package/dist/utility/qrcode.js +0 -30
- package/dist/utility/qrcode.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,103 @@ 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.5.0] - 2026-02-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Machining** (new domain, 12 functions):
|
|
13
|
+
- `truePosition()` — GD&T True Position with MMC bonus tolerance (ASME Y14.5)
|
|
14
|
+
- `boltCircle()` — Bolt hole pattern coordinate calculation
|
|
15
|
+
- `sineBarHeight()` — Sine bar gauge block height with rounding error analysis
|
|
16
|
+
- `radialChipThinning()` — Radial chip thinning compensation for light cuts
|
|
17
|
+
- `toolDeflection()` — End mill cantilever deflection (carbide/HSS)
|
|
18
|
+
- `cuspHeight()` — Ball end mill scallop height and surface roughness
|
|
19
|
+
- `effectiveDiameter()` — Ball end mill effective cutting diameter at depth
|
|
20
|
+
- `boringBarDeflection()` — Boring bar deflection with L/D ratio guidance
|
|
21
|
+
- `threadOverWires()` — 3-wire thread measurement (60°/55°/29°/30° angles)
|
|
22
|
+
- `gaugeBlockStack()` — Gauge block combination using successive subtraction (47/88/81-pc sets)
|
|
23
|
+
- `triangleSolver()` — Triangle solver (SSS/SAS/ASA/AAS/SSA with law of cosines/sines)
|
|
24
|
+
- `cycleTimeEstimator()` — CNC cycle time estimation with operation breakdown
|
|
25
|
+
|
|
26
|
+
## [0.4.0] - 2026-02-07
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **Battery** (new domain, 10 functions):
|
|
31
|
+
- `energyDensity()` — Wh/kg and Wh/L energy density calculation
|
|
32
|
+
- `cRate()` — C-rate ↔ current/time bidirectional conversion
|
|
33
|
+
- `stateOfHealth()` — SOH % with degradation status thresholds (IEEE 1188)
|
|
34
|
+
- `batteryPackConfig()` — Series/parallel cell configuration calculator
|
|
35
|
+
- `cycleLife()` — Cycle life estimation with chemistry (7 types), DOD, and temperature factors
|
|
36
|
+
- `internalResistance()` — DCIR calculation from OCV and load voltage (IEC 61960)
|
|
37
|
+
- `selfDischarge()` — Self-discharge rate (daily and monthly %)
|
|
38
|
+
- `thermalRunaway()` — Thermal safety margin analysis (SAE J2464)
|
|
39
|
+
- `bmsBalancing()` — BMS passive cell balancing time estimation
|
|
40
|
+
- `chargingProfile()` — CC-CV charging profile timing with phase breakdown
|
|
41
|
+
|
|
42
|
+
- **Environmental** (new domain, 10 functions):
|
|
43
|
+
- `scope1Emissions()` — Direct combustion emissions with 6 fuel types (EPA/IPCC 2006 factors)
|
|
44
|
+
- `scope2Emissions()` — Purchased electricity emissions for 12 grid regions (IEA 2023 factors)
|
|
45
|
+
- `scope3Emissions()` — Supply chain spend-based emissions for 8 Scope 3 categories (EPA EEIO)
|
|
46
|
+
- `vocEmissions()` — VOC emissions with capture/destruction efficiency
|
|
47
|
+
- `productCarbonFootprint()` — Product lifecycle carbon footprint with stage breakdown (ISO 14067)
|
|
48
|
+
- `gwpCalculator()` — GWP conversion for 8 GHG gases × 3 time horizons (IPCC AR6)
|
|
49
|
+
- `energyIntensity()` — Energy intensity per unit/revenue (ISO 50001)
|
|
50
|
+
- `waterFootprint()` — Water footprint blue/green/grey breakdown (ISO 14046)
|
|
51
|
+
- `emissionsIntensity()` — Emissions intensity per unit/revenue/employee
|
|
52
|
+
- `esgSummary()` — ESG reduction tracking with projections (TCFD/CDP/SBTi)
|
|
53
|
+
|
|
54
|
+
- **Metal** (3 new functions, 22 → 25):
|
|
55
|
+
- `materialGradeConverter()` — ASTM/EN/JIS/GB/KS grade cross-reference (20 grades × 5 standards)
|
|
56
|
+
- `pipeSpec()` — ANSI/ASME B36.10 pipe dimensions lookup (15 sizes × 6 schedules)
|
|
57
|
+
- `flangeSpec()` — ASME B16.5 WN flange dimensions lookup (8 sizes × 3 pressure classes)
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- Total domains: 11 → 13
|
|
62
|
+
- Total function count: 111 → 134 (+23)
|
|
63
|
+
- Total test count: 1705 → 1887 (+182)
|
|
64
|
+
|
|
65
|
+
## [0.3.0] - 2026-02-06
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
|
|
69
|
+
- **Quality**: `controlChart()` — SPC X-bar/R and X-bar/S control charts with AIAG/ASTM E2587 constants (n=2..25)
|
|
70
|
+
- **Chemical**: `pipeFlow()` — Darcy-Weisbach pipe flow calculator with Swamee-Jain friction factor (laminar/transitional/turbulent)
|
|
71
|
+
- **Chemical**: `heatTransfer()` — Three modes: conduction (Fourier), convection (Newton), radiation (Stefan-Boltzmann)
|
|
72
|
+
- **Construction**: `momentOfInertia()` — Section properties (A, Ix, Iy, Sx, Sy, rx, ry) for 7 cross-section shapes (rectangle, circle, hollow rectangle, hollow circle, I-beam, T-section, C-channel)
|
|
73
|
+
- **Electronics**: `ohmsLaw()` — V/I/R/P calculator with discriminated union input
|
|
74
|
+
- **Energy**: `solarOutput()` — Solar panel output estimation based on PVWatts methodology
|
|
75
|
+
- **Safety**: `ventilationRate()` — Required ventilation rate (ACH/CFM/L/s) per ASHRAE 62.1 / OSHA guidelines
|
|
76
|
+
- **Automotive**: `brakingDistance()` — Stopping distance calculator per AASHTO method with grade adjustment
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- Total function count: 103 → 111
|
|
81
|
+
- Total test count: 1630 → 1705
|
|
82
|
+
|
|
83
|
+
## [0.2.0] - 2026-02-06
|
|
84
|
+
|
|
85
|
+
### Breaking Changes
|
|
86
|
+
- **`MetalWeightInput`**: Now a discriminated union by `shape`. Each shape variant requires its specific fields (e.g., `shape: 'plate'` requires `width` and `thickness`). The `materialName` field is now a `MaterialName` literal union type instead of `string`.
|
|
87
|
+
- **`DilutionInput`**: Now a discriminated union by `solveFor`. Each variant provides exactly the three known values, eliminating optional fields and `!` assertions.
|
|
88
|
+
- **`ReactorInput`**: Now a discriminated union by `shape`. `shape: 'cylindrical'` requires `height`; `shape: 'spherical'` does not accept `height`.
|
|
89
|
+
- **`BoltInput`**: Now a discriminated union by `mode`. `mode: 'torqueToPreload'` requires `torque`; `mode: 'preloadToTorque'` requires `preload`.
|
|
90
|
+
- **QR code types removed**: `QrcodeInput`, `QrcodeResult`, `ErrorCorrectionLevel` types and `qrcode.ts` module removed from `formulab/utility` (was empty shell with no implementation).
|
|
91
|
+
|
|
92
|
+
### Enhanced
|
|
93
|
+
- **`roundTo()`**: Fixed negative number rounding (`-2.555` now correctly rounds to `-2.56` instead of `-2.55`). Uses sign-aware epsilon correction.
|
|
94
|
+
- **`oee()`**: Results now consistently rounded via `roundTo()` (factors to 4 decimals, percentages to 1 decimal).
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
- **Duplicate code removal**: Consolidated `normalCDF()`, `normalInvCDF()`, and `clamp()` from 6 files into shared `math.ts` module.
|
|
98
|
+
- **`Math.round` inconsistency**: Replaced manual `Math.round(x * N) / N` patterns with `roundTo()` in 8 files (`metalWeight`, `fallClearance`, `welding`, `carbonFootprint`, `powerCost`, `bendAllowance`, `weldHeat`, `roughness`).
|
|
99
|
+
- **Duplicate test file**: Removed `src/metal/pressTonnage.test.ts` (14 duplicate tests); canonical version at `src/metal/__tests__/pressTonnage.test.ts` (19 tests) retained.
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
- **Coverage thresholds**: Raised from baseline (5% lines) to realistic levels (90% lines, 95% functions, 85% branches, 90% statements).
|
|
103
|
+
- Total test count: 1630 tests across 102 test files.
|
|
104
|
+
|
|
8
105
|
## [0.1.11] - 2026-02-06
|
|
9
106
|
|
|
10
107
|
### Enhanced
|
|
@@ -54,7 +151,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
54
151
|
- All domains now have 95%+ line coverage
|
|
55
152
|
- **Milestone**: 100% function coverage achieved, 98%+ line coverage, library fully tested
|
|
56
153
|
|
|
57
|
-
## [0.1.9] -
|
|
154
|
+
## [0.1.9] - 2026-02-05
|
|
58
155
|
|
|
59
156
|
### Added
|
|
60
157
|
- **Test suites (Cycle 13)**: 25개 함수 대규모 테스트 추가 (488 test cases)
|
|
@@ -72,7 +169,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
72
169
|
- construction 도메인: 83.30% lines
|
|
73
170
|
- **Milestone**: Line coverage 60% 돌파, 6개 도메인 90%+ 커버리지 달성
|
|
74
171
|
|
|
75
|
-
## [0.1.8] -
|
|
172
|
+
## [0.1.8] - 2026-02-05
|
|
76
173
|
|
|
77
174
|
### Added
|
|
78
175
|
- **Test suites (Cycle 11)**: `yieldCalc`, `rpn`, `ppm` (quality), `safetyStock`, `kanban` (logistics)
|
|
@@ -91,7 +188,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
91
188
|
- energy 도메인: 26.45% → 100% lines
|
|
92
189
|
- **Milestone**: Line coverage 35% 돌파, 4개 도메인 100% 커버리지 달성
|
|
93
190
|
|
|
94
|
-
## [0.1.7] -
|
|
191
|
+
## [0.1.7] - 2026-02-05
|
|
95
192
|
|
|
96
193
|
### Added
|
|
97
194
|
- **Test suites**: `cutting`, `bearing`, `hardness` (metal domain, 45 test cases)
|
|
@@ -102,7 +199,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
102
199
|
- metal 도메인: 4.78% → 11.54% lines
|
|
103
200
|
- **Milestone**: Line coverage 20% 돌파
|
|
104
201
|
|
|
105
|
-
## [0.1.6] -
|
|
202
|
+
## [0.1.6] - 2026-02-05
|
|
106
203
|
|
|
107
204
|
### Added
|
|
108
205
|
- **Test suites**: `calculateUnit`, `getUnitCategories`, `getUnitsForCategory` (unit conversion, 29 test cases)
|
|
@@ -114,7 +211,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
114
211
|
- utility 도메인: 0% → 78.83% lines
|
|
115
212
|
- Branches coverage: 76.89% → 80.96%
|
|
116
213
|
|
|
117
|
-
## [0.1.5] -
|
|
214
|
+
## [0.1.5] - 2026-02-05
|
|
118
215
|
|
|
119
216
|
### Added
|
|
120
217
|
- **Test suites**: `ledResistor`, `awgProperties` (electronics domain, 33 test cases)
|
|
@@ -126,7 +223,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
126
223
|
- electronics 도메인: 0% → 18.77% lines
|
|
127
224
|
- food 도메인: 0% → 45.45% lines
|
|
128
225
|
|
|
129
|
-
## [0.1.4] -
|
|
226
|
+
## [0.1.4] - 2026-02-05
|
|
130
227
|
|
|
131
228
|
### Added
|
|
132
229
|
- **Test suites**: `slope`, `earthwork` (construction domain, 27 test cases)
|
|
@@ -138,7 +235,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
138
235
|
- construction 도메인: 0% → 7.73% lines
|
|
139
236
|
- energy 도메인: 0% → 26.45% lines
|
|
140
237
|
|
|
141
|
-
## [0.1.3] -
|
|
238
|
+
## [0.1.3] - 2026-02-05
|
|
142
239
|
|
|
143
240
|
### Added
|
|
144
241
|
- **Test suites**: `dilution`, `batch` (chemical domain, 25 test cases)
|
|
@@ -152,7 +249,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
152
249
|
### Changed
|
|
153
250
|
- Coverage improved: 8.8% → 10.38% lines
|
|
154
251
|
|
|
155
|
-
## [0.1.2] -
|
|
252
|
+
## [0.1.2] - 2026-02-05
|
|
156
253
|
|
|
157
254
|
### Added
|
|
158
255
|
- **Test suites**: `eoq`, `dimWeight`, `gearRatio` (40 additional test cases)
|
|
@@ -166,7 +263,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
166
263
|
- **Coverage thresholds**: Adjusted to realistic baseline (lines: 5%, functions: 50%, branches: 50%)
|
|
167
264
|
- Current coverage metrics: 8.8% lines, 62.38% functions, 72.25% branches
|
|
168
265
|
|
|
169
|
-
## [0.1.1] -
|
|
266
|
+
## [0.1.1] - 2026-02-05
|
|
170
267
|
|
|
171
268
|
### Fixed
|
|
172
269
|
- **Main entry point**: Added missing exports for 5 domains (metal, chemical, electronics, construction, energy)
|
|
@@ -189,7 +286,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
189
286
|
- Vitest coverage configuration with thresholds
|
|
190
287
|
- `test:coverage` npm script
|
|
191
288
|
|
|
192
|
-
## [0.1.0] -
|
|
289
|
+
## [0.1.0] - 2026-02-05
|
|
193
290
|
|
|
194
291
|
### Added
|
|
195
292
|
|
package/README.md
CHANGED
|
@@ -10,14 +10,36 @@ A comprehensive collection of engineering formulas and calculations for manufact
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
13
|
+
- **146 industrial calculations** — OEE, Cpk, SPC control charts, metal weight, CNC machining, GD&T, pipe flow, CBM, NIOSH lifting, battery SOH, GHG emissions, and more
|
|
14
|
+
- **14 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility, Battery, Environmental, Machining
|
|
15
15
|
- **Zero dependencies** — Lightweight and fast
|
|
16
16
|
- **TypeScript first** — Full type definitions included
|
|
17
17
|
- **Tree-shakeable** — Import only what you need
|
|
18
18
|
- **Well tested** — Comprehensive test coverage
|
|
19
19
|
- **Research-based** — Built on industry standards (ISO, OSHA, NIOSH, IPC)
|
|
20
20
|
|
|
21
|
+
## Verification Status
|
|
22
|
+
|
|
23
|
+
| Domain | Functions | Golden Tests | Key References |
|
|
24
|
+
|--------|-----------|-------------|----------------|
|
|
25
|
+
| Quality | 14 | oee, cpk, controlChart | ISO 22400-2, AIAG/ASTM E2587, JIPM |
|
|
26
|
+
| Metal | 25 | metalWeight | Machinery's Handbook, ASME B36.10/B16.5 |
|
|
27
|
+
| Logistics | 14 | cbm | Physical formula |
|
|
28
|
+
| Safety | 7 | nioshLifting | NIOSH 94-110 |
|
|
29
|
+
| Chemical | 9 | — | Darcy-Weisbach, Fourier |
|
|
30
|
+
| Electronics | 11 | — | IPC-2221 |
|
|
31
|
+
| Construction | 12 | — | AISC, Timoshenko |
|
|
32
|
+
| Automotive | 8 | — | AASHTO |
|
|
33
|
+
| Energy | 7 | — | NREL PVWatts |
|
|
34
|
+
| Food | 4 | — | HACCP |
|
|
35
|
+
| Utility | 3 | — | — |
|
|
36
|
+
| Battery | 10 | — | IEEE 1188, IEC 62620, Battery University |
|
|
37
|
+
| Environmental | 10 | — | GHG Protocol, IPCC AR6, IEA 2023 |
|
|
38
|
+
| Machining | 12 | — | Machinery's Handbook, ASME Y14.5, Sandvik Coromant |
|
|
39
|
+
|
|
40
|
+
> Functions with golden reference tests have been verified against authoritative engineering sources.
|
|
41
|
+
> See each function's JSDoc for specific references.
|
|
42
|
+
|
|
21
43
|
## Installation
|
|
22
44
|
|
|
23
45
|
```bash
|
|
@@ -68,16 +90,17 @@ console.log(volume.totalCbm); // 0.96 m³
|
|
|
68
90
|
|
|
69
91
|
## Domains
|
|
70
92
|
|
|
71
|
-
### Quality & Production (
|
|
93
|
+
### Quality & Production (14 functions)
|
|
72
94
|
|
|
73
95
|
```typescript
|
|
74
|
-
import { oee, cpk, taktTime, dpmo } from 'formulab/quality';
|
|
96
|
+
import { oee, cpk, taktTime, dpmo, controlChart } from 'formulab/quality';
|
|
75
97
|
```
|
|
76
98
|
|
|
77
99
|
| Function | Description |
|
|
78
100
|
|----------|-------------|
|
|
79
101
|
| `oee()` | Overall Equipment Effectiveness |
|
|
80
102
|
| `cpk()` | Process Capability Index |
|
|
103
|
+
| `controlChart()` | SPC X-bar/R and X-bar/S charts |
|
|
81
104
|
| `cycleTime()` | Cycle Time analysis |
|
|
82
105
|
| `taktTime()` | Takt Time calculation |
|
|
83
106
|
| `aql()` | AQL sampling inspection |
|
|
@@ -90,7 +113,7 @@ import { oee, cpk, taktTime, dpmo } from 'formulab/quality';
|
|
|
90
113
|
| `rpn()` | Risk Priority Number (FMEA) |
|
|
91
114
|
| `yieldCalc()` | First Pass Yield / RTY |
|
|
92
115
|
|
|
93
|
-
### Metal & Machining (
|
|
116
|
+
### Metal & Machining (25 functions)
|
|
94
117
|
|
|
95
118
|
```typescript
|
|
96
119
|
import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
|
|
@@ -120,11 +143,14 @@ import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
|
|
|
120
143
|
| `vibration()` | Natural frequency analysis |
|
|
121
144
|
| `weldHeat()` | Weld heat input calculation |
|
|
122
145
|
| `welding()` | Welding parameters |
|
|
146
|
+
| `materialGradeConverter()` | ASTM/EN/JIS/GB/KS grade cross-reference |
|
|
147
|
+
| `pipeSpec()` | ANSI/ASME pipe dimensions lookup |
|
|
148
|
+
| `flangeSpec()` | ASME B16.5 flange dimensions lookup |
|
|
123
149
|
|
|
124
|
-
### Chemical & Process (
|
|
150
|
+
### Chemical & Process (9 functions)
|
|
125
151
|
|
|
126
152
|
```typescript
|
|
127
|
-
import { dilution, concentration, ph, reactor } from 'formulab/chemical';
|
|
153
|
+
import { dilution, concentration, ph, reactor, pipeFlow, heatTransfer } from 'formulab/chemical';
|
|
128
154
|
```
|
|
129
155
|
|
|
130
156
|
| Function | Description |
|
|
@@ -132,19 +158,22 @@ import { dilution, concentration, ph, reactor } from 'formulab/chemical';
|
|
|
132
158
|
| `batch()` | Batch scaling calculation |
|
|
133
159
|
| `concentration()` | Concentration conversion |
|
|
134
160
|
| `dilution()` | Dilution (C1V1 = C2V2) |
|
|
161
|
+
| `heatTransfer()` | Conduction/convection/radiation heat transfer |
|
|
135
162
|
| `ph()` | pH and buffer calculations |
|
|
163
|
+
| `pipeFlow()` | Darcy-Weisbach pipe flow pressure drop |
|
|
136
164
|
| `reactor()` | Reactor sizing |
|
|
137
165
|
| `shelfLife()` | Shelf life prediction (Arrhenius) |
|
|
138
166
|
| `injectionCycle()` | Injection molding cycle time |
|
|
139
167
|
|
|
140
|
-
### Electronics & SMT (
|
|
168
|
+
### Electronics & SMT (11 functions)
|
|
141
169
|
|
|
142
170
|
```typescript
|
|
143
|
-
import { traceWidth, solderPaste, resistorDecode } from 'formulab/electronics';
|
|
171
|
+
import { traceWidth, solderPaste, resistorDecode, ohmsLaw } from 'formulab/electronics';
|
|
144
172
|
```
|
|
145
173
|
|
|
146
174
|
| Function | Description |
|
|
147
175
|
|----------|-------------|
|
|
176
|
+
| `ohmsLaw()` | Ohm's Law V/I/R/P calculator |
|
|
148
177
|
| `reflowProfile()` | Reflow temperature profile |
|
|
149
178
|
| `resistorDecode()` | Resistor color code decoder |
|
|
150
179
|
| `smtTakt()` | SMT line takt time |
|
|
@@ -156,14 +185,15 @@ import { traceWidth, solderPaste, resistorDecode } from 'formulab/electronics';
|
|
|
156
185
|
| `stencilAperture()` | Stencil aperture design |
|
|
157
186
|
| `viaCurrent()` | Via current capacity |
|
|
158
187
|
|
|
159
|
-
### Construction (
|
|
188
|
+
### Construction (12 functions)
|
|
160
189
|
|
|
161
190
|
```typescript
|
|
162
|
-
import { concreteMix, rebarWeight, slope, stair } from 'formulab/construction';
|
|
191
|
+
import { concreteMix, rebarWeight, slope, stair, momentOfInertia } from 'formulab/construction';
|
|
163
192
|
```
|
|
164
193
|
|
|
165
194
|
| Function | Description |
|
|
166
195
|
|----------|-------------|
|
|
196
|
+
| `momentOfInertia()` | Section properties (Ix, Sx, rx) for 7 shapes |
|
|
167
197
|
| `beamLoad()` | Beam load calculation |
|
|
168
198
|
| `concreteMix()` | Concrete mix ratio |
|
|
169
199
|
| `earthwork()` | Earthwork volume |
|
|
@@ -176,14 +206,15 @@ import { concreteMix, rebarWeight, slope, stair } from 'formulab/construction';
|
|
|
176
206
|
| `roof()` | Roof calculation |
|
|
177
207
|
| `stair()` | Stair dimension calculation |
|
|
178
208
|
|
|
179
|
-
### Automotive (
|
|
209
|
+
### Automotive (8 functions)
|
|
180
210
|
|
|
181
211
|
```typescript
|
|
182
|
-
import { batteryRuntime, evCharging, torque } from 'formulab/automotive';
|
|
212
|
+
import { batteryRuntime, evCharging, torque, brakingDistance } from 'formulab/automotive';
|
|
183
213
|
```
|
|
184
214
|
|
|
185
215
|
| Function | Description |
|
|
186
216
|
|----------|-------------|
|
|
217
|
+
| `brakingDistance()` | Stopping distance (AASHTO method) |
|
|
187
218
|
| `batteryRuntime()` | Battery capacity/runtime |
|
|
188
219
|
| `evCharging()` | EV charging time estimation |
|
|
189
220
|
| `fuelEconomy()` | Fuel economy conversion |
|
|
@@ -215,14 +246,15 @@ import { cbm, eoq, safetyStock, kanban } from 'formulab/logistics';
|
|
|
215
246
|
| `shipping()` | Shipping cost estimation |
|
|
216
247
|
| `tsp()` | Traveling salesman problem |
|
|
217
248
|
|
|
218
|
-
### Energy & Utilities (
|
|
249
|
+
### Energy & Utilities (7 functions)
|
|
219
250
|
|
|
220
251
|
```typescript
|
|
221
|
-
import { powerCost, motorEfficiency, carbonFootprint } from 'formulab/energy';
|
|
252
|
+
import { powerCost, motorEfficiency, carbonFootprint, solarOutput } from 'formulab/energy';
|
|
222
253
|
```
|
|
223
254
|
|
|
224
255
|
| Function | Description |
|
|
225
256
|
|----------|-------------|
|
|
257
|
+
| `solarOutput()` | Solar panel output estimation (PVWatts-based) |
|
|
226
258
|
| `carbonFootprint()` | Scope 2 emissions |
|
|
227
259
|
| `compressedAirCost()` | Compressed air cost |
|
|
228
260
|
| `motorEfficiency()` | Motor upgrade ROI |
|
|
@@ -230,14 +262,15 @@ import { powerCost, motorEfficiency, carbonFootprint } from 'formulab/energy';
|
|
|
230
262
|
| `powerCost()` | Electricity cost with demand |
|
|
231
263
|
| `vfdSavings()` | VFD energy savings |
|
|
232
264
|
|
|
233
|
-
### Safety & Ergonomics (
|
|
265
|
+
### Safety & Ergonomics (7 functions)
|
|
234
266
|
|
|
235
267
|
```typescript
|
|
236
|
-
import { nioshLifting, noiseExposure, wbgtCalculate } from 'formulab/safety';
|
|
268
|
+
import { nioshLifting, noiseExposure, wbgtCalculate, ventilationRate } from 'formulab/safety';
|
|
237
269
|
```
|
|
238
270
|
|
|
239
271
|
| Function | Description |
|
|
240
272
|
|----------|-------------|
|
|
273
|
+
| `ventilationRate()` | Required ventilation ACH/CFM (ASHRAE/OSHA) |
|
|
241
274
|
| `fallClearance()` | Fall protection clearance |
|
|
242
275
|
| `nioshLifting()` | NIOSH lifting equation |
|
|
243
276
|
| `noiseExposure()` | TWA/Dose calculation |
|
|
@@ -270,6 +303,65 @@ import { solveAssignment, calculateUnit } from 'formulab/utility';
|
|
|
270
303
|
| `calculateUnit()` | Unit conversion |
|
|
271
304
|
| `getUnitCategories()` | Get unit categories |
|
|
272
305
|
|
|
306
|
+
### Battery (10 functions)
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { energyDensity, cRate, stateOfHealth, cycleLife } from 'formulab/battery';
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
| Function | Description |
|
|
313
|
+
|----------|-------------|
|
|
314
|
+
| `energyDensity()` | Wh/kg and Wh/L energy density |
|
|
315
|
+
| `cRate()` | C-rate ↔ current/time conversion |
|
|
316
|
+
| `stateOfHealth()` | SOH % with degradation status |
|
|
317
|
+
| `batteryPackConfig()` | Series/parallel cell configuration |
|
|
318
|
+
| `cycleLife()` | Cycle life estimation (chemistry/DOD/temp) |
|
|
319
|
+
| `internalResistance()` | DCIR from OCV and load voltage |
|
|
320
|
+
| `selfDischarge()` | Self-discharge rate calculation |
|
|
321
|
+
| `thermalRunaway()` | Thermal safety margin analysis |
|
|
322
|
+
| `bmsBalancing()` | BMS cell balancing time estimation |
|
|
323
|
+
| `chargingProfile()` | CC-CV charging profile timing |
|
|
324
|
+
|
|
325
|
+
### Environmental (10 functions)
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
import { scope1Emissions, scope2Emissions, gwpCalculator, esgSummary } from 'formulab/environmental';
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
| Function | Description |
|
|
332
|
+
|----------|-------------|
|
|
333
|
+
| `scope1Emissions()` | Fuel combustion direct emissions (6 fuels) |
|
|
334
|
+
| `scope2Emissions()` | Purchased electricity emissions (12 regions) |
|
|
335
|
+
| `scope3Emissions()` | Supply chain spend-based emissions (8 categories) |
|
|
336
|
+
| `vocEmissions()` | VOC emissions with capture/destruction |
|
|
337
|
+
| `productCarbonFootprint()` | Product lifecycle carbon footprint |
|
|
338
|
+
| `gwpCalculator()` | GWP conversion (8 gases × 3 time horizons) |
|
|
339
|
+
| `energyIntensity()` | Energy intensity (MJ/unit, kWh/unit) |
|
|
340
|
+
| `waterFootprint()` | Water footprint (blue/green/grey) |
|
|
341
|
+
| `emissionsIntensity()` | Emissions intensity per unit/revenue/employee |
|
|
342
|
+
| `esgSummary()` | ESG reduction tracking and projections |
|
|
343
|
+
|
|
344
|
+
### Machining & CNC (12 functions)
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import { truePosition, boltCircle, toolDeflection, threadOverWires } from 'formulab/machining';
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
| Function | Description |
|
|
351
|
+
|----------|-------------|
|
|
352
|
+
| `truePosition()` | GD&T True Position (diametral, MMC bonus) |
|
|
353
|
+
| `boltCircle()` | Bolt hole pattern coordinates |
|
|
354
|
+
| `sineBarHeight()` | Sine bar gauge block height |
|
|
355
|
+
| `radialChipThinning()` | Chip load compensation for light radial cuts |
|
|
356
|
+
| `toolDeflection()` | End mill cantilever deflection |
|
|
357
|
+
| `cuspHeight()` | Ball mill scallop height |
|
|
358
|
+
| `effectiveDiameter()` | Ball mill effective cutting diameter |
|
|
359
|
+
| `boringBarDeflection()` | Boring bar deflection with L/D guidance |
|
|
360
|
+
| `threadOverWires()` | 3-wire thread measurement |
|
|
361
|
+
| `gaugeBlockStack()` | Gauge block combination (47/88/81-pc sets) |
|
|
362
|
+
| `triangleSolver()` | Triangle solver (SSS/SAS/ASA/SSA) |
|
|
363
|
+
| `cycleTimeEstimator()` | CNC cycle time estimation |
|
|
364
|
+
|
|
273
365
|
## API Examples
|
|
274
366
|
|
|
275
367
|
### OEE Calculation
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BrakingDistanceInput, BrakingDistanceResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Braking Distance Calculator (AASHTO method)
|
|
4
|
+
*
|
|
5
|
+
* Calculates stopping distance based on:
|
|
6
|
+
* - Reaction distance: d_r = v × t_reaction
|
|
7
|
+
* - Braking distance: d_b = v² / (2 × g × (f ± G))
|
|
8
|
+
* where G = grade/100 (positive uphill, negative downhill)
|
|
9
|
+
*
|
|
10
|
+
* Reference: AASHTO "A Policy on Geometric Design of Highways and Streets"
|
|
11
|
+
*
|
|
12
|
+
* @param input - speed, friction, reaction time, grade
|
|
13
|
+
* @returns stopping distance components
|
|
14
|
+
*/
|
|
15
|
+
export declare function brakingDistance(input: BrakingDistanceInput): BrakingDistanceResult;
|
|
16
|
+
//# sourceMappingURL=brakingDistance.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAqClF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Braking Distance Calculator (AASHTO method)
|
|
4
|
+
*
|
|
5
|
+
* Calculates stopping distance based on:
|
|
6
|
+
* - Reaction distance: d_r = v × t_reaction
|
|
7
|
+
* - Braking distance: d_b = v² / (2 × g × (f ± G))
|
|
8
|
+
* where G = grade/100 (positive uphill, negative downhill)
|
|
9
|
+
*
|
|
10
|
+
* Reference: AASHTO "A Policy on Geometric Design of Highways and Streets"
|
|
11
|
+
*
|
|
12
|
+
* @param input - speed, friction, reaction time, grade
|
|
13
|
+
* @returns stopping distance components
|
|
14
|
+
*/
|
|
15
|
+
export function brakingDistance(input) {
|
|
16
|
+
const { speed, friction, reactionTime, grade } = input;
|
|
17
|
+
if (speed <= 0)
|
|
18
|
+
throw new Error('Speed must be positive');
|
|
19
|
+
if (friction <= 0)
|
|
20
|
+
throw new Error('Friction coefficient must be positive');
|
|
21
|
+
if (reactionTime < 0)
|
|
22
|
+
throw new Error('Reaction time must be non-negative');
|
|
23
|
+
const g = 9.81; // m/s²
|
|
24
|
+
const speedMps = speed / 3.6; // km/h → m/s
|
|
25
|
+
const gradeDecimal = grade / 100; // % → decimal
|
|
26
|
+
// Reaction distance: d = v × t
|
|
27
|
+
const reactionDist = speedMps * reactionTime;
|
|
28
|
+
// Effective friction considering grade
|
|
29
|
+
// Uphill (positive grade) helps braking, downhill (negative) hinders
|
|
30
|
+
const effectiveFriction = friction + gradeDecimal;
|
|
31
|
+
if (effectiveFriction <= 0) {
|
|
32
|
+
throw new Error('Effective friction (friction + grade) must be positive — vehicle cannot stop on this grade');
|
|
33
|
+
}
|
|
34
|
+
// Deceleration: a = g × (f ± G)
|
|
35
|
+
const deceleration = g * effectiveFriction;
|
|
36
|
+
// Braking distance: d = v² / (2 × a)
|
|
37
|
+
const brakingDist = (speedMps * speedMps) / (2 * deceleration);
|
|
38
|
+
const totalStoppingDistance = reactionDist + brakingDist;
|
|
39
|
+
return {
|
|
40
|
+
reactionDistance: roundTo(reactionDist, 2),
|
|
41
|
+
brakingDistance: roundTo(brakingDist, 2),
|
|
42
|
+
totalStoppingDistance: roundTo(totalStoppingDistance, 2),
|
|
43
|
+
speedMps: roundTo(speedMps, 2),
|
|
44
|
+
deceleration: roundTo(deceleration, 2),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=brakingDistance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brakingDistance.js","sourceRoot":"","sources":["../../src/automotive/brakingDistance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA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AAqB,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,3 +1,4 @@
|
|
|
1
|
+
export { brakingDistance } from './brakingDistance.js';
|
|
1
2
|
export { batteryRuntime } from './batteryRuntime.js';
|
|
2
3
|
export { evCharging } from './evCharging.js';
|
|
3
4
|
export { fuelEconomy } from './fuelEconomy.js';
|
|
@@ -5,5 +6,5 @@ export { gearRatio } from './gearRatio.js';
|
|
|
5
6
|
export { tireCompare } from './tireCompare.js';
|
|
6
7
|
export { torque } from './torque.js';
|
|
7
8
|
export { power } from './power.js';
|
|
8
|
-
export type { BatteryInput, BatteryResult, ChargingInput, ChargingResult, FuelUnit, FuelInput, FuelResult, GearRatioInput, GearRatioResult, TireSpec, TireInput, TireData, TireResult, TorqueUnit, TorqueInput, TorqueResult, PowerUnit, PowerInput, PowerResult, } from './types.js';
|
|
9
|
+
export type { BrakingDistanceInput, BrakingDistanceResult, BatteryInput, BatteryResult, ChargingInput, ChargingResult, FuelUnit, FuelInput, FuelResult, GearRatioInput, GearRatioResult, TireSpec, TireInput, TireData, TireResult, TorqueUnit, TorqueInput, TorqueResult, PowerUnit, PowerInput, PowerResult, } from './types.js';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/automotive/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,YAAY,EAEV,YAAY,EACZ,aAAa,EAEb,aAAa,EACb,cAAc,EAEd,QAAQ,EACR,SAAS,EACT,UAAU,EAEV,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EAEV,UAAU,EACV,WAAW,EACX,YAAY,EAEZ,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/automotive/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,YAAY,EAEV,oBAAoB,EACpB,qBAAqB,EAErB,YAAY,EACZ,aAAa,EAEb,aAAa,EACb,cAAc,EAEd,QAAQ,EACR,SAAS,EACT,UAAU,EAEV,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EAEV,UAAU,EACV,WAAW,EACX,YAAY,EAEZ,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/automotive/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automotive/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automotive/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -98,6 +98,22 @@ export interface TorqueResult {
|
|
|
98
98
|
kgfm: number;
|
|
99
99
|
ftlbf: number;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Braking Distance Calculator Types (AASHTO)
|
|
103
|
+
*/
|
|
104
|
+
export interface BrakingDistanceInput {
|
|
105
|
+
speed: number;
|
|
106
|
+
friction: number;
|
|
107
|
+
reactionTime: number;
|
|
108
|
+
grade: number;
|
|
109
|
+
}
|
|
110
|
+
export interface BrakingDistanceResult {
|
|
111
|
+
reactionDistance: number;
|
|
112
|
+
brakingDistance: number;
|
|
113
|
+
totalStoppingDistance: number;
|
|
114
|
+
speedMps: number;
|
|
115
|
+
deceleration: number;
|
|
116
|
+
}
|
|
101
117
|
/**
|
|
102
118
|
* Power Converter Types
|
|
103
119
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/automotive/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAA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IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BatteryPackConfigInput, BatteryPackConfigResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate battery pack series/parallel cell configuration
|
|
4
|
+
*
|
|
5
|
+
* @formula S = ceil(Vtarget / Vcell), P = ceil(Ahtarget / Ahcell)
|
|
6
|
+
* @param input - Cell specs and target pack specs
|
|
7
|
+
* @returns Series/parallel count, actual voltage/capacity, total energy
|
|
8
|
+
*/
|
|
9
|
+
export declare function batteryPackConfig(input: BatteryPackConfigInput): BatteryPackConfigResult;
|
|
10
|
+
//# sourceMappingURL=batteryPackConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryPackConfig.d.ts","sourceRoot":"","sources":["../../src/battery/batteryPackConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAElF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,uBAAuB,CAqBxF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate battery pack series/parallel cell configuration
|
|
4
|
+
*
|
|
5
|
+
* @formula S = ceil(Vtarget / Vcell), P = ceil(Ahtarget / Ahcell)
|
|
6
|
+
* @param input - Cell specs and target pack specs
|
|
7
|
+
* @returns Series/parallel count, actual voltage/capacity, total energy
|
|
8
|
+
*/
|
|
9
|
+
export function batteryPackConfig(input) {
|
|
10
|
+
const { cellVoltage, cellCapacityAh, targetVoltage, targetCapacityAh } = input;
|
|
11
|
+
const seriesCells = Math.ceil(targetVoltage / cellVoltage);
|
|
12
|
+
const parallelCells = Math.ceil(targetCapacityAh / cellCapacityAh);
|
|
13
|
+
const totalCells = seriesCells * parallelCells;
|
|
14
|
+
const actualVoltage = roundTo(seriesCells * cellVoltage, 2);
|
|
15
|
+
const actualCapacityAh = roundTo(parallelCells * cellCapacityAh, 2);
|
|
16
|
+
const totalEnergyWh = roundTo(actualVoltage * actualCapacityAh, 2);
|
|
17
|
+
const totalEnergyKWh = roundTo(totalEnergyWh / 1000, 3);
|
|
18
|
+
return {
|
|
19
|
+
seriesCells,
|
|
20
|
+
parallelCells,
|
|
21
|
+
totalCells,
|
|
22
|
+
actualVoltage,
|
|
23
|
+
actualCapacityAh,
|
|
24
|
+
totalEnergyWh,
|
|
25
|
+
totalEnergyKWh,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=batteryPackConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryPackConfig.js","sourceRoot":"","sources":["../../src/battery/batteryPackConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAE/E,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;IAE/C,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,GAAG,cAAc,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IAExD,OAAO;QACL,WAAW;QACX,aAAa;QACb,UAAU;QACV,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BmsBalancingInput, BmsBalancingResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate BMS cell balancing time
|
|
4
|
+
*
|
|
5
|
+
* @formula time = (ΔV/Vavg × Ah × 1000) / ImA (minutes)
|
|
6
|
+
* @reference BMS design guidelines, passive balancing
|
|
7
|
+
* @param input - Cell voltages array, balancing current, cell capacity
|
|
8
|
+
* @returns Balancing time estimates and cell-level details
|
|
9
|
+
*/
|
|
10
|
+
export declare function bmsBalancing(input: BmsBalancingInput): BmsBalancingResult;
|
|
11
|
+
//# sourceMappingURL=bmsBalancing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bmsBalancing.d.ts","sourceRoot":"","sources":["../../src/battery/bmsBalancing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA+CzE"}
|