Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonJ-KC committed Feb 28, 2025
1 parent dc1b5ba commit 8d10add
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 47 deletions.
14 changes: 7 additions & 7 deletions docs/section5/Rule5-23.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

- For each surface in zone: `for surface_b in zone_b.surfaces:`

- Get matching surface in P_RMD: `surface_p = match_data_element(P_RMD, Surfaces, surface_b.id)`
- For each subsurface in surface in B_RMD: `for subsurface_b in surface_b.subsurfaces:`

- Get matching subsurface in P_RMD: subsurface_p = match_data_element(P_RMD, Subsurfaces, subsurface_b.id)

- **Rule Assertion:**

- For each subsurface in surface in P_RMD: `for subsurface_p in surface_p.subsurfaces:`
- Case 1: If subsurface is modeled with the same manual shade status as in P_RMD: `if subsurface_b.has_manual_interior_shades == subsurface_p.has_manual_interior_shades: PASS`

**Rule Assertion:**

- Case 1: If subsurface is modeled with the same manual shade status as in P_RMD: `if subsurface_b.has_manual_interior_shades == subsurface_p.has_manual_interior_shades: PASS`

- Case 2: Else: `else: FAIL`
- Case 2: Else: `else: FAIL`

**Notes:**

Expand Down
64 changes: 24 additions & 40 deletions rct229/rulesets/ashrae9012019/section5/section5rule23.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,36 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
list_path="$.building_segments[*].zones[*].surfaces[*]",
each_rule=Section5Rule23.BuildingRule.SurfaceRule(),
list_path="$.building_segments[*].zones[*].surfaces[*].subsurfaces[*]",
each_rule=Section5Rule23.BuildingRule.SubsurfaceRule(),
index_rmd=BASELINE_0,
)

def list_filter(self, context_item, data):
surface_b = context_item.BASELINE_0
subsurfaces_b = surface_b.get("subsurfaces", [])
return len(subsurfaces_b) > 0

class SurfaceRule(RuleDefinitionListIndexedBase):
class SubsurfaceRule(RuleDefinitionBase):
def __init__(self):
super(Section5Rule23.BuildingRule.SurfaceRule, self).__init__(
super(
Section5Rule23.BuildingRule.SubsurfaceRule, self
).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
each_rule=Section5Rule23.BuildingRule.SurfaceRule.SubsurfaceRule(),
index_rmd=BASELINE_0,
list_path="subsurfaces[*]",
required_fields={"$": ["has_manual_interior_shades"]},
)

class SubsurfaceRule(RuleDefinitionBase):
def __init__(self):
super(
Section5Rule23.BuildingRule.SurfaceRule.SubsurfaceRule, self
).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
required_fields={"$": ["has_manual_interior_shades"]},
)

def get_calc_vals(self, context, data=None):
subsurface_b = context.BASELINE_0
subsurface_p = context.PROPOSED
return {
"subsurface_p_manual_shade": subsurface_p[
"has_manual_interior_shades"
],
"subsurface_b_manual_shade": subsurface_b[
"has_manual_interior_shades"
],
}

def rule_check(self, context, calc_vals=None, data=None):
return (
calc_vals["subsurface_p_manual_shade"]
== calc_vals["subsurface_b_manual_shade"]
)
def get_calc_vals(self, context, data=None):
subsurface_b = context.BASELINE_0
subsurface_p = context.PROPOSED
return {
"subsurface_p_manual_shade": subsurface_p[
"has_manual_interior_shades"
],
"subsurface_b_manual_shade": subsurface_b[
"has_manual_interior_shades"
],
}

def rule_check(self, context, calc_vals=None, data=None):
return (
calc_vals["subsurface_p_manual_shade"]
== calc_vals["subsurface_b_manual_shade"]
)

0 comments on commit 8d10add

Please sign in to comment.