Proposal: cable-sizing module (on-demand DIN VDE 0298-4 cross-section calculator) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Grovy311/leistungsbilanz-ts:feature/cable-sizing-module"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds an on-demand cable cross-section calculator for individual circuits, matching the direction already stated in this repo's own
docs/spec/06-future-sizing-and-calculations.md("The app should later support rule-based protection and cable sizing") andAGENTS.md("... and later electrical sizing logic").This is a review proposal, not a request to merge as-is. Full rationale, architecture, API contract, verification status and known caveats are all written up in
docs/cable-sizing-module.md- please read that first, it answers most "why did you do it this way" questions.What it does
max(operating current, existing protection device rating), not just the load current (the standardIn <= Izrule) - a bare load-based calculation is not enough once a breaker is already chosen.single_phasecircuits, matching the exact convention already named indocs/spec/06-future-sizing-and-calculations.md- never lowers a calculation that needs more.Why it's isolated
Mirrors
src/external-model/'s dependency direction:src/cable-sizing/domain/has zero imports fromdb/,server/orfrontend/. Touches exactly two existing files with a one-line hook each (server/index.tsroute mount,circuit-tree-editor.tsxmodal trigger) - everything else is new files. Never writes tocircuitsdirectly; applying a result goes through the existing, unmodifiedcircuit.updatecommand, soexpectedRevision/undo/redo work automatically. No changes to the command dispatcher, Zod command schemas, or anycircuits/project_revisionsmigration.Testing
Deployed and manually exercised end-to-end against seeded real project/circuit data (created through the actual command API) on an internal host, including a deliberately long 85 m circuit to hit the voltage-drop-critical path.
npm test,npm run build:api,npm run build:webandnpm run typecheck:scriptsall pass at every commit in this branch (429 tests, all green as of the latest commit).Two commits are marked "Local-only" (port remap, dev-origin allowlist) - infrastructure needed only for testing on that internal host, not part of this proposal.
Open questions for you
Happy to adjust based on whatever you think, including not merging this at all if it doesn't fit.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.