formulab 0.48.0 → 0.48.2
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 +18 -0
- package/dist/battery/chargingProfile.d.ts.map +1 -1
- package/dist/battery/chargingProfile.js +17 -12
- package/dist/battery/chargingProfile.js.map +1 -1
- package/dist/safety/fallClearance.d.ts.map +1 -1
- package/dist/safety/fallClearance.js +10 -4
- package/dist/safety/fallClearance.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.48.2] - 2026-09-24
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **`battery/chargingProfile()` minutes and average C-rate came from the rounded hours.** For example,
|
|
15
|
+
5 Ah at 2.5 A to a 0.25 A cutoff gave `cvPhaseTimeMin` 43.8 (0.73 h × 60) instead of 43.6 and
|
|
16
|
+
`totalTimeMin` 139.8 instead of 139.6. Every output is now rounded once from the unrounded value.
|
|
17
|
+
|
|
18
|
+
## [0.48.1] - 2026-09-24
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **`safety/fallClearance()` warned about compliant values.** OSHA 1926.502(d)(16) states each limit
|
|
23
|
+
in both feet and metres: "6 feet (1.8 m)" for free fall and "3.5 feet (1.07 m)" for deceleration.
|
|
24
|
+
The two do not convert exactly. 0.48.0 compared against the exact feet value, so a deceleration
|
|
25
|
+
distance of exactly 1.07 m — the standard's own metric figure and the usual absorber rating — was
|
|
26
|
+
reported as over the limit. A value is now within the limit if it meets either stated figure.
|
|
27
|
+
|
|
10
28
|
## [0.48.0] - 2026-09-24
|
|
11
29
|
|
|
12
30
|
### Changed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chargingProfile.d.ts","sourceRoot":"","sources":["../../src/battery/chargingProfile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,
|
|
1
|
+
{"version":3,"file":"chargingProfile.d.ts","sourceRoot":"","sources":["../../src/battery/chargingProfile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAyDlF"}
|
|
@@ -23,20 +23,25 @@ export function chargingProfile(input) {
|
|
|
23
23
|
if (!(ccEndSocPercent > 0) || ccEndSocPercent >= 100) {
|
|
24
24
|
throw new RangeError('ccEndSocPercent must be greater than 0 and less than 100');
|
|
25
25
|
}
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
const
|
|
26
|
+
// Every output is rounded once, from the unrounded value. Deriving minutes from the rounded
|
|
27
|
+
// hours (or the C-rate from the rounded total) would carry the hour rounding into them.
|
|
28
|
+
const ccAh = capacityAh * (ccEndSocPercent / 100);
|
|
29
|
+
const cvAh = capacityAh - ccAh;
|
|
29
30
|
// CC phase time = Ah / current
|
|
30
|
-
const
|
|
31
|
-
const ccPhaseTimeMin = roundTo(ccPhaseTimeH * 60, 1);
|
|
31
|
+
const ccH = ccAh / chargingCurrentA;
|
|
32
32
|
// CV phase time approximation: average current = (Icc + Icut) / 2
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
33
|
+
const cvH = cvAh / ((chargingCurrentA + cutoffCurrentA) / 2);
|
|
34
|
+
const totalH = ccH + cvH;
|
|
35
|
+
const ccPhaseAh = roundTo(ccAh, 2);
|
|
36
|
+
const cvPhaseAh = roundTo(cvAh, 2);
|
|
37
|
+
const ccPhaseTimeH = roundTo(ccH, 2);
|
|
38
|
+
const ccPhaseTimeMin = roundTo(ccH * 60, 1);
|
|
39
|
+
const cvPhaseTimeH = roundTo(cvH, 2);
|
|
40
|
+
const cvPhaseTimeMin = roundTo(cvH * 60, 1);
|
|
41
|
+
const totalTimeH = roundTo(totalH, 2);
|
|
42
|
+
const totalTimeMin = roundTo(totalH * 60, 1);
|
|
43
|
+
// Average C-rate over the entire charge: one capacity delivered over the total time
|
|
44
|
+
const averageCRate = roundTo(1 / totalH, 4);
|
|
40
45
|
return {
|
|
41
46
|
ccPhaseTimeH,
|
|
42
47
|
ccPhaseTimeMin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chargingProfile.js","sourceRoot":"","sources":["../../src/battery/chargingProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAAG,EAAE,GACrB,GAAG,KAAK,CAAC;IAEV,IAAI,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,CAAC,mCAAmC,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,UAAU,CAAC,yCAAyC,CAAC,CAAC;IAClE,CAAC;IACD,sFAAsF;IACtF,kEAAkE;IAClE,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAC;IAChE,CAAC;IACD,IAAI,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,eAAe,IAAI,G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AC,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IAEzB,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAE7C,oFAAoF;IACpF,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAE5C,OAAO;QACL,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,cAAc;QACd,UAAU;QACV,YAAY;QACZ,SAAS;QACT,SAAS;QACT,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallClearance.d.ts","sourceRoot":"","sources":["../../src/safety/fallClearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"fallClearance.d.ts","sourceRoot":"","sources":["../../src/safety/fallClearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAa1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CA+C5E"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { roundTo } from '../utils.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/*
|
|
3
|
+
* OSHA 29 CFR 1926.502(d)(16) states each limit in both units — "6 feet (1.8 m)", "3.5 feet
|
|
4
|
+
* (1.07 m)" — and the two do not convert exactly (6 ft = 1.8288 m, 3.5 ft = 1.0668 m). A value
|
|
5
|
+
* that meets either statement complies, so the limit is the larger of the two: a 6 ft lanyard's
|
|
6
|
+
* free fall and a 1.07 m absorber rating are both within the rule.
|
|
7
|
+
*/
|
|
8
|
+
/** OSHA 29 CFR 1926.502(d)(16)(iii) — free fall. */
|
|
9
|
+
const MAX_FREE_FALL = Math.max(6 * 0.3048, 1.8); // m
|
|
10
|
+
/** OSHA 29 CFR 1926.502(d)(16)(iv) — deceleration distance. */
|
|
11
|
+
const MAX_DECELERATION = Math.max(3.5 * 0.3048, 1.07); // m
|
|
6
12
|
/**
|
|
7
13
|
* Fall clearance for a personal fall arrest system on a fixed-length shock-absorbing lanyard.
|
|
8
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallClearance.js","sourceRoot":"","sources":["../../src/safety/fallClearance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,
|
|
1
|
+
{"version":3,"file":"fallClearance.js","sourceRoot":"","sources":["../../src/safety/fallClearance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;GAKG;AACH,oDAAoD;AACpD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI;AACrD,+DAA+D;AAC/D,MAAM,gB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AC;IACtG,MAAM,UAAU,GAAG,sBAAsB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,IAAI,CAAC,CAAC;IAExF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,gBAAgB,GAAG,aAAa,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,qFAAqF,CAAC,CAAC;IAClJ,CAAC;IACD,IAAI,EAAE,GAAG,gBAAgB,EAAE,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,sBAAsB,KAAK,IAAI,IAAI,sBAAsB,GAAG,CAAC,EAAE,CAAC;QAClE,QAAQ,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,uDAAuD,CAAC,CAAC;IAC/I,CAAC;IAED,OAAO;QACL,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACtD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC9C,sBAAsB;QACtB,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formulab",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.2",
|
|
4
4
|
"description": "Manufacturing & Engineering calculation formulas library - 203 industrial calculations across 15 domains for OEE, Cpk, SPC, FMEA, Nelson Rules, metal weight, CNC machining, GD&T, battery, environmental, pipe flow, logistics, IE time study, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|