forked from jappel/leistungsbilanz-ts
cable-sizing: size for the protective device, not just the load; manual entry; icon position
- calculateCableSizing now selects cross-section against designCurrentA = max(operatingCurrentA, existingProtectionRatedCurrentA) instead of the load current alone. A breaker only trips at its own rated current (In), so a cable sized for the actual load could overheat under sustained current below that threshold - the standard In <= Iz rule. Voltage-drop calculation still uses the real operating current, only the capacity check changed. Alerts and the ok-summary now name the breaker as the limiting factor when it is one. - Added a manual cable type/cross-section entry in the modal itself: running a calculation pre-fills these fields as a suggestion, but they are the single field that actually gets applied, and stay editable - this restores the direct manual-entry capability the modal replaced when it took over the cableSummary/cableCrossSection cell click. - Fixed calculator icon position from a trailing ::after (inconsistent position depending on cell text length, easy to miss on empty cells) to a fixed-position ::before, so it is always in the same place regardless of whether cable data is already filled in. - No new display for the existing protection device - it already has its own Schutz column in this app.
This commit is contained in:
parent
a35d04965e
commit
8562d6eb83
5 changed files with 145 additions and 29 deletions
|
|
@ -84,19 +84,43 @@ describe("calculateCableSizing", () => {
|
|||
assert.equal(singlePhaseWithHarmonics.harmonicReductionApplied, false);
|
||||
});
|
||||
|
||||
it("flags a simplified protection coordination mismatch", () => {
|
||||
it("uses max(operatingCurrentA, existingProtectionRatedCurrentA) as the design current for cross-section selection", () => {
|
||||
// Load alone (21.7 A) would recommend 4 mm² (see the reference case
|
||||
// above); a 32 A breaker on the same circuit must still be covered by
|
||||
// the cable (In <= Iz), so the recommendation should grow accordingly.
|
||||
const withoutBreaker = calculateCableSizing(BASE_INPUT);
|
||||
const withBreaker = calculateCableSizing({
|
||||
...BASE_INPUT,
|
||||
existingProtectionRatedCurrentA: 32,
|
||||
});
|
||||
assert.equal(withoutBreaker.designCurrentA, withoutBreaker.operatingCurrentA);
|
||||
assert.equal(withBreaker.designCurrentA, 32);
|
||||
assert.ok(
|
||||
(withBreaker.recommendedCrossSectionMm2 ?? 0) >=
|
||||
(withoutBreaker.recommendedCrossSectionMm2 ?? 0)
|
||||
);
|
||||
assert.ok(withBreaker.protectionCoordination?.coordinated);
|
||||
});
|
||||
|
||||
it("reports an oversized breaker as the limiting factor when no cross-section can cover it", () => {
|
||||
const result = calculateCableSizing({
|
||||
...BASE_INPUT,
|
||||
existingProtectionRatedCurrentA: 1000,
|
||||
});
|
||||
assert.ok(result.protectionCoordination);
|
||||
assert.equal(result.protectionCoordination?.coordinated, false);
|
||||
assert.equal(result.designCurrentA, 1000);
|
||||
assert.equal(result.recommendedCrossSectionMm2, null);
|
||||
// No cross-section satisfies the design current at all, so there is no
|
||||
// "recommended but under-protected" case to flag - protectionCoordination
|
||||
// is only meaningful once a recommendation exists.
|
||||
assert.equal(result.protectionCoordination, null);
|
||||
|
||||
const alerts = buildCableSizingAlerts(
|
||||
{ ...BASE_INPUT, existingProtectionRatedCurrentA: 1000 },
|
||||
result
|
||||
);
|
||||
assert.ok(alerts.some((alert) => alert.text.includes("Koordination prüfen")));
|
||||
assert.equal(alerts.length, 1);
|
||||
assert.equal(alerts[0].kind, "critical");
|
||||
assert.ok(alerts[0].text.includes("Vorhandene Sicherung"));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue