Add distribution power summaries
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import {
|
||||
applyDistributionBoardSimultaneityFactor,
|
||||
calculateCircuitTotalPower,
|
||||
calculateDistributionBoardTotalPower,
|
||||
calculateRowTotalPower,
|
||||
calculateSectionTotalPower,
|
||||
} from "../src/domain/calculations/circuit-power-calculation.js";
|
||||
import {
|
||||
resolveCircuitPhaseType,
|
||||
@@ -19,6 +22,32 @@ describe("circuit power calculation", () => {
|
||||
]);
|
||||
assert.equal(total, 4.5);
|
||||
});
|
||||
|
||||
it("calculates section and distribution-board totals", () => {
|
||||
const lighting = calculateSectionTotalPower([
|
||||
{ circuitTotalPower: 1.5 },
|
||||
{ circuitTotalPower: 2.25 },
|
||||
]);
|
||||
const singlePhase = calculateSectionTotalPower([
|
||||
{ circuitTotalPower: 3 },
|
||||
]);
|
||||
const total = calculateDistributionBoardTotalPower([
|
||||
{ sectionTotalPower: lighting },
|
||||
{ sectionTotalPower: singlePhase },
|
||||
{ sectionTotalPower: 0 },
|
||||
]);
|
||||
|
||||
assert.equal(lighting, 3.75);
|
||||
assert.equal(total, 6.75);
|
||||
assert.equal(
|
||||
applyDistributionBoardSimultaneityFactor(total, 0.8),
|
||||
5.4
|
||||
);
|
||||
assert.throws(
|
||||
() => applyDistributionBoardSimultaneityFactor(total, 1.1),
|
||||
/between zero and one/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("project voltage derivation", () => {
|
||||
|
||||
Reference in New Issue
Block a user