formulab 0.5.1 → 0.9.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 +84 -0
- package/README.md +90 -26
- package/dist/automotive/chargingLoss.d.ts +15 -0
- package/dist/automotive/chargingLoss.d.ts.map +1 -0
- package/dist/automotive/chargingLoss.js +62 -0
- package/dist/automotive/chargingLoss.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 +23 -0
- package/dist/automotive/types.d.ts.map +1 -1
- package/dist/battery/guards.d.ts +7 -0
- package/dist/battery/guards.d.ts.map +1 -0
- package/dist/battery/guards.js +17 -0
- package/dist/battery/guards.js.map +1 -0
- package/dist/battery/index.d.ts +1 -0
- package/dist/battery/index.d.ts.map +1 -1
- package/dist/battery/index.js +2 -0
- package/dist/battery/index.js.map +1 -1
- package/dist/chemical/flowControl.d.ts +14 -0
- package/dist/chemical/flowControl.d.ts.map +1 -0
- package/dist/chemical/flowControl.js +69 -0
- package/dist/chemical/flowControl.js.map +1 -0
- package/dist/chemical/guards.d.ts +17 -0
- package/dist/chemical/guards.d.ts.map +1 -0
- package/dist/chemical/guards.js +54 -0
- package/dist/chemical/guards.js.map +1 -0
- package/dist/chemical/index.d.ts +5 -1
- package/dist/chemical/index.d.ts.map +1 -1
- package/dist/chemical/index.js +5 -0
- package/dist/chemical/index.js.map +1 -1
- package/dist/chemical/pid.d.ts +14 -0
- package/dist/chemical/pid.d.ts.map +1 -0
- package/dist/chemical/pid.js +103 -0
- package/dist/chemical/pid.js.map +1 -0
- package/dist/chemical/reliefValve.d.ts +14 -0
- package/dist/chemical/reliefValve.d.ts.map +1 -0
- package/dist/chemical/reliefValve.js +98 -0
- package/dist/chemical/reliefValve.js.map +1 -0
- package/dist/chemical/types.d.ts +63 -0
- package/dist/chemical/types.d.ts.map +1 -1
- package/dist/construction/guards.d.ts +7 -0
- package/dist/construction/guards.d.ts.map +1 -0
- package/dist/construction/guards.js +31 -0
- package/dist/construction/guards.js.map +1 -0
- package/dist/construction/index.d.ts +1 -0
- package/dist/construction/index.d.ts.map +1 -1
- package/dist/construction/index.js +2 -0
- package/dist/construction/index.js.map +1 -1
- package/dist/electronics/guards.d.ts +7 -0
- package/dist/electronics/guards.d.ts.map +1 -0
- package/dist/electronics/guards.js +17 -0
- package/dist/electronics/guards.js.map +1 -0
- package/dist/electronics/index.d.ts +1 -0
- package/dist/electronics/index.d.ts.map +1 -1
- package/dist/electronics/index.js +2 -0
- package/dist/electronics/index.js.map +1 -1
- package/dist/energy/boilerEfficiency.d.ts +13 -0
- package/dist/energy/boilerEfficiency.d.ts.map +1 -0
- package/dist/energy/boilerEfficiency.js +46 -0
- package/dist/energy/boilerEfficiency.js.map +1 -0
- package/dist/energy/cusum.d.ts +15 -0
- package/dist/energy/cusum.d.ts.map +1 -0
- package/dist/energy/cusum.js +71 -0
- package/dist/energy/cusum.js.map +1 -0
- package/dist/energy/degreeDay.d.ts +13 -0
- package/dist/energy/degreeDay.d.ts.map +1 -0
- package/dist/energy/degreeDay.js +46 -0
- package/dist/energy/degreeDay.js.map +1 -0
- package/dist/energy/heatPump.d.ts +13 -0
- package/dist/energy/heatPump.d.ts.map +1 -0
- package/dist/energy/heatPump.js +48 -0
- package/dist/energy/heatPump.js.map +1 -0
- package/dist/energy/index.d.ts +9 -1
- package/dist/energy/index.d.ts.map +1 -1
- package/dist/energy/index.js +8 -0
- package/dist/energy/index.js.map +1 -1
- package/dist/energy/insulationRoi.d.ts +14 -0
- package/dist/energy/insulationRoi.d.ts.map +1 -0
- package/dist/energy/insulationRoi.js +52 -0
- package/dist/energy/insulationRoi.js.map +1 -0
- package/dist/energy/ledRoi.d.ts +14 -0
- package/dist/energy/ledRoi.d.ts.map +1 -0
- package/dist/energy/ledRoi.js +49 -0
- package/dist/energy/ledRoi.js.map +1 -0
- package/dist/energy/transformerLoss.d.ts +13 -0
- package/dist/energy/transformerLoss.d.ts.map +1 -0
- package/dist/energy/transformerLoss.js +63 -0
- package/dist/energy/transformerLoss.js.map +1 -0
- package/dist/energy/types.d.ts +168 -0
- package/dist/energy/types.d.ts.map +1 -1
- package/dist/energy/windOutput.d.ts +14 -0
- package/dist/energy/windOutput.d.ts.map +1 -0
- package/dist/energy/windOutput.js +77 -0
- package/dist/energy/windOutput.js.map +1 -0
- package/dist/food/index.d.ts +3 -1
- package/dist/food/index.d.ts.map +1 -1
- package/dist/food/index.js +2 -0
- package/dist/food/index.js.map +1 -1
- package/dist/food/stabilityStudy.d.ts +15 -0
- package/dist/food/stabilityStudy.d.ts.map +1 -0
- package/dist/food/stabilityStudy.js +92 -0
- package/dist/food/stabilityStudy.js.map +1 -0
- package/dist/food/types.d.ts +43 -0
- package/dist/food/types.d.ts.map +1 -1
- package/dist/food/waterActivity.d.ts +17 -0
- package/dist/food/waterActivity.d.ts.map +1 -0
- package/dist/food/waterActivity.js +63 -0
- package/dist/food/waterActivity.js.map +1 -0
- package/dist/logistics/abcAnalysis.d.ts +15 -0
- package/dist/logistics/abcAnalysis.d.ts.map +1 -0
- package/dist/logistics/abcAnalysis.js +101 -0
- package/dist/logistics/abcAnalysis.js.map +1 -0
- package/dist/logistics/index.d.ts +4 -1
- package/dist/logistics/index.d.ts.map +1 -1
- package/dist/logistics/index.js +3 -0
- package/dist/logistics/index.js.map +1 -1
- package/dist/logistics/inventoryTurnover.d.ts +13 -0
- package/dist/logistics/inventoryTurnover.d.ts.map +1 -0
- package/dist/logistics/inventoryTurnover.js +36 -0
- package/dist/logistics/inventoryTurnover.js.map +1 -0
- package/dist/logistics/loadCapacity.d.ts +13 -0
- package/dist/logistics/loadCapacity.d.ts.map +1 -0
- package/dist/logistics/loadCapacity.js +46 -0
- package/dist/logistics/loadCapacity.js.map +1 -0
- package/dist/logistics/types.d.ts +78 -0
- package/dist/logistics/types.d.ts.map +1 -1
- package/dist/metal/guards.d.ts +12 -0
- package/dist/metal/guards.d.ts.map +1 -0
- package/dist/metal/guards.js +36 -0
- package/dist/metal/guards.js.map +1 -0
- package/dist/metal/index.d.ts +1 -0
- package/dist/metal/index.d.ts.map +1 -1
- package/dist/metal/index.js +2 -0
- package/dist/metal/index.js.map +1 -1
- package/dist/quality/cmk.d.ts +17 -0
- package/dist/quality/cmk.d.ts.map +1 -0
- package/dist/quality/cmk.js +43 -0
- package/dist/quality/cmk.js.map +1 -0
- package/dist/quality/gageRR.d.ts +18 -0
- package/dist/quality/gageRR.d.ts.map +1 -0
- package/dist/quality/gageRR.js +110 -0
- package/dist/quality/gageRR.js.map +1 -0
- package/dist/quality/index.d.ts +5 -1
- package/dist/quality/index.d.ts.map +1 -1
- package/dist/quality/index.js +4 -0
- package/dist/quality/index.js.map +1 -1
- package/dist/quality/paretoAnalysis.d.ts +15 -0
- package/dist/quality/paretoAnalysis.d.ts.map +1 -0
- package/dist/quality/paretoAnalysis.js +92 -0
- package/dist/quality/paretoAnalysis.js.map +1 -0
- package/dist/quality/types.d.ts +91 -0
- package/dist/quality/types.d.ts.map +1 -1
- package/dist/quality/weibull.d.ts +17 -0
- package/dist/quality/weibull.d.ts.map +1 -0
- package/dist/quality/weibull.js +106 -0
- package/dist/quality/weibull.js.map +1 -0
- package/dist/safety/arcFlash.d.ts +14 -0
- package/dist/safety/arcFlash.d.ts.map +1 -0
- package/dist/safety/arcFlash.js +90 -0
- package/dist/safety/arcFlash.js.map +1 -0
- package/dist/safety/confinedSpace.d.ts +15 -0
- package/dist/safety/confinedSpace.d.ts.map +1 -0
- package/dist/safety/confinedSpace.js +116 -0
- package/dist/safety/confinedSpace.js.map +1 -0
- package/dist/safety/ergonomicRisk.d.ts +9 -0
- package/dist/safety/ergonomicRisk.d.ts.map +1 -0
- package/dist/safety/ergonomicRisk.js +208 -0
- package/dist/safety/ergonomicRisk.js.map +1 -0
- package/dist/safety/illuminance.d.ts +13 -0
- package/dist/safety/illuminance.d.ts.map +1 -0
- package/dist/safety/illuminance.js +91 -0
- package/dist/safety/illuminance.js.map +1 -0
- package/dist/safety/index.d.ts +8 -1
- package/dist/safety/index.d.ts.map +1 -1
- package/dist/safety/index.js +7 -0
- package/dist/safety/index.js.map +1 -1
- package/dist/safety/ladderAngle.d.ts +16 -0
- package/dist/safety/ladderAngle.d.ts.map +1 -0
- package/dist/safety/ladderAngle.js +87 -0
- package/dist/safety/ladderAngle.js.map +1 -0
- package/dist/safety/lel.d.ts +14 -0
- package/dist/safety/lel.d.ts.map +1 -0
- package/dist/safety/lel.js +66 -0
- package/dist/safety/lel.js.map +1 -0
- package/dist/safety/thermalComfort.d.ts +14 -0
- package/dist/safety/thermalComfort.d.ts.map +1 -0
- package/dist/safety/thermalComfort.js +96 -0
- package/dist/safety/thermalComfort.js.map +1 -0
- package/dist/safety/types.d.ts +164 -0
- package/dist/safety/types.d.ts.map +1 -1
- package/dist/utility/bilinearInterpolation.d.ts +3 -0
- package/dist/utility/bilinearInterpolation.d.ts.map +1 -0
- package/dist/utility/bilinearInterpolation.js +47 -0
- package/dist/utility/bilinearInterpolation.js.map +1 -0
- package/dist/utility/correlation.d.ts +3 -0
- package/dist/utility/correlation.d.ts.map +1 -0
- package/dist/utility/correlation.js +29 -0
- package/dist/utility/correlation.js.map +1 -0
- package/dist/utility/depreciation.d.ts +3 -0
- package/dist/utility/depreciation.d.ts.map +1 -0
- package/dist/utility/depreciation.js +57 -0
- package/dist/utility/depreciation.js.map +1 -0
- package/dist/utility/histogram.d.ts +3 -0
- package/dist/utility/histogram.d.ts.map +1 -0
- package/dist/utility/histogram.js +42 -0
- package/dist/utility/histogram.js.map +1 -0
- package/dist/utility/index.d.ts +15 -1
- package/dist/utility/index.d.ts.map +1 -1
- package/dist/utility/index.js +14 -0
- package/dist/utility/index.js.map +1 -1
- package/dist/utility/lcc.d.ts +3 -0
- package/dist/utility/lcc.d.ts.map +1 -0
- package/dist/utility/lcc.js +26 -0
- package/dist/utility/lcc.js.map +1 -0
- package/dist/utility/linearInterpolation.d.ts +3 -0
- package/dist/utility/linearInterpolation.d.ts.map +1 -0
- package/dist/utility/linearInterpolation.js +42 -0
- package/dist/utility/linearInterpolation.js.map +1 -0
- package/dist/utility/movingAverage.d.ts +3 -0
- package/dist/utility/movingAverage.d.ts.map +1 -0
- package/dist/utility/movingAverage.js +41 -0
- package/dist/utility/movingAverage.js.map +1 -0
- package/dist/utility/normalize.d.ts +3 -0
- package/dist/utility/normalize.d.ts.map +1 -0
- package/dist/utility/normalize.js +35 -0
- package/dist/utility/normalize.js.map +1 -0
- package/dist/utility/npv.d.ts +3 -0
- package/dist/utility/npv.d.ts.map +1 -0
- package/dist/utility/npv.js +45 -0
- package/dist/utility/npv.js.map +1 -0
- package/dist/utility/percentile.d.ts +3 -0
- package/dist/utility/percentile.d.ts.map +1 -0
- package/dist/utility/percentile.js +24 -0
- package/dist/utility/percentile.js.map +1 -0
- package/dist/utility/regression.d.ts +3 -0
- package/dist/utility/regression.d.ts.map +1 -0
- package/dist/utility/regression.js +40 -0
- package/dist/utility/regression.js.map +1 -0
- package/dist/utility/roi.d.ts +3 -0
- package/dist/utility/roi.d.ts.map +1 -0
- package/dist/utility/roi.js +19 -0
- package/dist/utility/roi.js.map +1 -0
- package/dist/utility/statistics.d.ts +3 -0
- package/dist/utility/statistics.d.ts.map +1 -0
- package/dist/utility/statistics.js +34 -0
- package/dist/utility/statistics.js.map +1 -0
- package/dist/utility/types.d.ts +213 -1
- package/dist/utility/types.d.ts.map +1 -1
- package/dist/utility/unit.d.ts.map +1 -1
- package/dist/utility/unit.js +51 -0
- package/dist/utility/unit.js.map +1 -1
- package/dist/utility/weightedScore.d.ts +3 -0
- package/dist/utility/weightedScore.d.ts.map +1 -0
- package/dist/utility/weightedScore.js +35 -0
- package/dist/utility/weightedScore.js.map +1 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/electronics/index.ts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C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BoilerEfficiencyInput, BoilerEfficiencyResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate boiler thermal efficiency using the direct (input-output) method.
|
|
4
|
+
*
|
|
5
|
+
* η = (steamOutput × (steamEnthalpy − feedwaterEnthalpy)) / (fuelRate × fuelHeatValue) × 100
|
|
6
|
+
*
|
|
7
|
+
* Heat values are converted from kJ to kW by dividing by 3600 (kJ/h → kW).
|
|
8
|
+
*
|
|
9
|
+
* @param input - Boiler operating parameters
|
|
10
|
+
* @returns Boiler efficiency result with heat balance and optional annual metrics
|
|
11
|
+
*/
|
|
12
|
+
export declare function boilerEfficiency(input: BoilerEfficiencyInput): BoilerEfficiencyResult;
|
|
13
|
+
//# sourceMappingURL=boilerEfficiency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boilerEfficiency.d.ts","sourceRoot":"","sources":["../../src/energy/boilerEfficiency.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,sBAAsB,CA8CrF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate boiler thermal efficiency using the direct (input-output) method.
|
|
4
|
+
*
|
|
5
|
+
* η = (steamOutput × (steamEnthalpy − feedwaterEnthalpy)) / (fuelRate × fuelHeatValue) × 100
|
|
6
|
+
*
|
|
7
|
+
* Heat values are converted from kJ to kW by dividing by 3600 (kJ/h → kW).
|
|
8
|
+
*
|
|
9
|
+
* @param input - Boiler operating parameters
|
|
10
|
+
* @returns Boiler efficiency result with heat balance and optional annual metrics
|
|
11
|
+
*/
|
|
12
|
+
export function boilerEfficiency(input) {
|
|
13
|
+
const { fuelRate, fuelHeatValue, steamOutput, steamEnthalpy, feedwaterEnthalpy, operatingHours, fuelCost, } = input;
|
|
14
|
+
if (fuelRate <= 0 || fuelHeatValue <= 0) {
|
|
15
|
+
return {
|
|
16
|
+
heatInput: 0,
|
|
17
|
+
heatOutput: 0,
|
|
18
|
+
heatLoss: 0,
|
|
19
|
+
efficiency: 0,
|
|
20
|
+
annualFuelCost: null,
|
|
21
|
+
annualHeatLoss: null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// kJ/h → kW (÷ 3600)
|
|
25
|
+
const heatInput = (fuelRate * fuelHeatValue) / 3600;
|
|
26
|
+
const heatOutput = (steamOutput * (steamEnthalpy - feedwaterEnthalpy)) / 3600;
|
|
27
|
+
const heatLoss = heatInput - heatOutput;
|
|
28
|
+
const efficiency = (heatOutput / heatInput) * 100;
|
|
29
|
+
let annualFuelCost = null;
|
|
30
|
+
if (operatingHours !== undefined && fuelCost !== undefined) {
|
|
31
|
+
annualFuelCost = fuelRate * operatingHours * fuelCost;
|
|
32
|
+
}
|
|
33
|
+
let annualHeatLoss = null;
|
|
34
|
+
if (operatingHours !== undefined) {
|
|
35
|
+
annualHeatLoss = heatLoss * operatingHours;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
heatInput: roundTo(heatInput, 4),
|
|
39
|
+
heatOutput: roundTo(heatOutput, 4),
|
|
40
|
+
heatLoss: roundTo(heatLoss, 4),
|
|
41
|
+
efficiency: roundTo(efficiency, 4),
|
|
42
|
+
annualFuelCost: annualFuelCost !== null ? roundTo(annualFuelCost, 2) : null,
|
|
43
|
+
annualHeatLoss: annualHeatLoss !== null ? roundTo(annualHeatLoss, 4) : null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=boilerEfficiency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boilerEfficiency.js","sourceRoot":"","sources":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,CAAC,CAAC;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAClC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3E,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;KAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CusumInput, CusumResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* CUSUM (Cumulative Sum) Control Chart — Page's Algorithm
|
|
4
|
+
*
|
|
5
|
+
* @formula
|
|
6
|
+
* - C⁺ₙ = max(0, xₙ − (μ₀ + K) + C⁺ₙ₋₁)
|
|
7
|
+
* - C⁻ₙ = max(0, (μ₀ − K) − xₙ + C⁻ₙ₋₁)
|
|
8
|
+
* - Signal when C⁺ or C⁻ > H
|
|
9
|
+
*
|
|
10
|
+
* @reference Page, E.S. (1954). "Continuous inspection schemes"
|
|
11
|
+
* @reference ISO 50001:2018 — CUSUM for energy monitoring
|
|
12
|
+
* @reference Montgomery, D.C. "Introduction to Statistical Quality Control", Ch. 9
|
|
13
|
+
*/
|
|
14
|
+
export declare function cusum(input: CusumInput): CusumResult;
|
|
15
|
+
//# sourceMappingURL=cusum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cusum.d.ts","sourceRoot":"","sources":["../../src/energy/cusum.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CA4DpD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* CUSUM (Cumulative Sum) Control Chart — Page's Algorithm
|
|
4
|
+
*
|
|
5
|
+
* @formula
|
|
6
|
+
* - C⁺ₙ = max(0, xₙ − (μ₀ + K) + C⁺ₙ₋₁)
|
|
7
|
+
* - C⁻ₙ = max(0, (μ₀ − K) − xₙ + C⁻ₙ₋₁)
|
|
8
|
+
* - Signal when C⁺ or C⁻ > H
|
|
9
|
+
*
|
|
10
|
+
* @reference Page, E.S. (1954). "Continuous inspection schemes"
|
|
11
|
+
* @reference ISO 50001:2018 — CUSUM for energy monitoring
|
|
12
|
+
* @reference Montgomery, D.C. "Introduction to Statistical Quality Control", Ch. 9
|
|
13
|
+
*/
|
|
14
|
+
export function cusum(input) {
|
|
15
|
+
const { values, target } = input;
|
|
16
|
+
const n = values.length;
|
|
17
|
+
if (n === 0) {
|
|
18
|
+
return {
|
|
19
|
+
cusumPositive: [],
|
|
20
|
+
cusumNegative: [],
|
|
21
|
+
signals: [],
|
|
22
|
+
isOutOfControl: false,
|
|
23
|
+
shiftDetected: 'none',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// Auto-calculate stdDev if not provided
|
|
27
|
+
let sigma = input.stdDev;
|
|
28
|
+
if (sigma == null) {
|
|
29
|
+
const mean = values.reduce((s, v) => s + v, 0) / n;
|
|
30
|
+
sigma = Math.sqrt(values.reduce((s, v) => s + (v - mean) ** 2, 0) / (n - 1));
|
|
31
|
+
if (!Number.isFinite(sigma) || sigma <= 0)
|
|
32
|
+
sigma = 1;
|
|
33
|
+
}
|
|
34
|
+
const K = input.allowance ?? sigma / 2;
|
|
35
|
+
const H = input.decisionInterval ?? 5 * sigma;
|
|
36
|
+
const cusumPositive = [];
|
|
37
|
+
const cusumNegative = [];
|
|
38
|
+
const signals = [];
|
|
39
|
+
let hasPositiveSignal = false;
|
|
40
|
+
let hasNegativeSignal = false;
|
|
41
|
+
let cPlus = 0;
|
|
42
|
+
let cMinus = 0;
|
|
43
|
+
for (let i = 0; i < n; i++) {
|
|
44
|
+
cPlus = Math.max(0, values[i] - (target + K) + cPlus);
|
|
45
|
+
cMinus = Math.max(0, (target - K) - values[i] + cMinus);
|
|
46
|
+
cusumPositive.push(roundTo(cPlus, 4));
|
|
47
|
+
cusumNegative.push(roundTo(cMinus, 4));
|
|
48
|
+
if (cPlus > H || cMinus > H) {
|
|
49
|
+
signals.push(i);
|
|
50
|
+
if (cPlus > H)
|
|
51
|
+
hasPositiveSignal = true;
|
|
52
|
+
if (cMinus > H)
|
|
53
|
+
hasNegativeSignal = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let shiftDetected = 'none';
|
|
57
|
+
if (hasPositiveSignal && hasNegativeSignal)
|
|
58
|
+
shiftDetected = 'both';
|
|
59
|
+
else if (hasPositiveSignal)
|
|
60
|
+
shiftDetected = 'positive';
|
|
61
|
+
else if (hasNegativeSignal)
|
|
62
|
+
shiftDetected = 'negative';
|
|
63
|
+
return {
|
|
64
|
+
cusumPositive,
|
|
65
|
+
cusumNegative,
|
|
66
|
+
signals,
|
|
67
|
+
isOutOfControl: signals.length > 0,
|
|
68
|
+
shiftDetected,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=cusum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cusum.js","sourceRoot":"","sources":["../../src/energy/cusum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAExB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO;YACL,aAAa,EAAE,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_daily)
|
|
7
|
+
* - CDD = Σ max(0, T_daily − T_base_cooling)
|
|
8
|
+
*
|
|
9
|
+
* @reference ASHRAE Fundamentals Handbook — Degree Day Method
|
|
10
|
+
* @reference ISO 50001:2018 — Energy management systems
|
|
11
|
+
*/
|
|
12
|
+
export declare function degreeDay(input: DegreeDayInput): DegreeDayResult;
|
|
13
|
+
//# sourceMappingURL=degreeDay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"degreeDay.d.ts","sourceRoot":"","sources":["../../src/energy/degreeDay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAoChE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Degree Day (HDD/CDD) Calculator — ISO 50001 EnB
|
|
4
|
+
*
|
|
5
|
+
* @formula
|
|
6
|
+
* - HDD = Σ max(0, T_base_heating − T_daily)
|
|
7
|
+
* - CDD = Σ max(0, T_daily − T_base_cooling)
|
|
8
|
+
*
|
|
9
|
+
* @reference ASHRAE Fundamentals Handbook — Degree Day Method
|
|
10
|
+
* @reference ISO 50001:2018 — Energy management systems
|
|
11
|
+
*/
|
|
12
|
+
export function degreeDay(input) {
|
|
13
|
+
const { dailyTemps, baseHeating = 18, baseCooling = 24 } = input;
|
|
14
|
+
const totalDays = dailyTemps.length;
|
|
15
|
+
if (totalDays === 0) {
|
|
16
|
+
return { hdd: 0, cdd: 0, totalDays: 0, heatingDays: 0, coolingDays: 0, neutralDays: 0, avgTemp: 0 };
|
|
17
|
+
}
|
|
18
|
+
let hdd = 0;
|
|
19
|
+
let cdd = 0;
|
|
20
|
+
let heatingDays = 0;
|
|
21
|
+
let coolingDays = 0;
|
|
22
|
+
let sum = 0;
|
|
23
|
+
for (const temp of dailyTemps) {
|
|
24
|
+
sum += temp;
|
|
25
|
+
const hddContrib = Math.max(0, baseHeating - temp);
|
|
26
|
+
const cddContrib = Math.max(0, temp - baseCooling);
|
|
27
|
+
hdd += hddContrib;
|
|
28
|
+
cdd += cddContrib;
|
|
29
|
+
if (hddContrib > 0)
|
|
30
|
+
heatingDays++;
|
|
31
|
+
if (cddContrib > 0)
|
|
32
|
+
coolingDays++;
|
|
33
|
+
}
|
|
34
|
+
const neutralDays = totalDays - heatingDays - coolingDays;
|
|
35
|
+
const avgTemp = sum / totalDays;
|
|
36
|
+
return {
|
|
37
|
+
hdd: roundTo(hdd, 2),
|
|
38
|
+
cdd: roundTo(cdd, 2),
|
|
39
|
+
totalDays,
|
|
40
|
+
heatingDays,
|
|
41
|
+
coolingDays,
|
|
42
|
+
neutralDays,
|
|
43
|
+
avgTemp: roundTo(avgTemp, 2),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=degreeDay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"degreeDay.js","sourceRoot":"","sources":["../../src/energy/degreeDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,UAAU,EAAE,WAAW,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;IAEpC,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtG,CAAC;IAED,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,GAAG,GAAG,CAAC,CAAC;IAEZ,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,GAAG,IAAI,IAAI,CAAC;QACZ,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC;QACnD,GAAG,IAAI,UAAU,CAAC;QAClB,GAAG,IAAI,UAAU,CAAC;QAClB,IAAI,UAAU,GAAG,CAAC;YAAE,WAAW,EAAE,CAAC;QAClC,IAAI,UAAU,GAAG,CAAC;YAAE,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;IAC1D,MAAM,OAAO,GAAG,GAAG,GAAG,SAAS,CAAC;IAEhC,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpB,SAAS;QACT,WAAW;QACX,WAAW;QACX,WAAW;QACX,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HeatPumpInput, HeatPumpResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Heat Pump COP Calculator
|
|
4
|
+
*
|
|
5
|
+
* @formula
|
|
6
|
+
* - COP = heatingCapacity / (compressorPower + auxiliaryPower)
|
|
7
|
+
* - COP_Carnot = T_sink / (T_sink − T_source) (Kelvin)
|
|
8
|
+
* - Efficiency = COP / COP_Carnot × 100
|
|
9
|
+
*
|
|
10
|
+
* @reference EN 14511 — Air conditioners, liquid chilling packages and heat pumps
|
|
11
|
+
*/
|
|
12
|
+
export declare function heatPump(input: HeatPumpInput): HeatPumpResult;
|
|
13
|
+
//# sourceMappingURL=heatPump.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatPump.d.ts","sourceRoot":"","sources":["../../src/energy/heatPump.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA+C7D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Heat Pump COP Calculator
|
|
4
|
+
*
|
|
5
|
+
* @formula
|
|
6
|
+
* - COP = heatingCapacity / (compressorPower + auxiliaryPower)
|
|
7
|
+
* - COP_Carnot = T_sink / (T_sink − T_source) (Kelvin)
|
|
8
|
+
* - Efficiency = COP / COP_Carnot × 100
|
|
9
|
+
*
|
|
10
|
+
* @reference EN 14511 — Air conditioners, liquid chilling packages and heat pumps
|
|
11
|
+
*/
|
|
12
|
+
export function heatPump(input) {
|
|
13
|
+
const { sourceTemp, sinkTemp, heatingCapacity, compressorPower, auxiliaryPower = 0, operatingHours, electricityRate, boilerEfficiency, fuelCost, } = input;
|
|
14
|
+
const totalPower = compressorPower + auxiliaryPower;
|
|
15
|
+
const cop = totalPower > 0 ? heatingCapacity / totalPower : 0;
|
|
16
|
+
// Carnot COP (theoretical maximum)
|
|
17
|
+
const tSinkK = sinkTemp + 273.15;
|
|
18
|
+
const tSourceK = sourceTemp + 273.15;
|
|
19
|
+
const deltaT = tSinkK - tSourceK;
|
|
20
|
+
const copCarnot = deltaT > 0 ? tSinkK / deltaT : 0;
|
|
21
|
+
const efficiency = copCarnot > 0 ? roundTo((cop / copCarnot) * 100, 2) : 0;
|
|
22
|
+
// Annual calculations
|
|
23
|
+
let annualElectricity = null;
|
|
24
|
+
let annualElecCost = null;
|
|
25
|
+
let annualFuelCost = null;
|
|
26
|
+
let annualSavings = null;
|
|
27
|
+
if (operatingHours != null) {
|
|
28
|
+
annualElectricity = roundTo(totalPower * operatingHours, 2);
|
|
29
|
+
if (electricityRate != null) {
|
|
30
|
+
annualElecCost = roundTo(annualElectricity * electricityRate, 2);
|
|
31
|
+
if (boilerEfficiency != null && fuelCost != null && boilerEfficiency > 0) {
|
|
32
|
+
const heatDelivered = heatingCapacity * operatingHours;
|
|
33
|
+
annualFuelCost = roundTo((heatDelivered / boilerEfficiency) * fuelCost, 2);
|
|
34
|
+
annualSavings = roundTo(annualFuelCost - annualElecCost, 2);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
cop: roundTo(cop, 3),
|
|
40
|
+
copCarnot: roundTo(copCarnot, 3),
|
|
41
|
+
efficiency,
|
|
42
|
+
annualElectricity,
|
|
43
|
+
annualElecCost,
|
|
44
|
+
annualFuelCost,
|
|
45
|
+
annualSavings,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=heatPump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatPump.js","sourceRoot":"","sources":["../../src/energy/heatPump.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,EACJ,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EACtD,cAAc,GAAG,CAAC,EAAE,cAAc,EAAE,eAAe,EACnD,gBAAgB,EAAE,QAAQ,GAC3B,GAAG,KAAK,CAAC;IAEV,MAAM,UAAU,GAAG,eAAe,GAA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OAAO,CAAC,cAAc,GAAG,cAAc,EAAE,CAAC,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAChC,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,cAAc;QACd,aAAa;KACd,CAAC;AACJ,CAAC"}
|
package/dist/energy/index.d.ts
CHANGED
|
@@ -5,5 +5,13 @@ export { motorEfficiency } from './motorEfficiency.js';
|
|
|
5
5
|
export { pfCorrection } from './pfCorrection.js';
|
|
6
6
|
export { powerCost } from './powerCost.js';
|
|
7
7
|
export { vfdSavings } from './vfdSavings.js';
|
|
8
|
-
export
|
|
8
|
+
export { boilerEfficiency } from './boilerEfficiency.js';
|
|
9
|
+
export { transformerLoss } from './transformerLoss.js';
|
|
10
|
+
export { insulationRoi } from './insulationRoi.js';
|
|
11
|
+
export { ledRoi } from './ledRoi.js';
|
|
12
|
+
export { heatPump } from './heatPump.js';
|
|
13
|
+
export { degreeDay } from './degreeDay.js';
|
|
14
|
+
export { windOutput } from './windOutput.js';
|
|
15
|
+
export { cusum } from './cusum.js';
|
|
16
|
+
export type { SolarOutputInput, SolarOutputResult, CarbonFootprintInput, CarbonFootprintResult, CompressedAirCostInput, CompressedAirCostResult, MotorEfficiencyInput, MotorEfficiencyResult, PfCorrectionInput, PfCorrectionResult, PowerCostInput, PowerCostResult, VfdSavingsInput, VfdSavingsResult, BoilerEfficiencyInput, BoilerEfficiencyResult, TransformerLossInput, TransformerLossResult, InsulationRoiInput, InsulationRoiResult, LedRoiInput, LedRoiResult, HeatPumpInput, HeatPumpResult, DegreeDayInput, DegreeDayResult, WindOutputInput, WindOutputResult, CusumInput, CusumResult, } from './types.js';
|
|
9
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/energy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/energy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,YAAY,EAEV,gBAAgB,EAChB,iBAAiB,EAEjB,oBAAoB,EACpB,qBAAqB,EAErB,sBAAsB,EACtB,uBAAuB,EAEvB,oBAAoB,EACpB,qBAAqB,EAErB,iBAAiB,EACjB,kBAAkB,EAElB,cAAc,EACd,eAAe,EAEf,eAAe,EACf,gBAAgB,EAEhB,qBAAqB,EACrB,sBAAsB,EAEtB,oBAAoB,EACpB,qBAAqB,EAErB,kBAAkB,EAClB,mBAAmB,EAEnB,WAAW,EACX,YAAY,EAEZ,aAAa,EACb,cAAc,EAEd,cAAc,EACd,eAAe,EAEf,eAAe,EACf,gBAAgB,EAEhB,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/energy/index.js
CHANGED
|
@@ -6,4 +6,12 @@ export { motorEfficiency } from './motorEfficiency.js';
|
|
|
6
6
|
export { pfCorrection } from './pfCorrection.js';
|
|
7
7
|
export { powerCost } from './powerCost.js';
|
|
8
8
|
export { vfdSavings } from './vfdSavings.js';
|
|
9
|
+
export { boilerEfficiency } from './boilerEfficiency.js';
|
|
10
|
+
export { transformerLoss } from './transformerLoss.js';
|
|
11
|
+
export { insulationRoi } from './insulationRoi.js';
|
|
12
|
+
export { ledRoi } from './ledRoi.js';
|
|
13
|
+
export { heatPump } from './heatPump.js';
|
|
14
|
+
export { degreeDay } from './degreeDay.js';
|
|
15
|
+
export { windOutput } from './windOutput.js';
|
|
16
|
+
export { cusum } from './cusum.js';
|
|
9
17
|
//# sourceMappingURL=index.js.map
|
package/dist/energy/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/energy/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/energy/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InsulationRoiInput, InsulationRoiResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate insulation ROI for pipes, vessels, or surfaces.
|
|
4
|
+
*
|
|
5
|
+
* bareHeatLoss = surfaceCoefficient × area × ΔT
|
|
6
|
+
* insulatedHeatLoss = area × ΔT / (1/surfaceCoefficient + thickness/k)
|
|
7
|
+
* annualEnergySaved = (bare − insulated) × hours / 1000 / boilerEfficiency
|
|
8
|
+
* payback = installationCost / annualCostSaved
|
|
9
|
+
*
|
|
10
|
+
* @param input - Insulation parameters
|
|
11
|
+
* @returns Insulation ROI result with heat savings and payback
|
|
12
|
+
*/
|
|
13
|
+
export declare function insulationRoi(input: InsulationRoiInput): InsulationRoiResult;
|
|
14
|
+
//# sourceMappingURL=insulationRoi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insulationRoi.d.ts","sourceRoot":"","sources":["../../src/energy/insulationRoi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAuD5E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate insulation ROI for pipes, vessels, or surfaces.
|
|
4
|
+
*
|
|
5
|
+
* bareHeatLoss = surfaceCoefficient × area × ΔT
|
|
6
|
+
* insulatedHeatLoss = area × ΔT / (1/surfaceCoefficient + thickness/k)
|
|
7
|
+
* annualEnergySaved = (bare − insulated) × hours / 1000 / boilerEfficiency
|
|
8
|
+
* payback = installationCost / annualCostSaved
|
|
9
|
+
*
|
|
10
|
+
* @param input - Insulation parameters
|
|
11
|
+
* @returns Insulation ROI result with heat savings and payback
|
|
12
|
+
*/
|
|
13
|
+
export function insulationRoi(input) {
|
|
14
|
+
const { surfaceArea, tempDifference, insulationK, insulationThickness, surfaceCoefficient = 10, operatingHours, energyCost, boilerEfficiency = 0.8, installationCost, } = input;
|
|
15
|
+
if (surfaceArea <= 0 || tempDifference <= 0 || insulationK <= 0 || insulationThickness <= 0) {
|
|
16
|
+
return {
|
|
17
|
+
bareHeatLoss: 0,
|
|
18
|
+
insulatedHeatLoss: 0,
|
|
19
|
+
heatSaved: 0,
|
|
20
|
+
heatLossReduction: 0,
|
|
21
|
+
annualEnergySaved: 0,
|
|
22
|
+
annualCostSaved: 0,
|
|
23
|
+
paybackPeriod: null,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// Bare surface heat loss: Q = h × A × ΔT (W)
|
|
27
|
+
const bareHeatLoss = surfaceCoefficient * surfaceArea * tempDifference;
|
|
28
|
+
// Insulated heat loss: Q = A × ΔT / (1/h + thickness_m / k)
|
|
29
|
+
const thicknessM = insulationThickness / 1000; // mm → m
|
|
30
|
+
const thermalResistance = (1 / surfaceCoefficient) + (thicknessM / insulationK);
|
|
31
|
+
const insulatedHeatLoss = (surfaceArea * tempDifference) / thermalResistance;
|
|
32
|
+
const heatSaved = bareHeatLoss - insulatedHeatLoss;
|
|
33
|
+
const heatLossReduction = bareHeatLoss > 0 ? (heatSaved / bareHeatLoss) * 100 : 0;
|
|
34
|
+
// Annual energy saved (kWh) = heat saved (W) × hours / 1000 / boiler efficiency
|
|
35
|
+
// Divide by boiler efficiency because saved heat = saved fuel input
|
|
36
|
+
const annualEnergySaved = (heatSaved * operatingHours) / 1000 / boilerEfficiency;
|
|
37
|
+
const annualCostSaved = annualEnergySaved * energyCost;
|
|
38
|
+
let paybackPeriod = null;
|
|
39
|
+
if (installationCost !== undefined && installationCost > 0 && annualCostSaved > 0) {
|
|
40
|
+
paybackPeriod = installationCost / annualCostSaved;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
bareHeatLoss: roundTo(bareHeatLoss, 4),
|
|
44
|
+
insulatedHeatLoss: roundTo(insulatedHeatLoss, 4),
|
|
45
|
+
heatSaved: roundTo(heatSaved, 4),
|
|
46
|
+
heatLossReduction: roundTo(heatLossReduction, 4),
|
|
47
|
+
annualEnergySaved: roundTo(annualEnergySaved, 4),
|
|
48
|
+
annualCostSaved: roundTo(annualCostSaved, 2),
|
|
49
|
+
paybackPeriod: paybackPeriod !== null ? roundTo(paybackPeriod, 4) : null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=insulationRoi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insulationRoi.js","sourceRoot":"","sources":["../../src/energy/insulationRoi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,WAAW,EACX,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,kBAAkB,GAAG,EAAE,EACvB,cAAc,EACd,UAAU,EACV,gBAAgB,GAAG,GAAG,EACtB,gBAAgB,GACjB,GAAG,KAAK,CAAC;IAEV,IAAI,WAAW,IAAI,CAAC,IAAI,cAAc,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,EAAE,CAAC;QAC5F,OAAO;YACL,YAAY,EAAE,CAAC;YACf,iBAAiB,EAAE,CAAC;YACpB,SAAS,EAAE,CAAC;YACZ,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,IAAI;SACpB,CAAC;IACJ,CAAC;IAED,6CAA6C;IAC7C,MAAM,YAAY,GAAG,kBAAkB,GAAG,WAAW,GAAG,cAAc,CAAC;IAEvE,4DAA4D;IAC5D,MAAM,UAAU,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC,SAAS;IACxD,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC;IAChF,MAAM,iBAAiB,GAAG,CAAC,WAAW,GAAG,cAAc,CAAC,GAAG,iBAAiB,CAAC;IAE7E,MAAM,SAAS,GAAG,YAAY,GAAG,iBAAiB,CAAC;IACnD,MAAM,iBAAiB,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAElF,gFAAgF;IAChF,oEAAoE;IACpE,MAAM,iBAAiB,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC;IACjF,MAAM,eAAe,GAAG,iBAAiB,GAAG,UAAU,CAAC;IAEvD,IAAI,aAAa,GAAkB,IAAI,CAAC;IACxC,IAAI,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,GAAG,CAAC,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;QAClF,aAAa,GAAG,gBAAgB,GAAG,eAAe,CAAC;IACrD,CAAC;IAED,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QACtC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAChC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5C,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;KACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LedRoiInput, LedRoiResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate LED lighting retrofit ROI.
|
|
4
|
+
*
|
|
5
|
+
* energySaved = fixtureCount × (oldWatts − newWatts) × hours / 1000
|
|
6
|
+
* costSaved = energySaved × rate
|
|
7
|
+
* payback = totalInvestment / costSaved
|
|
8
|
+
* co2Saved = energySaved × co2Factor
|
|
9
|
+
*
|
|
10
|
+
* @param input - LED retrofit parameters
|
|
11
|
+
* @returns LED ROI result with energy savings, cost savings, and payback
|
|
12
|
+
*/
|
|
13
|
+
export declare function ledRoi(input: LedRoiInput): LedRoiResult;
|
|
14
|
+
//# sourceMappingURL=ledRoi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledRoi.d.ts","sourceRoot":"","sources":["../../src/energy/ledRoi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAkDvD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate LED lighting retrofit ROI.
|
|
4
|
+
*
|
|
5
|
+
* energySaved = fixtureCount × (oldWatts − newWatts) × hours / 1000
|
|
6
|
+
* costSaved = energySaved × rate
|
|
7
|
+
* payback = totalInvestment / costSaved
|
|
8
|
+
* co2Saved = energySaved × co2Factor
|
|
9
|
+
*
|
|
10
|
+
* @param input - LED retrofit parameters
|
|
11
|
+
* @returns LED ROI result with energy savings, cost savings, and payback
|
|
12
|
+
*/
|
|
13
|
+
export function ledRoi(input) {
|
|
14
|
+
const { fixtureCount, oldWatts, newWatts, operatingHours, electricityRate, fixtureCost = 0, installationCost = 0, co2Factor = 0.5, } = input;
|
|
15
|
+
if (fixtureCount <= 0 || operatingHours <= 0) {
|
|
16
|
+
return {
|
|
17
|
+
oldAnnualEnergy: 0,
|
|
18
|
+
newAnnualEnergy: 0,
|
|
19
|
+
annualEnergySaved: 0,
|
|
20
|
+
energyReduction: 0,
|
|
21
|
+
annualCostSaved: 0,
|
|
22
|
+
totalInvestment: 0,
|
|
23
|
+
paybackPeriod: null,
|
|
24
|
+
co2Saved: 0,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const oldAnnualEnergy = (fixtureCount * oldWatts * operatingHours) / 1000;
|
|
28
|
+
const newAnnualEnergy = (fixtureCount * newWatts * operatingHours) / 1000;
|
|
29
|
+
const annualEnergySaved = oldAnnualEnergy - newAnnualEnergy;
|
|
30
|
+
const energyReduction = oldAnnualEnergy > 0 ? (annualEnergySaved / oldAnnualEnergy) * 100 : 0;
|
|
31
|
+
const annualCostSaved = annualEnergySaved * electricityRate;
|
|
32
|
+
const totalInvestment = (fixtureCost * fixtureCount) + installationCost;
|
|
33
|
+
let paybackPeriod = null;
|
|
34
|
+
if (totalInvestment > 0 && annualCostSaved > 0) {
|
|
35
|
+
paybackPeriod = totalInvestment / annualCostSaved;
|
|
36
|
+
}
|
|
37
|
+
const co2Saved = annualEnergySaved * co2Factor;
|
|
38
|
+
return {
|
|
39
|
+
oldAnnualEnergy: roundTo(oldAnnualEnergy, 4),
|
|
40
|
+
newAnnualEnergy: roundTo(newAnnualEnergy, 4),
|
|
41
|
+
annualEnergySaved: roundTo(annualEnergySaved, 4),
|
|
42
|
+
energyReduction: roundTo(energyReduction, 4),
|
|
43
|
+
annualCostSaved: roundTo(annualCostSaved, 2),
|
|
44
|
+
totalInvestment: roundTo(totalInvestment, 2),
|
|
45
|
+
paybackPeriod: paybackPeriod !== null ? roundTo(paybackPeriod, 4) : null,
|
|
46
|
+
co2Saved: roundTo(co2Saved, 4),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ledRoi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledRoi.js","sourceRoot":"","sources":["../../src/energy/ledRoi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,M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,CAAC,CAAC;QAC5C,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChD,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5C,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5C,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5C,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QACxE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TransformerLossInput, TransformerLossResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate transformer losses and efficiency.
|
|
4
|
+
*
|
|
5
|
+
* totalLoss = coreLoss + copperLoss × loadFraction²
|
|
6
|
+
* efficiency = (outputPower / (outputPower + totalLoss)) × 100
|
|
7
|
+
* optimalLoad = √(coreLoss / copperLoss)
|
|
8
|
+
*
|
|
9
|
+
* @param input - Transformer parameters
|
|
10
|
+
* @returns Transformer loss result with efficiency and optimal loading
|
|
11
|
+
*/
|
|
12
|
+
export declare function transformerLoss(input: TransformerLossInput): TransformerLossResult;
|
|
13
|
+
//# sourceMappingURL=transformerLoss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformerLoss.d.ts","sourceRoot":"","sources":["../../src/energy/transformerLoss.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAmElF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { roundTo } from '../utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate transformer losses and efficiency.
|
|
4
|
+
*
|
|
5
|
+
* totalLoss = coreLoss + copperLoss × loadFraction²
|
|
6
|
+
* efficiency = (outputPower / (outputPower + totalLoss)) × 100
|
|
7
|
+
* optimalLoad = √(coreLoss / copperLoss)
|
|
8
|
+
*
|
|
9
|
+
* @param input - Transformer parameters
|
|
10
|
+
* @returns Transformer loss result with efficiency and optimal loading
|
|
11
|
+
*/
|
|
12
|
+
export function transformerLoss(input) {
|
|
13
|
+
const { ratedCapacity, coreLoss, copperLoss, loadFraction, powerFactor = 0.85, operatingHours, energyCost, } = input;
|
|
14
|
+
if (ratedCapacity <= 0 || coreLoss < 0 || copperLoss < 0) {
|
|
15
|
+
return {
|
|
16
|
+
outputPower: 0,
|
|
17
|
+
totalLoss: 0,
|
|
18
|
+
coreLossAtLoad: 0,
|
|
19
|
+
copperLossAtLoad: 0,
|
|
20
|
+
efficiency: 0,
|
|
21
|
+
optimalLoadFraction: 0,
|
|
22
|
+
annualLossEnergy: null,
|
|
23
|
+
annualLossCost: null,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// Output power in W = kVA × loadFraction × powerFactor × 1000
|
|
27
|
+
const outputPower = ratedCapacity * loadFraction * powerFactor * 1000;
|
|
28
|
+
// Core loss is constant regardless of load
|
|
29
|
+
const coreLossAtLoad = coreLoss;
|
|
30
|
+
// Copper loss scales with square of load fraction
|
|
31
|
+
const copperLossAtLoad = copperLoss * loadFraction * loadFraction;
|
|
32
|
+
const totalLoss = coreLossAtLoad + copperLossAtLoad;
|
|
33
|
+
// Efficiency = output / (output + losses) × 100
|
|
34
|
+
let efficiency = 0;
|
|
35
|
+
if (outputPower + totalLoss > 0) {
|
|
36
|
+
efficiency = (outputPower / (outputPower + totalLoss)) * 100;
|
|
37
|
+
}
|
|
38
|
+
// Optimal load fraction where core loss = copper loss at load
|
|
39
|
+
// coreLoss = copperLoss × k² → k = √(coreLoss / copperLoss)
|
|
40
|
+
let optimalLoadFraction = 0;
|
|
41
|
+
if (copperLoss > 0) {
|
|
42
|
+
optimalLoadFraction = Math.sqrt(coreLoss / copperLoss);
|
|
43
|
+
}
|
|
44
|
+
let annualLossEnergy = null;
|
|
45
|
+
let annualLossCost = null;
|
|
46
|
+
if (operatingHours !== undefined) {
|
|
47
|
+
annualLossEnergy = (totalLoss * operatingHours) / 1000; // W·h → kWh
|
|
48
|
+
if (energyCost !== undefined) {
|
|
49
|
+
annualLossCost = annualLossEnergy * energyCost;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
outputPower: roundTo(outputPower, 4),
|
|
54
|
+
totalLoss: roundTo(totalLoss, 4),
|
|
55
|
+
coreLossAtLoad: roundTo(coreLossAtLoad, 4),
|
|
56
|
+
copperLossAtLoad: roundTo(copperLossAtLoad, 4),
|
|
57
|
+
efficiency: roundTo(efficiency, 4),
|
|
58
|
+
optimalLoadFraction: roundTo(optimalLoadFraction, 4),
|
|
59
|
+
annualLossEnergy: annualLossEnergy !== null ? roundTo(annualLossEnergy, 4) : null,
|
|
60
|
+
annualLossCost: annualLossCost !== null ? roundTo(annualLossCost, 2) : null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=transformerLoss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformerLoss.js","sourceRoot":"","sources":["../../src/energy/transformerLoss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,aAAa,EACb,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,GAAG,IAAI,EAClB,cAAc,EACd,UAAU,GACX,GAAG,KAAK,CAAC;IAEV,IAAI,aAAa,IAAI,CAAC,IAAI,QA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