Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions rct229/rulesets/ashrae9012019/section19/section19rule23.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ def __init__(self):
list_path="ruleset_model_descriptions[0]",
)

def create_data(self, context, data):
rmd_b = context.BASELINE_0

missing_data = []

if not find_all("$..hourly_heating_design_year", rmd_b) and not find_all(
"$..hourly_heating_design_day", rmd_b
):
missing_data.append(
"No schedules in the baseline model contain hourly heating design data. "
)

if not find_all("$..hourly_cooling_design_year", rmd_b) and not find_all(
"$..hourly_cooling_design_day", rmd_b
):
missing_data.append(
"No schedules in the baseline model contain hourly cooling design data. "
)

assert_(not missing_data, "\n".join(missing_data))
return {}

class RMDRule(RuleDefinitionListIndexedBase):
def __init__(self):
super(PRM9012019Rule60o81.RMDRule, self).__init__(
Expand Down
11 changes: 10 additions & 1 deletion rct229/rulesets/ashrae9012019/section19/section19rule4.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get_most_used_weekday_hourly_schedule,
)
from rct229.schema.schema_enums import SchemaEnums
from rct229.utils.assertions import getattr_
from rct229.utils.assertions import getattr_, assert_
from rct229.utils.jsonpath_utils import find_all, find_exactly_one_with_field_value

LIGHTING_SPACE = SchemaEnums.schema_enums["LightingSpaceOptions2019ASHRAE901TG37"]
Expand Down Expand Up @@ -34,6 +34,15 @@ def __init__(self):
list_path="ruleset_model_descriptions[0]",
)

def create_data(self, context, data):
rmd_b = context.BASELINE_0

assert_(
find_all("$..hourly_cooling_design_day", rmd_b),
"No schedules in the baseline model contain the 'hourly_cooling_design_day' data",
)
return {}

class RuleSetModelInstanceRule(RuleDefinitionListIndexedBase):
def __init__(self):
super(PRM9012019Rule74p61.RuleSetModelInstanceRule, self).__init__(
Expand Down
57 changes: 22 additions & 35 deletions rct229/rulesets/ashrae9012019/section5/section5rule11.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_surface_conditioning_category_dict import (
get_surface_conditioning_category_dict,
)
from rct229.utils.jsonpath_utils import find_all


class PRM9012019Rule46p73(RuleDefinitionListIndexedBase):
Expand Down Expand Up @@ -47,50 +48,36 @@ def create_data(self, context, data=None):
"constructions": constructions,
}

class BuildingRule(RuleDefinitionListIndexedBase):
class BuildingRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule46p73.BuildingRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
each_rule=PRM9012019Rule46p73.BuildingRule.SurfaceRule(),
index_rmd=BASELINE_0,
list_path="$.building_segments[*].zones[*].surfaces[*]",
)

def create_data(self, context, data=None):
def get_calc_vals(self, context, data=None):
building_b = context.BASELINE_0
surface_conditioning_category_dict = get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
)
applicable_surface_ids = [
surface_b["id"]
for surface_b in find_all(
"$.building_segments[*].zones[*].surfaces[*]", building_b
)
if (
get_opaque_surface_type(surface_b)
in [OST.HEATED_SOG, OST.UNHEATED_SOG]
and surface_conditioning_category_dict[surface_b["id"]]
!= SCC.UNREGULATED
)
]
return {
"surface_conditioning_category_dict": get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
),
"applicable_surface_ids": applicable_surface_ids,
}

def list_filter(self, context_item, data):
surface_b = context_item.BASELINE_0
return get_opaque_surface_type(surface_b) in [
OST.HEATED_SOG,
OST.UNHEATED_SOG,
]

class SurfaceRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule46p73.BuildingRule.SurfaceRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
)

def get_calc_vals(self, context, data=None):
surface_b = context.BASELINE_0
surface_conditioning_category_dict = data[
"surface_conditioning_category_dict"
]
surface_category = surface_conditioning_category_dict[surface_b["id"]]
return {
"surface_category": surface_category,
}
def applicability_check(self, context, calc_vals, data):

def applicability_check(self, context, calc_vals, data):
surface_category = calc_vals["surface_category"]
return surface_category != SCC.UNREGULATED
applicable_surface_ids = calc_vals["applicable_surface_ids"]
return bool(applicable_surface_ids)
12 changes: 12 additions & 0 deletions rct229/rulesets/ashrae9012019/section5/section5rule18.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from rct229.rule_engine.ruleset_model_factory import produce_ruleset_model_description
from rct229.rulesets.ashrae9012019 import PROPOSED
from rct229.schema.schema_enums import SchemaEnums
from rct229.utils.assertions import assert_
from rct229.utils.jsonpath_utils import find_all

SUBSURFACE_DYNAMIC_GLAZING = SchemaEnums.schema_enums["SubsurfaceDynamicGlazingOptions"]
UNDETERMINED_MSG = "SUBSURFACE INCLUDES MANUALLY CONTROLLED DYNAMIC GLAZING IN THE PROPOSED DESIGN. VERIFY THAT SHGC AND VT WERE MODELED AS THE AVERAGE OF THE MINIMUM AND MAXIMUM SHGC AND VT."
Expand All @@ -26,6 +28,16 @@ def __init__(self):
list_path="ruleset_model_descriptions[0].buildings[*].building_segments[*].zones[*].surfaces[*].subsurfaces[*]",
)

def create_data(self, context, data):
rmd_p = context.PROPOSED

assert_(
find_all("$..dynamic_glazing_type", rmd_p),
"No subsurfaces in the proposed model contain the 'dynamic_glazing_type' data. ",
)

return {}

class SubsurfaceRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule82y74.SubsurfaceRule, self).__init__(
Expand Down
21 changes: 21 additions & 0 deletions rct229/rulesets/ashrae9012019/section5/section5rule23.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from rct229.rule_engine.rule_list_indexed_base import RuleDefinitionListIndexedBase
from rct229.rule_engine.ruleset_model_factory import produce_ruleset_model_description
from rct229.rulesets.ashrae9012019 import BASELINE_0
from rct229.utils.assertions import assert_
from rct229.utils.jsonpath_utils import find_all


class PRM9012019Rule11q41(RuleDefinitionListIndexedBase):
Expand Down Expand Up @@ -33,6 +35,25 @@ def __init__(self):
index_rmd=BASELINE_0,
)

def create_data(self, context, data):
rmd_b = context.BASELINE_0
rmd_p = context.PROPOSED

models_missing_data = []

if not find_all("$..has_manual_interior_shades", rmd_b):
models_missing_data.append(
"No subsurfaces in the baseline model contain the 'has_manual_interior_shades' data. "
)

if not find_all("$..has_manual_interior_shades", rmd_p):
models_missing_data.append(
"No subsurfaces in the proposed model contain the 'has_manual_interior_shades' data. "
)

assert_(not models_missing_data, "\n".join(models_missing_data))
return {}

class SubsurfaceRule(RuleDefinitionBase):
def __init__(self):
super(PRM9012019Rule11q41.BuildingRule.SubsurfaceRule, self).__init__(
Expand Down
55 changes: 21 additions & 34 deletions rct229/rulesets/ashrae9012019/section5/section5rule3.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_surface_conditioning_category_dict import (
get_surface_conditioning_category_dict,
)
from rct229.utils.jsonpath_utils import find_all


class PRM9012019Rule73o42(RuleDefinitionListIndexedBase):
Expand Down Expand Up @@ -47,49 +48,35 @@ def create_data(self, context, data=None):
"constructions": constructions,
}

class BuildingRule(RuleDefinitionListIndexedBase):
class BuildingRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule73o42.BuildingRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
required_fields={},
each_rule=PRM9012019Rule73o42.BuildingRule.SurfaceRule(),
index_rmd=BASELINE_0,
list_path="$.building_segments[*].zones[*].surfaces[*]",
)

def create_data(self, context, data=None):
def get_calc_vals(self, context, data=None):
building_b = context.BASELINE_0
surface_conditioning_category_dict = get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
)
applicable_surface_ids = [
surface_b["id"]
for surface_b in find_all(
"$.building_segments[*].zones[*].surfaces[*]", building_b
)
if (
get_opaque_surface_type(surface_b) == OST.ROOF
and surface_conditioning_category_dict[surface_b["id"]]
!= SCC.UNREGULATED
)
]
return {
"surface_conditioning_category_dict": get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
),
"applicable_surface_ids": applicable_surface_ids,
}

def list_filter(self, context_item, data):
surface_b = context_item.BASELINE_0
return get_opaque_surface_type(surface_b) == OST.ROOF

class SurfaceRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule73o42.BuildingRule.SurfaceRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
required_fields={},
)

def get_calc_vals(self, context, data=None):
surface_b = context.BASELINE_0
surface_conditioning_category_dict = data[
"surface_conditioning_category_dict"
]
surface_category = surface_conditioning_category_dict[surface_b["id"]]
return {
"surface_category": surface_category,
}
def applicability_check(self, context, calc_vals, data):

def applicability_check(self, context, calc_vals, data):
surface_category = calc_vals["surface_category"]
return surface_category != SCC.UNREGULATED
applicable_surface_ids = calc_vals["applicable_surface_ids"]
return bool(applicable_surface_ids)
55 changes: 22 additions & 33 deletions rct229/rulesets/ashrae9012019/section5/section5rule7.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_surface_conditioning_category_dict import (
get_surface_conditioning_category_dict,
)
from rct229.utils.jsonpath_utils import find_all


class PRM9012019Rule20r05(RuleDefinitionListIndexedBase):
Expand All @@ -31,7 +32,7 @@ def __init__(self):
each_rule=PRM9012019Rule20r05.BuildingRule(),
index_rmd=BASELINE_0,
id="5-7",
description="Baseline above-grade wall assemblies must conform with assemblies detailed in Appendix A (Steel-framed A3.3) ",
description="Baseline above-grade wall assemblies must conform with assemblies detailed in Appendix A (Steel-framed A3.3) ",
ruleset_section_title="Envelope",
standard_section="Section G3.1-5(b) Building Envelope Modeling Requirements for the Baseline building",
is_primary_rule=False,
Expand All @@ -47,47 +48,35 @@ def create_data(self, context, data=None):
"constructions": constructions,
}

class BuildingRule(RuleDefinitionListIndexedBase):
class BuildingRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule20r05.BuildingRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
each_rule=PRM9012019Rule20r05.BuildingRule.SurfaceRule(),
index_rmd=BASELINE_0,
list_path="$.building_segments[*].zones[*].surfaces[*]",
)

def create_data(self, context, data=None):
def get_calc_vals(self, context, data=None):
building_b = context.BASELINE_0
surface_conditioning_category_dict = get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
)
applicable_surface_ids = [
surface_b["id"]
for surface_b in find_all(
"$.building_segments[*].zones[*].surfaces[*]", building_b
)
if (
get_opaque_surface_type(surface_b) == OST.ABOVE_GRADE_WALL
and surface_conditioning_category_dict[surface_b["id"]]
!= SCC.UNREGULATED
)
]
return {
"surface_conditioning_category_dict": get_surface_conditioning_category_dict(
data["climate_zone"], building_b, data["constructions"]
),
"applicable_surface_ids": applicable_surface_ids,
}

def list_filter(self, context_item, data):
surface_b = context_item.BASELINE_0
return get_opaque_surface_type(surface_b) == OST.ABOVE_GRADE_WALL

class SurfaceRule(PartialRuleDefinition):
def __init__(self):
super(PRM9012019Rule20r05.BuildingRule.SurfaceRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
)

def get_calc_vals(self, context, data=None):
surface_b = context.BASELINE_0
surface_conditioning_category_dict = data[
"surface_conditioning_category_dict"
]
surface_category = surface_conditioning_category_dict[surface_b["id"]]
return {
"surface_category": surface_category,
}
def applicability_check(self, context, calc_vals, data):

def applicability_check(self, context, calc_vals, data):
surface_category = calc_vals["surface_category"]
return surface_category != SCC.UNREGULATED
applicable_surface_ids = calc_vals["applicable_surface_ids"]
return bool(applicable_surface_ids)
Loading