Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_tolerance_fail method for Section 5 to 6 #1267

Merged
merged 31 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0f369d9
is_tolerance_fail method in section 5
Jiarongx-Xie Jan 22, 2024
8054e36
is_tolerance_fail method in section 6
Jiarongx-Xie Jan 22, 2024
ad9d588
address PR comments
Jiarongx-Xie Jan 25, 2024
88299e8
remove is_tolerance_fail when comparing two user input values
Jiarongx-Xie Jan 25, 2024
5792847
Merge branch 'develop_rct_tolerance' of https://github.com/pnnl/rules…
weilixu Mar 7, 2024
b9cb273
Merge branch 'develop_rct_tolerance' of https://github.com/pnnl/rules…
weilixu Jun 11, 2024
9b683ef
update for 5-8
weilixu Jun 11, 2024
e8210da
Merge branch 'develop_rct_tolerance' of https://github.com/pnnl/rules…
weilixu Jun 11, 2024
b5be88c
rules before Section 5 Rule 20 (included)
Jiarongx-Xie Jun 17, 2024
23e6626
is_tolerance_fail method in section 5
Jiarongx-Xie Jan 22, 2024
62b147a
is_tolerance_fail method in section 6
Jiarongx-Xie Jan 22, 2024
a321026
address PR comments
Jiarongx-Xie Jan 25, 2024
8bccacc
remove is_tolerance_fail when comparing two user input values
Jiarongx-Xie Jan 25, 2024
1537699
update for 5-8
weilixu Jun 11, 2024
891d10b
rules before Section 5 Rule 20 (included)
Jiarongx-Xie Jun 17, 2024
81d6461
update Section 5 1-20
Jiarongx-Xie Jun 25, 2024
964c7f5
fix merge error
Jiarongx-Xie Jun 29, 2024
054bfe6
revert change to rmd
Jiarongx-Xie Jun 29, 2024
aa44519
a workable example 5-4
Jiarongx-Xie Jun 29, 2024
0d1a563
most workable rules
Jiarongx-Xie Jun 29, 2024
8f06682
fix 5-39 typo
Jiarongx-Xie Jul 2, 2024
464574b
fix 5-35
Jiarongx-Xie Jul 2, 2024
dea7f81
fix 5-1, 15
Jiarongx-Xie Jul 2, 2024
c9bbc2a
fix 5-35
Jiarongx-Xie Jul 2, 2024
6df15b1
fix 5-37, format 5-35
Jiarongx-Xie Jul 2, 2024
4515d3a
update 6-1
Jiarongx-Xie Jul 2, 2024
9e69c2b
change to air_flow_rate in CalcQ
Jiarongx-Xie Jul 2, 2024
b2ad376
update 5-15 test json
Jiarongx-Xie Jul 2, 2024
50cf077
remove statements in 5-15
Jiarongx-Xie Jul 2, 2024
336b06e
fix 6-1
Jiarongx-Xie Jul 3, 2024
e6d71c4
Merge branch 'develop_rct_tolerance' of https://github.com/pnnl/rules…
weilixu Sep 30, 2024
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
14 changes: 13 additions & 1 deletion rct229/rulesets/ashrae9012019/section5/section5rule1.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ def __init__(self):
required_fields={
"$.building_segments[*].zones[*].surfaces[*]": ["azimuth"],
},
precision={
"percent_difference_max_min_fen_area_per_orientation": {
"precision": 0.01,
"unit": "",
}
},
fail_msg="Fail unless Table G3.1#5a exception #2 is applicable and it can be demonstrated that the building orientation is dictated by site considerations.",
)

Expand Down Expand Up @@ -223,7 +229,13 @@ def get_key_for_azi(azi):
)

rotation_expected_b = (
percent_difference >= ACCEPTABLE_FEN_PERCENTAGE_DIFFERENCE
percent_difference > ACCEPTABLE_FEN_PERCENTAGE_DIFFERENCE
or self.precision_comparison[
"percent_difference_max_min_fen_area_per_orientation"
](
percent_difference.magnitude,
ACCEPTABLE_FEN_PERCENTAGE_DIFFERENCE,
)
)

return {
Expand Down
14 changes: 12 additions & 2 deletions rct229/rulesets/ashrae9012019/section5/section5rule10.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def __init__(self):
"$": ["construction"],
"construction": ["u_factor"],
},
precision={
"floor_u_factor_b": {
"precision": 0.001,
"unit": "Btu/(hr*ft2*R)",
}
},
)

def get_calc_vals(self, context, data=None):
Expand Down Expand Up @@ -132,7 +138,11 @@ def manual_check_required(self, context, calc_vals=None, data=None):
)

def rule_check(self, context, calc_vals=None, data=None):
return self.precision_comparison["floor_u_factor_b"](
calc_vals["floor_u_factor"], calc_vals["target_u_factor"]
)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
floor_u_factor = calc_vals["floor_u_factor"]
target_u_factor = calc_vals["target_u_factor"]

return std_equal(val=floor_u_factor, std_val=target_u_factor)
return std_equal(floor_u_factor, target_u_factor)
13 changes: 12 additions & 1 deletion rct229/rulesets/ashrae9012019/section5/section5rule12.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def __init__(self):
},
manual_check_required_msg=MANUAL_CHECK_REQUIRED_MSG,
fail_msg=FAIL_MSG,
precision={
"floor_f_factor_b": {
"precision": 0.001,
"unit": "Btu/(hr*ft*R)",
}
},
)

def get_calc_vals(self, context, data=None):
Expand Down Expand Up @@ -147,9 +153,14 @@ def manual_check_required(self, context, calc_vals=None, data=None):
return target_f_factor_res != target_f_factor_nonres

def rule_check(self, context, calc_vals=None, data=None):
return self.precision_comparison["floor_f_factor_b"](
calc_vals["target_f_factor"],
calc_vals["slab_on_grade_floor_f_factor"],
)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
target_f_factor = calc_vals["target_f_factor"]
slab_on_grade_floor_f_factor = calc_vals["slab_on_grade_floor_f_factor"]

return std_equal(
std_val=target_f_factor, val=slab_on_grade_floor_f_factor
)
24 changes: 20 additions & 4 deletions rct229/rulesets/ashrae9012019/section5/section5rule13.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
)
from rct229.utils.assertions import getattr_
from rct229.utils.pint_utils import CalcQ
from rct229.utils.std_comparisons import std_equal


class Section5Rule13(RuleDefinitionListIndexedBase):
Expand Down Expand Up @@ -76,6 +75,20 @@ def __init__(self):
USER=False, BASELINE_0=True, PROPOSED=True
),
required_fields={"$": ["construction"]},
precision={
"surface_u_factor_b": {
"precision": 0.001,
"unit": "Btu/(hr*ft2*R)",
},
"surface_c_factor_b": {
"precision": 0.001,
"unit": "Btu/(hr*ft2*R)",
},
"surface_f_factor_b": {
"precision": 0.001,
"unit": "Btu/(hr*ft*R)",
},
},
)

def get_calc_vals(self, context, data=None):
Expand Down Expand Up @@ -157,17 +170,20 @@ def rule_check(self, context, calc_vals=None, data=None):
return False

if baseline_surface_type in [OST.ABOVE_GRADE_WALL, OST.FLOOR, OST.ROOF]:
return std_equal(
return self.precision_comparison["surface_u_factor_b"](
calc_vals["baseline_surface_u_factor"],
calc_vals["proposed_surface_u_factor"],
)

elif baseline_surface_type in [OST.UNHEATED_SOG, OST.HEATED_SOG]:
return std_equal(
return self.precision_comparison["surface_f_factor_b"](
calc_vals["baseline_surface_f_factor"],
calc_vals["proposed_surface_f_factor"],
)

elif baseline_surface_type == OST.BELOW_GRADE_WALL:
return std_equal(

return self.precision_comparison["surface_c_factor_b"](
calc_vals["baseline_surface_c_factor"],
calc_vals["proposed_surface_c_factor"],
)
Expand Down
14 changes: 13 additions & 1 deletion rct229/rulesets/ashrae9012019/section5/section5rule14.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
precision={
"area_type_wwr_b": {
"precision": 0.01,
"unit": "",
}
},
)

def get_calc_vals(self, context, data=None):
Expand Down Expand Up @@ -156,6 +162,12 @@ def get_manual_check_required_msg(self, context, calc_vals=None, data=None):
return manual_check_msg

def rule_check(self, context, calc_vals=None, data=None):
return self.precision_comparison["area_type_wwr_b"](
calc_vals["area_type_wwr"].magnitude,
calc_vals["area_type_target_wwr"],
)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
area_type_wwr = calc_vals["area_type_wwr"]
area_type_target_wwr = calc_vals["area_type_target_wwr"]
return std_equal(area_type_target_wwr, area_type_wwr)
return std_equal(area_type_wwr, area_type_target_wwr)
14 changes: 12 additions & 2 deletions rct229/rulesets/ashrae9012019/section5/section5rule15.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def __init__(self):
"area_type_vertical_fenestration",
],
},
precision={
"wwr_b": {
"precision": 0.01,
"unit": "",
}
},
)

def is_applicable(self, context, data=None):
Expand Down Expand Up @@ -109,6 +115,10 @@ def get_manual_check_required_msg(self, context, calc_vals=None, data=None):
return manual_check_msg

def rule_check(self, context, calc_vals=None, data=None):
return not calc_vals["manual_check_flag"] and std_equal(
calc_vals["wwr_b"], min(calc_vals["wwr_p"], WWR_THRESHOLD)
return self.precision_comparison["wwr_b"](
calc_vals["wwr_b"].magnitude,
min(calc_vals["wwr_p"].magnitude, WWR_THRESHOLD),
)
weilixu marked this conversation as resolved.
Show resolved Hide resolved

def is_tolerance_fail(self, context, calc_vals=None, data=None):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weilixu Hi Weili, is this an exception where both values are user inputs?

return std_equal(calc_vals["wwr_b"], min(calc_vals["wwr_p"], WWR_THRESHOLD))
22 changes: 19 additions & 3 deletions rct229/rulesets/ashrae9012019/section5/section5rule16.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def __init__(self):
"$": ["construction"],
"construction": ["u_factor"],
},
precision={
"total_fenestration_area_surface_b / total_fenstration_area_b": {
"precision": 0.01,
"unit": "",
}
},
fail_msg=FAIL_MSG,
)

Expand Down Expand Up @@ -169,7 +175,17 @@ def rule_check(self, context, calc_vals=None, data=None):
return (
total_fenestration_area_b == ZERO.AREA
and total_fenestration_area_p == ZERO.AREA
) or std_equal(
(total_fenestration_area_surface_b / total_fenestration_area_b),
(total_fenestration_area_surface_p / total_fenestration_area_p),
) or (
self.precision_comparison[
"total_fenestration_area_surface_b / total_fenstration_area_b"
](
(
total_fenestration_area_surface_b
/ total_fenestration_area_b
).magnitude,
(
total_fenestration_area_surface_p
/ total_fenestration_area_p
).magnitude,
)
)
13 changes: 12 additions & 1 deletion rct229/rulesets/ashrae9012019/section5/section5rule19.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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.schema.schema_enums import SchemaEnums
from rct229.rulesets.ashrae9012019.data_fns.table_G3_4_fns import table_G34_lookup
from rct229.rulesets.ashrae9012019.ruleset_functions.get_building_scc_window_wall_ratios_dict import (
get_building_scc_window_wall_ratios_dict,
Expand All @@ -18,7 +19,6 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_surface_conditioning_category_dict import (
get_surface_conditioning_category_dict,
)
from rct229.schema.schema_enums import SchemaEnums
from rct229.utils.jsonpath_utils import find_all
from rct229.utils.pint_utils import ZERO, CalcQ
from rct229.utils.std_comparisons import std_equal
Expand Down Expand Up @@ -264,6 +264,12 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
precision={
"subsurface_u_factor_b": {
"precision": 0.01,
"unit": "Btu/(hr*ft2*R)",
}
},
)

def get_calc_vals(self, context, data=None):
Expand Down Expand Up @@ -293,6 +299,11 @@ def get_calc_vals(self, context, data=None):
}

def rule_check(self, context, calc_vals=None, data=None):
return self.precision_comparison["subsurface_u_factor_b"](
calc_vals["target_u_factor"], calc_vals["subsurface_u_factor"]
)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
target_u_factor = calc_vals["target_u_factor"]
subsurface_u_factor = calc_vals["subsurface_u_factor"]
return std_equal(std_val=target_u_factor, val=subsurface_u_factor)
14 changes: 14 additions & 0 deletions rct229/rulesets/ashrae9012019/section5/section5rule20.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=False
),
precision={
"subsurface_shgc_b": {
"precision": 0.01,
"unit": "",
}
},
)

def manual_check_required(self, context, calc_vals=None, data=None):
Expand Down Expand Up @@ -282,6 +288,14 @@ def get_calc_vals(self, context, data=None):
def rule_check(self, context, calc_vals=None, data=None):
target_shgc = calc_vals["target_shgc"]
subsurface_shgc = calc_vals["subsurface_shgc"]

return target_shgc is not None and self.precision_comparison[
"subsurface_shgc_b"
](subsurface_shgc, target_shgc)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
target_shgc = calc_vals["target_shgc"]
subsurface_shgc = calc_vals["subsurface_shgc"]
return target_shgc is not None and std_equal(
std_val=target_shgc, val=subsurface_shgc
)
15 changes: 9 additions & 6 deletions rct229/rulesets/ashrae9012019/section5/section5rule21.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
get_surface_conditioning_category_dict,
)
from rct229.utils.pint_utils import CalcQ
from rct229.utils.std_comparisons import std_equal


FAIL_MSG = "Subsurface that is not regulated (Not part of building envelope) is not modeled with the same area, U-factor and SHGC in the baseline as in the propsoed design."

Expand Down Expand Up @@ -83,22 +83,25 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
fail_msg=FAIL_MSG,
precision={
"subsurface_u_factor_b": {
"precision": 0.000000001,
"precision": 0.01,
"unit": "Btu/(hr*ft2*R)",
},
"subsurface_shgc_b": {"precision": 0.000000000001},
"subsurface_shgc_b": {
"precision": 0.01,
"unit": "",
},
"subsurface_glazed_area_b": {
"precision": 0.000000000001,
"precision": 1,
"unit": "ft2",
},
"subsurface_opaque_area_b": {
"precision": 0.000000000001,
"precision": 1,
"unit": "ft2",
},
},
fail_msg=FAIL_MSG,
)

def get_calc_vals(self, context, data=None):
Expand Down
1 change: 1 addition & 0 deletions rct229/rulesets/ashrae9012019/section5/section5rule23.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rct229.rule_engine.ruleset_model_factory import produce_ruleset_model_description
from rct229.rulesets.ashrae9012019 import BASELINE_0
from rct229.utils.jsonpath_utils import find_all
from rct229.utils.std_comparisons import std_equal

MANUAL_CHECK_MSG = "Surface in P-RMD has subsurfaces modeled with different manual shade status. Verify if subsurfaces manual shade status in B-RMD are modeled the same as in P-RMD"

Expand Down
13 changes: 10 additions & 3 deletions rct229/rulesets/ashrae9012019/section5/section5rule24.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
precision={
"skylight_roof_ratio_b": {
"precision": 0.01,
"unit": "",
}
},
)

def is_applicable(self, context, data=None):
Expand Down Expand Up @@ -112,6 +118,7 @@ def get_calc_vals(self, context, data=None):
}

def rule_check(self, context, calc_vals=None, data=None):
skylight_roof_ratio_b = calc_vals["skylight_roof_ratio_b"]
skylight_roof_ratio_p = calc_vals["skylight_total_roof_ratio_p"]
return std_equal(skylight_roof_ratio_b, skylight_roof_ratio_p)
return self.precision_comparison["skylight_roof_ratio_b"](
calc_vals["skylight_roof_ratio_b"].magnitude,
calc_vals["skylight_total_roof_ratio_p"].magnitude,
)
13 changes: 12 additions & 1 deletion rct229/rulesets/ashrae9012019/section5/section5rule25.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def __init__(self):
rmds_used=produce_ruleset_model_description(
USER=False, BASELINE_0=True, PROPOSED=True
),
precision={
"skylight_roof_ratio_b": {
"precision": 0.01,
"unit": "",
}
},
)

def is_applicable(self, context, data=None):
Expand Down Expand Up @@ -110,5 +116,10 @@ def get_calc_vals(self, context, data=None):
}

def rule_check(self, context, calc_vals=None, data=None):
return self.precision_comparison["skylight_roof_ratio_b"](
calc_vals["skylight_roof_ratio_b"].magnitude, SKYLIGHT_THRESHOLD
)

def is_tolerance_fail(self, context, calc_vals=None, data=None):
skylight_roof_ratio_b = calc_vals["skylight_roof_ratio_b"]
return std_equal(skylight_roof_ratio_b, 0.03)
return std_equal(skylight_roof_ratio_b, SKYLIGHT_THRESHOLD)
Loading
Loading