Repository navigation
dr_check: the rules as data, one rule set for each standard - #359
Merged
Merged
Conversation
The cases NBR 5410:2004 item 5.1.3.2.2 asks a 30 mA residual-current device for move to data/dr-check.json, as load_points' rules did: each rule a place, a kind of point, a building and its exceptions, naming the standard's item, and the 32 A of note 1, the IT circuits of note 2 and the high lights of note 3 with their sources. dr.rs only reads them (RuleSet), so another country's rules come in as rows. The command takes standard (NBR 5410:2004 the default and only set) and answers with the standard, its source and the source of each reason; a test fails on a rule that names no source or a place or kind it does not know, and a made-up set shows the check takes other numbers.
ffishman
added a commit
to ffishman/BIMCraft
that referenced
this pull request
Nov 20, 2026
Each fails under a deliberate break that the tests let through before: a range from 0 holds 0, and each row answers at its own upper end (and its demand's), in every utility's table and by every method (IPedrax#484, IPedrax#474); each building method at its least number of dwellings and not one fewer (IPedrax#483); an outdoor rule asks it of outlets only, whatever kinds a code lists (IPedrax#359); a room with its outlets and no light point is short, and enough once its light is drawn (IPedrax#280); a 3D file over the limit refused by its size, before it is read (IPedrax#393); only a common property set has the status the export writes (IPedrax#291); a beam at the view range's top is seen, and hidden by a ceiling there (IPedrax#153); Run Script says a single warning (IPedrax#391).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The same move #290 made for
load_points, now fordr_check, following the shape decided in #260: the cases live in a data file, every rule names its source, and a test fails on one that doesn't.What changes
crates/core/data/dr-check.json: one rule set per standard. NBR 5410:2004 item 5.1.3.2.2 is the only set for now, with the same behaviourdr_checkhad in code. Each case is one rule: the places it reaches (empty = any), the kinds of point (empty = any), the building (residential, other or any), whether it needs the "may feed equipment outdoors" flag, and the height from which a light is left out. The set also holds the 30 mA limit, the 32 A ceiling for outlets (note 1), the IT continuity exemption (note 2) and what the check does not cover. Every rule gives the item it comes from; the file holds numbers and item references only, no text of the standard.dr.rs: the check is nowRuleSet::check, which only reads those rules; the first rule a point meets gives its reason, as before.dr::checkstays and uses the default set, so the existing tests pass unchanged.MAX_RESIDUAL,MAX_OUTLETandLIGHT_HEIGHTgo, since the numbers are in the data now.dr_checktakesstandard(defaultNBR 5410:2004, an unknown one is an error) and the answer addsstandard,standard_source,max_outlet_aand, for each circuit, thesourcesof itsreasons.docs/areas/structure-and-mep.md.Why per country
The rule shape is generic on purpose. IEC 60364-4-41 and BS 7671 (411.3.3) ask the device for outlets up to 32 A whatever the room, and IEC 60364-7-701 / BS 7671 section 701 for every circuit of a room with a bath or shower; that is one rule with
kinds: ["outlet"]and no places, plus one forbath. The US NEC (210.8) asks a GFCI, a device of its own, by a list of places close to the Brazilian one. I didn't add those sets: I'd rather not load numbers I haven't checked against the documents. A made-up set in the tests shows the check takes them as rows.Tests
Not in this PR: the bathroom volumes of item 9.1, which
dr_checklists as not covered; they come in a separate PR (bath_volumes).cc @renanem, since
dr_checkis yours (#245): same behaviour, only where the rules live has changed.