Skip to content

Circuits: devices on a distribution board behind a breaker - #362

Merged
IPedrax merged 24 commits into
IPedrax:mainfrom
ffishman:panel-circuits
Nov 12, 2026
Merged

IPedrax merged 24 commits into
IPedrax:mainfrom
ffishman:panel-circuits

Conversation

@ffishman

@ffishman ffishman commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

The second of the three PRs that bring #179 by @PolyglotOpenstreetmap onto current main: circuits, on top of the boards of #357 (stacked; only the last commit is new here). The design is his commits 02ddfcb and 3972b88.

A circuit is an element (file format 19): its board, a number of its own on that board, a name, the breaker in amperes, its poles, the voltage it is at, a classification, a demand factor, its devices and its wires. The devices' voltage, poles and load come from their family's power connector, so nothing is typed on a circuit. The model refuses:

  • a device that draws a voltage outside the band of the circuit's, and a device with other poles than the circuit
  • a device in two circuits, naming the one that has it
  • a breaker above the board's mains, poles past the system's phases or the board's slots, and a number the board already has
  • a conductor whose section its wire type's table has no row for

A circuit's load (installed and demand VA, each pole's load, the current) is worked out from its devices and never saved; a board's element, panel and inspect carry the totals. A spare (no device) and a breaker its wire can't carry are warnings.

circuit keeps both modes in one command: with a key of a model circuit (devices, panel, id, add, remove, rating, poles, voltage, wires, delete, list…) it makes, changes, lists or deletes one as an undo step; with the NBR 5410 sizing keys, or none, it sizes as before and makes no step. Mixing both is refused. A deleted device leaves its circuit, a deleted board takes its circuits.

IFC writes each circuit as an IfcDistributionCircuit with its breaker and reads it back; the import now also reads a device's Pset_ElectricalDeviceCommon and BIMCraft_Connector into a connector on its family, so devices keep their load through a round trip. Plans draw a circuit's home run and number at its board's level. Properties edits a selected circuit; Electrical > Create Circuit makes one from a board and devices.

What changed from the original commits, for main as it is now:

  • check_circuits also runs in check_changed (circuits are held to each other, their boards and devices), so the incremental check answers as the full one does.
  • delete_indexed takes a board's circuits and takes deleted devices out of circuits, as delete_from_scratch does.
  • File format 19 (main is at 18); IFC GlobalId roles 64 to 70.
  • The connector read on import fills main's new connector fields (no place, no domain); Portuguese labels for the new strings.

Checks: cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace, cargo i18n check.

The commit carries Co-authored-by: Polyglot <[email protected]>.

ffishman and others added 2 commits November 9, 2026 14:43
…panel data

The first part of IPedrax#179, on current main. A distribution board (an
equipment component) holds its distribution system, its mains in
amperes, the single-pole breakers it takes (Max IPedrax#1 Pole Breakers) and the
board that supplies it. The panel command sets them by those names (""
takes one away; with no id it lists the boards and what each feeds).
Boards make a tree: a board is never supplied from itself or from one it
feeds, and the refusal names the chain. Deleting a board leaves the
boards it fed without a supply; a distribution system a board is on
cannot be deleted, and follows a rename.

Component schedules get Distribution System, Mains, Max IPedrax#1 Pole Breakers
and Supply From; Properties has an Electrical group for a board. IFC
writes each system a board is on as an electrical IfcDistributionSystem
and the rest in BIMCraft_Panel, and reads them back.

On main since IPedrax#179: the board check runs with each element, so
check_changed answers as check does; the indexed delete clears a fed
board's supply as the full one does; IFC GlobalId roles 59 to 63.

Co-authored-by: Polyglot <[email protected]>
The second part of IPedrax#179, on the boards of IPedrax#357. A circuit is an element
(file format 19): its board, a number of its own on it, a name, the
breaker in amperes, its poles, the voltage it is at, a classification, a
demand factor, its devices and its wires. The devices' voltage, poles
and load are their family's power connector's, so nothing is typed on a
circuit. The model refuses a device outside the circuit's voltage band or
with other poles, a device in two circuits, a breaker above the board's
mains, poles past the system's phases or the board's slots, a number the
board has already, and a section its wire type has no row for.

A circuit's load is worked out from its devices and never saved. circuit
keeps its NBR 5410 sizing mode; given a key of a model circuit it makes,
changes, lists or deletes one as an undo step. A deleted device leaves
its circuit; a deleted board takes its circuits.

IFC writes each circuit as an IfcDistributionCircuit with its breaker and
reads it back, and the import reads a device's connector sets into its
family. Plans draw a circuit's home run and number; Properties edits a
circuit and Electrical > Create Circuit makes one.

On main since IPedrax#179: check_circuits runs in check_changed too; the indexed
delete takes a board's circuits and drops deleted devices; format 19;
IFC GlobalId roles 64 to 70.

Co-authored-by: Polyglot <[email protected]>
Main's Assistant, commits 78e52e1 to f202abd. Only the interface catalogs conflicted: main's translations kept, the boards' strings added, then cargo i18n update.
Main's Assistant brought the root to its 3,000 words, so the line names panels in the words it had; the detail is in docs/areas/structure-and-mep.md.
Main's Assistant, by the updated panel-boards. The interface catalogs conflicted (both sides' translations kept, then cargo i18n update) and so did the electrical.rs line of CLAUDE.md, which now names circuits too; the nbr5410.rs line drops three words it repeated, so the root stays within its 3,000.
@IPedrax IPedrax mentioned this pull request Nov 11, 2026
IPedrax and others added 16 commits November 11, 2026 20:34
A component's `panel` (its distribution system, mains, slots and the board
that supplies it) joins 18's notes and the 17-to-18 comment of
Model::migrate: a build that reads up to 17 would leave it out as a field
it doesn't know, and a file of 17 has none.
…s name it

The import kept a copy of a BIMCraft_Panel set's properties for every product
a relation named, whether or not the file had it, so one set of many
properties related to many ids made a small file ask for their product in
memory. PropertySets reads each set once, its properties by name, and keeps
for each product of the file the sets on it; the boards look their values up
there. A hostile file of 50,000 properties on 100,000 products opens, and the
boards keep what their own sets say.
…and 62

Main gave 61 and 62 to a wall's BIMCraft_Wall set while this branch gave them
to the IfcDistributionSystem and its IfcRelAssignsToGroup, so a wall and a
system keyed to the same number would have written one GlobalId for two
objects. They take 71 and 72, which neither main nor the circuits that follow
on this board's data use (64 to 70), and a test reads the roles from the
source and fails on any number two of them share.
Every file change since 0.11 shares 18, so circuits take no format of their
own: FORMAT is 18 again, 18's notes and the 17-to-18 comment of
Model::migrate name them, and the area's note says a circuit is an element of
format 18 (it said 13).
…er many products name them

As the board's set was, a BIMCraft_Circuit set was copied for every product a
relation named, and a device's Pset_ElectricalDeviceCommon and
BIMCraft_Connector were appended to a list for every product and every
relation, whether or not the file had the product: one set of many
properties on many ids asked for their product in memory. Both now go through
PropertySets, each set held once. A device's system is one of the three
BIMCraft writes, kept as that word, not a copy of whatever the file says; a
system it doesn't know was read as a switch, and now gives no connector.

A circuit's devices were found by walking every product's group for each
circuit, the circuits times the products: the groups' members are gathered
once. A hostile file of two sets of 50,000 properties on 100,000 ids opens and
the circuit comes back whole.
Taking main's catalogs in the merge and regenerating them kept every msgid
but dropped the seven Portuguese translations this branch had written for
the board's Properties (Distribution System, Mains, Max IPedrax#1 Pole Breakers,
Supplies, Supply From and two refusals); they are filled back from the
branch's own catalog.
As on the boards' branch, regenerating main's catalogs dropped the fifteen
Portuguese translations this branch had written for circuits (Create
Circuit, the Electrical group's labels and its prompts); they are filled back
from the branch's own catalog.
ffishman added a commit to ffishman/BIMCraft that referenced this pull request Nov 11, 2026
IPedrax added a commit that referenced this pull request Nov 12, 2026
59 and 60 are free on main, but the distribution boards' branch
(maint/pr-357, and #362 and #363 after it) takes 59, 60 and 63 to 72, and no
open pull request names a role above 72. The grid's roles take the next free
ones, so whichever lands first, no two roles share a number.
IPedrax added a commit that referenced this pull request Nov 12, 2026
63 to 66 are free on main, but the distribution boards' branch
(maint/pr-357, and #362 and #363 after it) takes 59, 60 and 63 to 72, and the
grid's take 73 and 74 (maint/pr-319); no open pull request names a role above
72. The site's property sets take the next free ones, so whichever lands
first, no two roles share a number.
IPedrax added a commit to jonaswre/BIMCraft that referenced this pull request Nov 12, 2026
63 to 66 are free on main, but the distribution boards' branch
(maint/pr-357, and IPedrax#362 and IPedrax#363 after it) takes 59, 60 and 63 to 72, and the
grid's take 73 and 74 (maint/pr-319); no open pull request names a role above
72. The site's property sets take the next free ones, so whichever lands
first, no two roles share a number.
IPedrax added a commit to jonaswre/BIMCraft that referenced this pull request Nov 12, 2026
59 and 60 are free on main, but the distribution boards' branch
(maint/pr-357, and IPedrax#362 and IPedrax#363 after it) takes 59, 60 and 63 to 72, and no
open pull request names a role above 72. The grid's roles take the next free
ones, so whichever lands first, no two roles share a number.
IPedrax added a commit to ffishman/BIMCraft that referenced this pull request Nov 12, 2026
@IPedrax
IPedrax merged commit b38d2c1 into IPedrax:main Nov 12, 2026
emilianocapasso pushed a commit to acpvarchitects/BIMCraft that referenced this pull request Nov 12, 2026
The last part of IPedrax#179, on the circuits of IPedrax#362. A panel schedule is a
view of a board (the panel_schedule command, Electrical > Panel
Schedule) that goes on a sheet and prints with it: a header, a row for
each slot with spares and spaces drawn differently, the load by
classification and by phase, and notes. A circuit's number is now its
slot (a circuit of p poles takes n, n+2, ...), each slot on a phase, so
the phases add up to the board's load. demand_factors holds a share for
each classification, applied in the summary and in the board's totals.
Circuits are edited in the view, and a slot is marked a spare or a
space. The Project Browser lists panel schedules in their own group.

On main since IPedrax#179: a panel schedule is a rare category, part of the
drawing set and one of Model::views; check_demand_factors runs in
check_changed too; the indexed delete takes a board's panel schedules;
file format 20; two doc lines that said circuits were not elements yet.

Co-authored-by: Polyglot <[email protected]>
@dronov-dmitry dronov-dmitry moved this to Done in BIMCraft Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants