formulab 0.1.11 → 0.5.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.
Files changed (332) hide show
  1. package/CHANGELOG.md +107 -10
  2. package/README.md +181 -22
  3. package/dist/automotive/brakingDistance.d.ts +16 -0
  4. package/dist/automotive/brakingDistance.d.ts.map +1 -0
  5. package/dist/automotive/brakingDistance.js +47 -0
  6. package/dist/automotive/brakingDistance.js.map +1 -0
  7. package/dist/automotive/index.d.ts +2 -1
  8. package/dist/automotive/index.d.ts.map +1 -1
  9. package/dist/automotive/index.js +1 -0
  10. package/dist/automotive/index.js.map +1 -1
  11. package/dist/automotive/types.d.ts +16 -0
  12. package/dist/automotive/types.d.ts.map +1 -1
  13. package/dist/battery/batteryPackConfig.d.ts +10 -0
  14. package/dist/battery/batteryPackConfig.d.ts.map +1 -0
  15. package/dist/battery/batteryPackConfig.js +28 -0
  16. package/dist/battery/batteryPackConfig.js.map +1 -0
  17. package/dist/battery/bmsBalancing.d.ts +11 -0
  18. package/dist/battery/bmsBalancing.d.ts.map +1 -0
  19. package/dist/battery/bmsBalancing.js +47 -0
  20. package/dist/battery/bmsBalancing.js.map +1 -0
  21. package/dist/battery/cRate.d.ts +10 -0
  22. package/dist/battery/cRate.d.ts.map +1 -0
  23. package/dist/battery/cRate.js +29 -0
  24. package/dist/battery/cRate.js.map +1 -0
  25. package/dist/battery/chargingProfile.d.ts +11 -0
  26. package/dist/battery/chargingProfile.d.ts.map +1 -0
  27. package/dist/battery/chargingProfile.js +38 -0
  28. package/dist/battery/chargingProfile.js.map +1 -0
  29. package/dist/battery/cycleLife.d.ts +11 -0
  30. package/dist/battery/cycleLife.d.ts.map +1 -0
  31. package/dist/battery/cycleLife.js +70 -0
  32. package/dist/battery/cycleLife.js.map +1 -0
  33. package/dist/battery/energyDensity.d.ts +10 -0
  34. package/dist/battery/energyDensity.d.ts.map +1 -0
  35. package/dist/battery/energyDensity.js +20 -0
  36. package/dist/battery/energyDensity.js.map +1 -0
  37. package/dist/battery/index.d.ts +12 -0
  38. package/dist/battery/index.d.ts.map +1 -0
  39. package/dist/battery/index.js +12 -0
  40. package/dist/battery/index.js.map +1 -0
  41. package/dist/battery/internalResistance.d.ts +11 -0
  42. package/dist/battery/internalResistance.d.ts.map +1 -0
  43. package/dist/battery/internalResistance.js +18 -0
  44. package/dist/battery/internalResistance.js.map +1 -0
  45. package/dist/battery/selfDischarge.d.ts +10 -0
  46. package/dist/battery/selfDischarge.d.ts.map +1 -0
  47. package/dist/battery/selfDischarge.js +17 -0
  48. package/dist/battery/selfDischarge.js.map +1 -0
  49. package/dist/battery/stateOfHealth.d.ts +11 -0
  50. package/dist/battery/stateOfHealth.d.ts.map +1 -0
  51. package/dist/battery/stateOfHealth.js +33 -0
  52. package/dist/battery/stateOfHealth.js.map +1 -0
  53. package/dist/battery/thermalRunaway.d.ts +11 -0
  54. package/dist/battery/thermalRunaway.d.ts.map +1 -0
  55. package/dist/battery/thermalRunaway.js +28 -0
  56. package/dist/battery/thermalRunaway.js.map +1 -0
  57. package/dist/battery/types.d.ts +175 -0
  58. package/dist/battery/types.d.ts.map +1 -0
  59. package/dist/battery/types.js +5 -0
  60. package/dist/battery/types.js.map +1 -0
  61. package/dist/chemical/dilution.d.ts.map +1 -1
  62. package/dist/chemical/dilution.js +21 -24
  63. package/dist/chemical/dilution.js.map +1 -1
  64. package/dist/chemical/heatTransfer.d.ts +16 -0
  65. package/dist/chemical/heatTransfer.d.ts.map +1 -0
  66. package/dist/chemical/heatTransfer.js +85 -0
  67. package/dist/chemical/heatTransfer.js.map +1 -0
  68. package/dist/chemical/index.d.ts +3 -1
  69. package/dist/chemical/index.d.ts.map +1 -1
  70. package/dist/chemical/index.js +2 -0
  71. package/dist/chemical/index.js.map +1 -1
  72. package/dist/chemical/pipeFlow.d.ts +17 -0
  73. package/dist/chemical/pipeFlow.d.ts.map +1 -0
  74. package/dist/chemical/pipeFlow.js +112 -0
  75. package/dist/chemical/pipeFlow.js.map +1 -0
  76. package/dist/chemical/reactor.js +2 -2
  77. package/dist/chemical/reactor.js.map +1 -1
  78. package/dist/chemical/types.d.ts +82 -10
  79. package/dist/chemical/types.d.ts.map +1 -1
  80. package/dist/construction/index.d.ts +2 -1
  81. package/dist/construction/index.d.ts.map +1 -1
  82. package/dist/construction/index.js +1 -0
  83. package/dist/construction/index.js.map +1 -1
  84. package/dist/construction/momentOfInertia.d.ts +17 -0
  85. package/dist/construction/momentOfInertia.d.ts.map +1 -0
  86. package/dist/construction/momentOfInertia.js +204 -0
  87. package/dist/construction/momentOfInertia.js.map +1 -0
  88. package/dist/construction/pert.d.ts.map +1 -1
  89. package/dist/construction/pert.js +1 -17
  90. package/dist/construction/pert.js.map +1 -1
  91. package/dist/construction/types.d.ts +50 -0
  92. package/dist/construction/types.d.ts.map +1 -1
  93. package/dist/electronics/index.d.ts +2 -1
  94. package/dist/electronics/index.d.ts.map +1 -1
  95. package/dist/electronics/index.js +1 -0
  96. package/dist/electronics/index.js.map +1 -1
  97. package/dist/electronics/ohmsLaw.d.ts +12 -0
  98. package/dist/electronics/ohmsLaw.d.ts.map +1 -0
  99. package/dist/electronics/ohmsLaw.js +69 -0
  100. package/dist/electronics/ohmsLaw.js.map +1 -0
  101. package/dist/electronics/types.d.ts +24 -0
  102. package/dist/electronics/types.d.ts.map +1 -1
  103. package/dist/energy/carbonFootprint.d.ts.map +1 -1
  104. package/dist/energy/carbonFootprint.js +2 -1
  105. package/dist/energy/carbonFootprint.js.map +1 -1
  106. package/dist/energy/index.d.ts +2 -1
  107. package/dist/energy/index.d.ts.map +1 -1
  108. package/dist/energy/index.js +1 -0
  109. package/dist/energy/index.js.map +1 -1
  110. package/dist/energy/powerCost.d.ts.map +1 -1
  111. package/dist/energy/powerCost.js +2 -1
  112. package/dist/energy/powerCost.js.map +1 -1
  113. package/dist/energy/solarOutput.d.ts +14 -0
  114. package/dist/energy/solarOutput.d.ts.map +1 -0
  115. package/dist/energy/solarOutput.js +54 -0
  116. package/dist/energy/solarOutput.js.map +1 -0
  117. package/dist/energy/types.d.ts +20 -0
  118. package/dist/energy/types.d.ts.map +1 -1
  119. package/dist/environmental/emissionsIntensity.d.ts +11 -0
  120. package/dist/environmental/emissionsIntensity.d.ts.map +1 -0
  121. package/dist/environmental/emissionsIntensity.js +26 -0
  122. package/dist/environmental/emissionsIntensity.js.map +1 -0
  123. package/dist/environmental/energyIntensity.d.ts +11 -0
  124. package/dist/environmental/energyIntensity.d.ts.map +1 -0
  125. package/dist/environmental/energyIntensity.js +19 -0
  126. package/dist/environmental/energyIntensity.js.map +1 -0
  127. package/dist/environmental/esgSummary.d.ts +11 -0
  128. package/dist/environmental/esgSummary.d.ts.map +1 -0
  129. package/dist/environmental/esgSummary.js +39 -0
  130. package/dist/environmental/esgSummary.js.map +1 -0
  131. package/dist/environmental/gwpCalculator.d.ts +11 -0
  132. package/dist/environmental/gwpCalculator.d.ts.map +1 -0
  133. package/dist/environmental/gwpCalculator.js +31 -0
  134. package/dist/environmental/gwpCalculator.js.map +1 -0
  135. package/dist/environmental/index.d.ts +12 -0
  136. package/dist/environmental/index.d.ts.map +1 -0
  137. package/dist/environmental/index.js +12 -0
  138. package/dist/environmental/index.js.map +1 -0
  139. package/dist/environmental/productCarbonFootprint.d.ts +11 -0
  140. package/dist/environmental/productCarbonFootprint.d.ts.map +1 -0
  141. package/dist/environmental/productCarbonFootprint.js +29 -0
  142. package/dist/environmental/productCarbonFootprint.js.map +1 -0
  143. package/dist/environmental/scope1Emissions.d.ts +11 -0
  144. package/dist/environmental/scope1Emissions.d.ts.map +1 -0
  145. package/dist/environmental/scope1Emissions.js +35 -0
  146. package/dist/environmental/scope1Emissions.js.map +1 -0
  147. package/dist/environmental/scope2Emissions.d.ts +11 -0
  148. package/dist/environmental/scope2Emissions.d.ts.map +1 -0
  149. package/dist/environmental/scope2Emissions.js +49 -0
  150. package/dist/environmental/scope2Emissions.js.map +1 -0
  151. package/dist/environmental/scope3Emissions.d.ts +11 -0
  152. package/dist/environmental/scope3Emissions.d.ts.map +1 -0
  153. package/dist/environmental/scope3Emissions.js +36 -0
  154. package/dist/environmental/scope3Emissions.js.map +1 -0
  155. package/dist/environmental/types.d.ts +165 -0
  156. package/dist/environmental/types.d.ts.map +1 -0
  157. package/dist/environmental/types.js +5 -0
  158. package/dist/environmental/types.js.map +1 -0
  159. package/dist/environmental/vocEmissions.d.ts +11 -0
  160. package/dist/environmental/vocEmissions.d.ts.map +1 -0
  161. package/dist/environmental/vocEmissions.js +23 -0
  162. package/dist/environmental/vocEmissions.js.map +1 -0
  163. package/dist/environmental/waterFootprint.d.ts +11 -0
  164. package/dist/environmental/waterFootprint.d.ts.map +1 -0
  165. package/dist/environmental/waterFootprint.js +21 -0
  166. package/dist/environmental/waterFootprint.js.map +1 -0
  167. package/dist/index.d.ts +3 -0
  168. package/dist/index.d.ts.map +1 -1
  169. package/dist/index.js +3 -0
  170. package/dist/index.js.map +1 -1
  171. package/dist/logistics/cbm.d.ts +7 -2
  172. package/dist/logistics/cbm.d.ts.map +1 -1
  173. package/dist/logistics/cbm.js +7 -2
  174. package/dist/logistics/cbm.js.map +1 -1
  175. package/dist/logistics/fillRate.d.ts.map +1 -1
  176. package/dist/logistics/fillRate.js +1 -17
  177. package/dist/logistics/fillRate.js.map +1 -1
  178. package/dist/logistics/safetyStock.d.ts.map +1 -1
  179. package/dist/logistics/safetyStock.js +2 -55
  180. package/dist/logistics/safetyStock.js.map +1 -1
  181. package/dist/machining/boltCircle.d.ts +16 -0
  182. package/dist/machining/boltCircle.d.ts.map +1 -0
  183. package/dist/machining/boltCircle.js +36 -0
  184. package/dist/machining/boltCircle.js.map +1 -0
  185. package/dist/machining/boringBarDeflection.d.ts +17 -0
  186. package/dist/machining/boringBarDeflection.d.ts.map +1 -0
  187. package/dist/machining/boringBarDeflection.js +54 -0
  188. package/dist/machining/boringBarDeflection.js.map +1 -0
  189. package/dist/machining/cuspHeight.d.ts +15 -0
  190. package/dist/machining/cuspHeight.d.ts.map +1 -0
  191. package/dist/machining/cuspHeight.js +23 -0
  192. package/dist/machining/cuspHeight.js.map +1 -0
  193. package/dist/machining/cycleTimeEstimator.d.ts +18 -0
  194. package/dist/machining/cycleTimeEstimator.d.ts.map +1 -0
  195. package/dist/machining/cycleTimeEstimator.js +62 -0
  196. package/dist/machining/cycleTimeEstimator.js.map +1 -0
  197. package/dist/machining/effectiveDiameter.d.ts +17 -0
  198. package/dist/machining/effectiveDiameter.d.ts.map +1 -0
  199. package/dist/machining/effectiveDiameter.js +24 -0
  200. package/dist/machining/effectiveDiameter.js.map +1 -0
  201. package/dist/machining/gaugeBlockStack.d.ts +16 -0
  202. package/dist/machining/gaugeBlockStack.d.ts.map +1 -0
  203. package/dist/machining/gaugeBlockStack.js +138 -0
  204. package/dist/machining/gaugeBlockStack.js.map +1 -0
  205. package/dist/machining/index.d.ts +14 -0
  206. package/dist/machining/index.d.ts.map +1 -0
  207. package/dist/machining/index.js +14 -0
  208. package/dist/machining/index.js.map +1 -0
  209. package/dist/machining/radialChipThinning.d.ts +18 -0
  210. package/dist/machining/radialChipThinning.d.ts.map +1 -0
  211. package/dist/machining/radialChipThinning.js +30 -0
  212. package/dist/machining/radialChipThinning.js.map +1 -0
  213. package/dist/machining/sineBarHeight.d.ts +16 -0
  214. package/dist/machining/sineBarHeight.d.ts.map +1 -0
  215. package/dist/machining/sineBarHeight.js +32 -0
  216. package/dist/machining/sineBarHeight.js.map +1 -0
  217. package/dist/machining/threadOverWires.d.ts +21 -0
  218. package/dist/machining/threadOverWires.d.ts.map +1 -0
  219. package/dist/machining/threadOverWires.js +54 -0
  220. package/dist/machining/threadOverWires.js.map +1 -0
  221. package/dist/machining/toolDeflection.d.ts +16 -0
  222. package/dist/machining/toolDeflection.d.ts.map +1 -0
  223. package/dist/machining/toolDeflection.js +36 -0
  224. package/dist/machining/toolDeflection.js.map +1 -0
  225. package/dist/machining/triangleSolver.d.ts +21 -0
  226. package/dist/machining/triangleSolver.d.ts.map +1 -0
  227. package/dist/machining/triangleSolver.js +120 -0
  228. package/dist/machining/triangleSolver.js.map +1 -0
  229. package/dist/machining/truePosition.d.ts +19 -0
  230. package/dist/machining/truePosition.d.ts.map +1 -0
  231. package/dist/machining/truePosition.js +44 -0
  232. package/dist/machining/truePosition.js.map +1 -0
  233. package/dist/machining/types.d.ts +201 -0
  234. package/dist/machining/types.d.ts.map +1 -0
  235. package/dist/machining/types.js +2 -0
  236. package/dist/machining/types.js.map +1 -0
  237. package/dist/math.d.ts +26 -0
  238. package/dist/math.d.ts.map +1 -0
  239. package/dist/math.js +95 -0
  240. package/dist/math.js.map +1 -0
  241. package/dist/metal/bendAllowance.d.ts.map +1 -1
  242. package/dist/metal/bendAllowance.js +2 -1
  243. package/dist/metal/bendAllowance.js.map +1 -1
  244. package/dist/metal/bolt.d.ts.map +1 -1
  245. package/dist/metal/bolt.js +3 -3
  246. package/dist/metal/bolt.js.map +1 -1
  247. package/dist/metal/flangeSpec.d.ts +10 -0
  248. package/dist/metal/flangeSpec.d.ts.map +1 -0
  249. package/dist/metal/flangeSpec.js +81 -0
  250. package/dist/metal/flangeSpec.js.map +1 -0
  251. package/dist/metal/index.d.ts +4 -1
  252. package/dist/metal/index.d.ts.map +1 -1
  253. package/dist/metal/index.js +3 -0
  254. package/dist/metal/index.js.map +1 -1
  255. package/dist/metal/materialGradeConverter.d.ts +10 -0
  256. package/dist/metal/materialGradeConverter.d.ts.map +1 -0
  257. package/dist/metal/materialGradeConverter.js +78 -0
  258. package/dist/metal/materialGradeConverter.js.map +1 -0
  259. package/dist/metal/metalWeight.d.ts +13 -3
  260. package/dist/metal/metalWeight.d.ts.map +1 -1
  261. package/dist/metal/metalWeight.js +24 -35
  262. package/dist/metal/metalWeight.js.map +1 -1
  263. package/dist/metal/pipeSpec.d.ts +10 -0
  264. package/dist/metal/pipeSpec.d.ts.map +1 -0
  265. package/dist/metal/pipeSpec.js +96 -0
  266. package/dist/metal/pipeSpec.js.map +1 -0
  267. package/dist/metal/roughness.js +1 -1
  268. package/dist/metal/roughness.js.map +1 -1
  269. package/dist/metal/types.d.ts +86 -13
  270. package/dist/metal/types.d.ts.map +1 -1
  271. package/dist/metal/weldHeat.js +1 -1
  272. package/dist/metal/weldHeat.js.map +1 -1
  273. package/dist/metal/welding.d.ts.map +1 -1
  274. package/dist/metal/welding.js +3 -2
  275. package/dist/metal/welding.js.map +1 -1
  276. package/dist/quality/controlChart.d.ts +26 -0
  277. package/dist/quality/controlChart.d.ts.map +1 -0
  278. package/dist/quality/controlChart.js +216 -0
  279. package/dist/quality/controlChart.js.map +1 -0
  280. package/dist/quality/cpk.d.ts +16 -4
  281. package/dist/quality/cpk.d.ts.map +1 -1
  282. package/dist/quality/cpk.js +16 -4
  283. package/dist/quality/cpk.js.map +1 -1
  284. package/dist/quality/dpmo.d.ts.map +1 -1
  285. package/dist/quality/dpmo.js +1 -61
  286. package/dist/quality/dpmo.js.map +1 -1
  287. package/dist/quality/index.d.ts +2 -1
  288. package/dist/quality/index.d.ts.map +1 -1
  289. package/dist/quality/index.js +1 -0
  290. package/dist/quality/index.js.map +1 -1
  291. package/dist/quality/oee.d.ts +12 -1
  292. package/dist/quality/oee.d.ts.map +1 -1
  293. package/dist/quality/oee.js +21 -9
  294. package/dist/quality/oee.js.map +1 -1
  295. package/dist/quality/ppk.d.ts.map +1 -1
  296. package/dist/quality/ppk.js +1 -16
  297. package/dist/quality/ppk.js.map +1 -1
  298. package/dist/quality/ppm.d.ts.map +1 -1
  299. package/dist/quality/ppm.js +1 -80
  300. package/dist/quality/ppm.js.map +1 -1
  301. package/dist/quality/types.d.ts +31 -0
  302. package/dist/quality/types.d.ts.map +1 -1
  303. package/dist/safety/fallClearance.d.ts.map +1 -1
  304. package/dist/safety/fallClearance.js +5 -4
  305. package/dist/safety/fallClearance.js.map +1 -1
  306. package/dist/safety/index.d.ts +2 -1
  307. package/dist/safety/index.d.ts.map +1 -1
  308. package/dist/safety/index.js +1 -0
  309. package/dist/safety/index.js.map +1 -1
  310. package/dist/safety/nioshLifting.d.ts +19 -10
  311. package/dist/safety/nioshLifting.d.ts.map +1 -1
  312. package/dist/safety/nioshLifting.js +19 -10
  313. package/dist/safety/nioshLifting.js.map +1 -1
  314. package/dist/safety/types.d.ts +19 -0
  315. package/dist/safety/types.d.ts.map +1 -1
  316. package/dist/safety/ventilationRate.d.ts +12 -0
  317. package/dist/safety/ventilationRate.d.ts.map +1 -0
  318. package/dist/safety/ventilationRate.js +71 -0
  319. package/dist/safety/ventilationRate.js.map +1 -0
  320. package/dist/utility/index.d.ts +1 -1
  321. package/dist/utility/index.d.ts.map +1 -1
  322. package/dist/utility/types.d.ts +0 -16
  323. package/dist/utility/types.d.ts.map +1 -1
  324. package/dist/utils.d.ts +3 -2
  325. package/dist/utils.d.ts.map +1 -1
  326. package/dist/utils.js +6 -4
  327. package/dist/utils.js.map +1 -1
  328. package/package.json +34 -3
  329. package/dist/utility/qrcode.d.ts +0 -30
  330. package/dist/utility/qrcode.d.ts.map +0 -1
  331. package/dist/utility/qrcode.js +0 -30
  332. 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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
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] - 2025-02-05
289
+ ## [0.1.0] - 2026-02-05
193
290
 
194
291
  ### Added
195
292
 
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  > Industrial & manufacturing calculation library for engineers
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/formulab.svg)](https://www.npmjs.com/package/formulab)
6
+ [![CI](https://github.com/iyulab/formulab/actions/workflows/ci.yml/badge.svg)](https://github.com/iyulab/formulab/actions/workflows/ci.yml)
6
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
8
9
 
@@ -10,13 +11,101 @@ A comprehensive collection of engineering formulas and calculations for manufact
10
11
 
11
12
  ## Features
12
13
 
13
- - **100+ industrial calculations** — OEE, Cpk, metal weight, CBM, NIOSH lifting, and more
14
- - **11 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility
14
+ - **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
15
+ - **14 specialized domains** — Quality, Metal, Chemical, Electronics, Construction, Automotive, Logistics, Energy, Safety, Food, Utility, Battery, Environmental, Machining
15
16
  - **Zero dependencies** — Lightweight and fast
16
17
  - **TypeScript first** — Full type definitions included
17
18
  - **Tree-shakeable** — Import only what you need
18
- - **Well tested** — Comprehensive test coverage
19
- - **Research-based** — Built on industry standards (ISO, OSHA, NIOSH, IPC)
19
+ - **1,956 tests** — Coverage thresholds: 90% lines, 95% functions, 85% branches ([CI pipeline](https://github.com/iyulab/formulab/actions/workflows/ci.yml))
20
+ - **Research-based** — Golden reference tests verified against NIOSH 94-110, AIAG/ASTM E2587, JIPM, ASME B16.5, ISO 22514-2, and more
21
+
22
+ ## Verification Status
23
+
24
+ | Domain | Functions | Golden Tests | Key References |
25
+ |--------|-----------|-------------|----------------|
26
+ | Quality | 14 | oee, cpk, controlChart | ISO 22400-2, AIAG/ASTM E2587, JIPM |
27
+ | Metal | 25 | metalWeight | Machinery's Handbook, ASME B36.10/B16.5 |
28
+ | Logistics | 14 | cbm | Physical formula |
29
+ | Safety | 7 | nioshLifting | NIOSH 94-110 |
30
+ | Chemical | 9 | — | Darcy-Weisbach, Fourier |
31
+ | Electronics | 11 | — | IPC-2221 |
32
+ | Construction | 12 | — | AISC, Timoshenko |
33
+ | Automotive | 8 | — | AASHTO |
34
+ | Energy | 7 | — | NREL PVWatts |
35
+ | Food | 4 | — | HACCP |
36
+ | Utility | 3 | — | — |
37
+ | Battery | 10 | — | IEEE 1188, IEC 62620, Battery University |
38
+ | Environmental | 10 | — | GHG Protocol, IPCC AR6, IEA 2023 |
39
+ | Machining | 12 | — | Machinery's Handbook, ASME Y14.5, Sandvik Coromant |
40
+
41
+ > Functions with golden reference tests have been verified against authoritative engineering sources.
42
+ > See each function's JSDoc for specific references.
43
+
44
+ ## Numerical Accuracy & Testing
45
+
46
+ ### Floating-Point Handling
47
+
48
+ All calculations use a sign-aware `roundTo()` utility with epsilon correction to avoid IEEE 754 rounding artifacts:
49
+
50
+ ```typescript
51
+ roundTo(0.615, 2) // → 0.62 (not 0.61)
52
+ roundTo(-2.555, 2) // → -2.56 (sign-aware)
53
+ ```
54
+
55
+ Non-finite values (`NaN`, `Infinity`) pass through unchanged. Each function's JSDoc specifies output precision (typically 2-4 decimal places).
56
+
57
+ ### Golden Reference Tests
58
+
59
+ The following functions include tests verified against published reference values:
60
+
61
+ | Function | Standard / Source | What is verified |
62
+ |----------|-------------------|------------------|
63
+ | `nioshLifting()` | NIOSH Publication 94-110 | LC=23kg ideal, FM/CM table values, RWL calculation |
64
+ | `oee()` | JIPM TPM Handbook | World-class OEE (A≥90%, P≥95%, Q≥99.9%), perfect 100% |
65
+ | `cpk()` | ISO 22514-2 | Six Sigma Cpk=2.0, minimum capable Cpk≈1.33, off-center penalty |
66
+ | `controlChart()` | AIAG/ASTM E2587-16 | A2, D3, D4, d2 constants for n=2, 3, 5 |
67
+ | `cbm()` | Physical formula | 20ft container 33.2m³, 1m³ cube reference |
68
+ | `metalWeight()` | Machinery's Handbook | Steel plate density 7.85 g/cm³ |
69
+ | `flangeSpec()` | ASME B16.5 | Class 150/300/600 flange dimensions |
70
+ | `pipeSpec()` | ASME B36.10 | SCH40/80/160 wall thickness |
71
+ | `awgProperties()` | ANSI/AWG | AWG 0-40 diameter, resistance |
72
+
73
+ ### Edge Case Handling
74
+
75
+ Functions validate or handle these boundary conditions:
76
+
77
+ - **Division by zero**: `cpk()` with zero standard deviation, `oee()` with zero planned time
78
+ - **Out-of-range inputs**: `tolerance()` rejects invalid IT grades, `aql()` validates lot sizes
79
+ - **Physical impossibility**: `pressFit()` rejects negative interference, `nioshLifting()` clamps multipliers to [0, 1]
80
+ - **Extreme values**: `aql()` handles 1M-unit lots, `awgProperties()` covers AWG 0-40
81
+
82
+ ### Optimization Functions — Algorithms & Limitations
83
+
84
+ Three functions solve NP-hard combinatorial problems using **heuristic** algorithms. They provide good practical results but **do not guarantee optimal solutions**:
85
+
86
+ | Function | Algorithm | Complexity | Optimality |
87
+ |----------|-----------|-----------|-----------|
88
+ | `tsp()` | Nearest Neighbor + 2-Opt local search; brute force for n ≤ 10 | O(n²) per NN start, O(n!) exact for n ≤ 10 | **Heuristic** — no approximation ratio guarantee; exact only for n ≤ 10 |
89
+ | `pallet3d()` | Bottom-Left-Fill + First Fit Decreasing with AABB collision & stability checks | O(m² × n) where m = placed boxes | **Heuristic** — greedy placement; enforces physical constraints (80% support, weight limit) |
90
+ | `cuttingStock()` | First Fit Decreasing (FFD) or Best Fit Decreasing (BFD), user-selectable | O(q²) worst case | **FFD: ≤ 11/9 × OPT + 1** (proven bound); not optimal |
91
+
92
+ > For mission-critical optimization requiring proven-optimal solutions, use dedicated solvers (e.g., OR-Tools, Gurobi). These functions are designed for quick shop-floor estimates.
93
+
94
+ ### CI Pipeline
95
+
96
+ GitHub Actions runs on every push to `main` and every pull request:
97
+
98
+ - **Matrix**: Node.js 18, 20
99
+ - **Steps**: `pnpm install` → `tsc` (type check) → `vitest run --coverage`
100
+ - **Coverage enforcement**: Fails if below thresholds (lines 90%, functions 95%, branches 85%, statements 90%)
101
+
102
+ ```bash
103
+ # Run tests locally
104
+ pnpm test
105
+
106
+ # Run with coverage report
107
+ pnpm test:coverage
108
+ ```
20
109
 
21
110
  ## Installation
22
111
 
@@ -68,16 +157,17 @@ console.log(volume.totalCbm); // 0.96 m³
68
157
 
69
158
  ## Domains
70
159
 
71
- ### Quality & Production (13 functions)
160
+ ### Quality & Production (14 functions)
72
161
 
73
162
  ```typescript
74
- import { oee, cpk, taktTime, dpmo } from 'formulab/quality';
163
+ import { oee, cpk, taktTime, dpmo, controlChart } from 'formulab/quality';
75
164
  ```
76
165
 
77
166
  | Function | Description |
78
167
  |----------|-------------|
79
168
  | `oee()` | Overall Equipment Effectiveness |
80
169
  | `cpk()` | Process Capability Index |
170
+ | `controlChart()` | SPC X-bar/R and X-bar/S charts |
81
171
  | `cycleTime()` | Cycle Time analysis |
82
172
  | `taktTime()` | Takt Time calculation |
83
173
  | `aql()` | AQL sampling inspection |
@@ -90,7 +180,7 @@ import { oee, cpk, taktTime, dpmo } from 'formulab/quality';
90
180
  | `rpn()` | Risk Priority Number (FMEA) |
91
181
  | `yieldCalc()` | First Pass Yield / RTY |
92
182
 
93
- ### Metal & Machining (22 functions)
183
+ ### Metal & Machining (25 functions)
94
184
 
95
185
  ```typescript
96
186
  import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
@@ -106,7 +196,7 @@ import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
106
196
  | `bearing()` | L10 bearing life calculation |
107
197
  | `bolt()` | Bolt torque and preload |
108
198
  | `cutting()` | Cutting speed, feed rate, RPM |
109
- | `cuttingStock()` | 1D cutting optimization |
199
+ | `cuttingStock()` | 1D cutting stock heuristic (FFD/BFD) |
110
200
  | `gear()` | Gear module calculation |
111
201
  | `hardness()` | Hardness conversion (HRC, HB, HV) |
112
202
  | `material()` | Material properties lookup |
@@ -120,11 +210,14 @@ import { metalWeight, bendAllowance, cutting, bearing } from 'formulab/metal';
120
210
  | `vibration()` | Natural frequency analysis |
121
211
  | `weldHeat()` | Weld heat input calculation |
122
212
  | `welding()` | Welding parameters |
213
+ | `materialGradeConverter()` | ASTM/EN/JIS/GB/KS grade cross-reference |
214
+ | `pipeSpec()` | ANSI/ASME pipe dimensions lookup |
215
+ | `flangeSpec()` | ASME B16.5 flange dimensions lookup |
123
216
 
124
- ### Chemical & Process (7 functions)
217
+ ### Chemical & Process (9 functions)
125
218
 
126
219
  ```typescript
127
- import { dilution, concentration, ph, reactor } from 'formulab/chemical';
220
+ import { dilution, concentration, ph, reactor, pipeFlow, heatTransfer } from 'formulab/chemical';
128
221
  ```
129
222
 
130
223
  | Function | Description |
@@ -132,19 +225,22 @@ import { dilution, concentration, ph, reactor } from 'formulab/chemical';
132
225
  | `batch()` | Batch scaling calculation |
133
226
  | `concentration()` | Concentration conversion |
134
227
  | `dilution()` | Dilution (C1V1 = C2V2) |
228
+ | `heatTransfer()` | Conduction/convection/radiation heat transfer |
135
229
  | `ph()` | pH and buffer calculations |
230
+ | `pipeFlow()` | Darcy-Weisbach pipe flow pressure drop |
136
231
  | `reactor()` | Reactor sizing |
137
232
  | `shelfLife()` | Shelf life prediction (Arrhenius) |
138
233
  | `injectionCycle()` | Injection molding cycle time |
139
234
 
140
- ### Electronics & SMT (10 functions)
235
+ ### Electronics & SMT (11 functions)
141
236
 
142
237
  ```typescript
143
- import { traceWidth, solderPaste, resistorDecode } from 'formulab/electronics';
238
+ import { traceWidth, solderPaste, resistorDecode, ohmsLaw } from 'formulab/electronics';
144
239
  ```
145
240
 
146
241
  | Function | Description |
147
242
  |----------|-------------|
243
+ | `ohmsLaw()` | Ohm's Law V/I/R/P calculator |
148
244
  | `reflowProfile()` | Reflow temperature profile |
149
245
  | `resistorDecode()` | Resistor color code decoder |
150
246
  | `smtTakt()` | SMT line takt time |
@@ -156,14 +252,15 @@ import { traceWidth, solderPaste, resistorDecode } from 'formulab/electronics';
156
252
  | `stencilAperture()` | Stencil aperture design |
157
253
  | `viaCurrent()` | Via current capacity |
158
254
 
159
- ### Construction (11 functions)
255
+ ### Construction (12 functions)
160
256
 
161
257
  ```typescript
162
- import { concreteMix, rebarWeight, slope, stair } from 'formulab/construction';
258
+ import { concreteMix, rebarWeight, slope, stair, momentOfInertia } from 'formulab/construction';
163
259
  ```
164
260
 
165
261
  | Function | Description |
166
262
  |----------|-------------|
263
+ | `momentOfInertia()` | Section properties (Ix, Sx, rx) for 7 shapes |
167
264
  | `beamLoad()` | Beam load calculation |
168
265
  | `concreteMix()` | Concrete mix ratio |
169
266
  | `earthwork()` | Earthwork volume |
@@ -176,14 +273,15 @@ import { concreteMix, rebarWeight, slope, stair } from 'formulab/construction';
176
273
  | `roof()` | Roof calculation |
177
274
  | `stair()` | Stair dimension calculation |
178
275
 
179
- ### Automotive (7 functions)
276
+ ### Automotive (8 functions)
180
277
 
181
278
  ```typescript
182
- import { batteryRuntime, evCharging, torque } from 'formulab/automotive';
279
+ import { batteryRuntime, evCharging, torque, brakingDistance } from 'formulab/automotive';
183
280
  ```
184
281
 
185
282
  | Function | Description |
186
283
  |----------|-------------|
284
+ | `brakingDistance()` | Stopping distance (AASHTO method) |
187
285
  | `batteryRuntime()` | Battery capacity/runtime |
188
286
  | `evCharging()` | EV charging time estimation |
189
287
  | `fuelEconomy()` | Fuel economy conversion |
@@ -207,22 +305,23 @@ import { cbm, eoq, safetyStock, kanban } from 'formulab/logistics';
207
305
  | `fillRate()` | Fill rate calculation |
208
306
  | `freightClass()` | NMFC freight class |
209
307
  | `kanban()` | Kanban quantity |
210
- | `pallet3d()` | 3D pallet optimization |
308
+ | `pallet3d()` | 3D pallet loading heuristic (BLF + FFD) |
211
309
  | `palletStack()` | Pallet stacking calculation |
212
310
  | `pickTime()` | Picking time estimation |
213
311
  | `safetyStock()` | Safety stock calculation |
214
312
  | `serviceLevel()` | Service level calculation |
215
313
  | `shipping()` | Shipping cost estimation |
216
- | `tsp()` | Traveling salesman problem |
314
+ | `tsp()` | TSP heuristic (NN + 2-Opt; exact for n ≤ 10) |
217
315
 
218
- ### Energy & Utilities (6 functions)
316
+ ### Energy & Utilities (7 functions)
219
317
 
220
318
  ```typescript
221
- import { powerCost, motorEfficiency, carbonFootprint } from 'formulab/energy';
319
+ import { powerCost, motorEfficiency, carbonFootprint, solarOutput } from 'formulab/energy';
222
320
  ```
223
321
 
224
322
  | Function | Description |
225
323
  |----------|-------------|
324
+ | `solarOutput()` | Solar panel output estimation (PVWatts-based) |
226
325
  | `carbonFootprint()` | Scope 2 emissions |
227
326
  | `compressedAirCost()` | Compressed air cost |
228
327
  | `motorEfficiency()` | Motor upgrade ROI |
@@ -230,14 +329,15 @@ import { powerCost, motorEfficiency, carbonFootprint } from 'formulab/energy';
230
329
  | `powerCost()` | Electricity cost with demand |
231
330
  | `vfdSavings()` | VFD energy savings |
232
331
 
233
- ### Safety & Ergonomics (6 functions)
332
+ ### Safety & Ergonomics (7 functions)
234
333
 
235
334
  ```typescript
236
- import { nioshLifting, noiseExposure, wbgtCalculate } from 'formulab/safety';
335
+ import { nioshLifting, noiseExposure, wbgtCalculate, ventilationRate } from 'formulab/safety';
237
336
  ```
238
337
 
239
338
  | Function | Description |
240
339
  |----------|-------------|
340
+ | `ventilationRate()` | Required ventilation ACH/CFM (ASHRAE/OSHA) |
241
341
  | `fallClearance()` | Fall protection clearance |
242
342
  | `nioshLifting()` | NIOSH lifting equation |
243
343
  | `noiseExposure()` | TWA/Dose calculation |
@@ -270,6 +370,65 @@ import { solveAssignment, calculateUnit } from 'formulab/utility';
270
370
  | `calculateUnit()` | Unit conversion |
271
371
  | `getUnitCategories()` | Get unit categories |
272
372
 
373
+ ### Battery (10 functions)
374
+
375
+ ```typescript
376
+ import { energyDensity, cRate, stateOfHealth, cycleLife } from 'formulab/battery';
377
+ ```
378
+
379
+ | Function | Description |
380
+ |----------|-------------|
381
+ | `energyDensity()` | Wh/kg and Wh/L energy density |
382
+ | `cRate()` | C-rate ↔ current/time conversion |
383
+ | `stateOfHealth()` | SOH % with degradation status |
384
+ | `batteryPackConfig()` | Series/parallel cell configuration |
385
+ | `cycleLife()` | Cycle life estimation (chemistry/DOD/temp) |
386
+ | `internalResistance()` | DCIR from OCV and load voltage |
387
+ | `selfDischarge()` | Self-discharge rate calculation |
388
+ | `thermalRunaway()` | Thermal safety margin analysis |
389
+ | `bmsBalancing()` | BMS cell balancing time estimation |
390
+ | `chargingProfile()` | CC-CV charging profile timing |
391
+
392
+ ### Environmental (10 functions)
393
+
394
+ ```typescript
395
+ import { scope1Emissions, scope2Emissions, gwpCalculator, esgSummary } from 'formulab/environmental';
396
+ ```
397
+
398
+ | Function | Description |
399
+ |----------|-------------|
400
+ | `scope1Emissions()` | Fuel combustion direct emissions (6 fuels) |
401
+ | `scope2Emissions()` | Purchased electricity emissions (12 regions) |
402
+ | `scope3Emissions()` | Supply chain spend-based emissions (8 categories) |
403
+ | `vocEmissions()` | VOC emissions with capture/destruction |
404
+ | `productCarbonFootprint()` | Product lifecycle carbon footprint |
405
+ | `gwpCalculator()` | GWP conversion (8 gases × 3 time horizons) |
406
+ | `energyIntensity()` | Energy intensity (MJ/unit, kWh/unit) |
407
+ | `waterFootprint()` | Water footprint (blue/green/grey) |
408
+ | `emissionsIntensity()` | Emissions intensity per unit/revenue/employee |
409
+ | `esgSummary()` | ESG reduction tracking and projections |
410
+
411
+ ### Machining & CNC (12 functions)
412
+
413
+ ```typescript
414
+ import { truePosition, boltCircle, toolDeflection, threadOverWires } from 'formulab/machining';
415
+ ```
416
+
417
+ | Function | Description |
418
+ |----------|-------------|
419
+ | `truePosition()` | GD&T True Position (diametral, MMC bonus) |
420
+ | `boltCircle()` | Bolt hole pattern coordinates |
421
+ | `sineBarHeight()` | Sine bar gauge block height |
422
+ | `radialChipThinning()` | Chip load compensation for light radial cuts |
423
+ | `toolDeflection()` | End mill cantilever deflection |
424
+ | `cuspHeight()` | Ball mill scallop height |
425
+ | `effectiveDiameter()` | Ball mill effective cutting diameter |
426
+ | `boringBarDeflection()` | Boring bar deflection with L/D guidance |
427
+ | `threadOverWires()` | 3-wire thread measurement |
428
+ | `gaugeBlockStack()` | Gauge block combination (47/88/81-pc sets) |
429
+ | `triangleSolver()` | Triangle solver (SSS/SAS/ASA/SSA) |
430
+ | `cycleTimeEstimator()` | CNC cycle time estimation |
431
+
273
432
  ## API Examples
274
433
 
275
434
  ### 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,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;;;;GAYG;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,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC1D,IAAI,QAAQ,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5E,IAAI,YAAY,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAE5E,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,KAAK,CAAC,4FAA4F,CAAC,CAAC;IAChH,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,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"}
@@ -1,4 +1,5 @@
1
1
  // Automotive domain formulas
2
+ export { brakingDistance } from './brakingDistance.js';
2
3
  export { batteryRuntime } from './batteryRuntime.js';
3
4
  export { evCharging } from './evCharging.js';
4
5
  export { fuelEconomy } from './fuelEconomy.js';
@@ -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
  */