-
Notifications
You must be signed in to change notification settings - Fork 5
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
RS/YJ/Rule 11-6 (include only necessary codes) #1553
Merged
+246
−21
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ce9e82b
First cut at rule test 11-6
05909ea
Update ASHRAE229.schema.json
jugonzal07 962ee32
Merge branch 'RT/JG/ruletest_11_master' into RT/JG/ruletest_11_6
36b1f34
Merge branch 'RT/JG/ruletest_11_master' into RT/JG/ruletest_11_6
d0132a8
Addressed issue where SHW distributions were not referenced by any sp…
c29b727
Flipped pass and fail cases for 11-6 ruletest
ac7ac40
Added 11-6 rule
yunjoonjung-PNNL 0d774fb
Merge branch 'RT/JG/ruletest_11_6' of https://github.com/pnnl/ruleset…
yunjoonjung-PNNL 9791f3a
Added init file
yunjoonjung-PNNL 64c111a
Updated var name
yunjoonjung-PNNL b888f3d
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
yunjoonjung-PNNL 63b3ad6
Updated 11-6
yunjoonjung-PNNL b63006e
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
yunjoonjung-PNNL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"section5", | ||
"section6", | ||
"section10", | ||
"section11", | ||
"section12", | ||
"section16", | ||
"section18", | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Add all available rule modules in __all__ | ||
import importlib | ||
|
||
__all__ = [ | ||
# "section11rule1", | ||
# "section11rule2", | ||
# "section11rule3", | ||
# "section11rule4", | ||
# "section11rule5", | ||
"section11rule6", | ||
# "section11rule7", | ||
# "section11rule8", | ||
# "section11rule9", | ||
# "section11rule10", | ||
# "section11rule11", | ||
# "section11rule12", | ||
# "section11rule13", | ||
# "section11rule14", | ||
# "section11rule15", | ||
# "section11rule16", | ||
# "section11rule17", | ||
] | ||
|
||
|
||
def __getattr__(name): | ||
if name in __all__: | ||
return importlib.import_module("." + name, __name__) | ||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | ||
|
||
|
||
def __dir__(): | ||
return sorted(__all__) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
from collections import deque | ||
|
||
from rct229.rule_engine.rule_base import RuleDefinitionBase | ||
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.rulesets.ashrae9012019.ruleset_functions.get_swh_equipment_associated_with_each_swh_distriubtion_system import ( | ||
get_swh_equipment_associated_with_each_swh_distribution_system, | ||
) | ||
from rct229.utils.jsonpath_utils import find_all | ||
|
||
|
||
class Section11Rule6(RuleDefinitionListIndexedBase): | ||
"""Rule 6 of ASHRAE 90.1-2019 Appendix G Section 11 (Service Water Heating)""" | ||
|
||
def __init__(self): | ||
super(Section11Rule6, self).__init__( | ||
rmds_used=produce_ruleset_model_description( | ||
USER=False, BASELINE_0=True, PROPOSED=False | ||
), | ||
each_rule=Section11Rule6.RMDRule(), | ||
index_rmd=BASELINE_0, | ||
id="11-6", | ||
description="Piping losses shall not be modeled.", | ||
ruleset_section_title="Service Water Heating", | ||
standard_section="Table G3.1 #11, baseline column, i", | ||
is_primary_rule=True, | ||
list_path="ruleset_model_descriptions[0]", | ||
) | ||
|
||
class RMDRule(RuleDefinitionListIndexedBase): | ||
def __init__(self): | ||
super(Section11Rule6.RMDRule, self).__init__( | ||
rmds_used=produce_ruleset_model_description( | ||
USER=False, BASELINE_0=True, PROPOSED=False | ||
), | ||
each_rule=Section11Rule6.RMDRule.SWHDistRule(), | ||
index_rmd=BASELINE_0, | ||
list_path="$.service_water_heating_distribution_systems[*]", | ||
) | ||
|
||
def is_applicable(self, context, data=None): | ||
rmd_b = context.BASELINE_0 | ||
|
||
swh_dist_sys_b = find_all( | ||
"$.service_water_heating_distribution_systems[*]", rmd_b | ||
) | ||
|
||
return swh_dist_sys_b | ||
|
||
def create_data(self, context, data): | ||
rmd_b = context.BASELINE_0 | ||
|
||
swh_distribution_and_eq_list_b = ( | ||
get_swh_equipment_associated_with_each_swh_distribution_system(rmd_b) | ||
) | ||
|
||
return {"swh_distribution_and_eq_list_b": swh_distribution_and_eq_list_b} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This data is not used in the following methods. Why do we want to create it here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Addressed. |
||
|
||
class SWHDistRule(RuleDefinitionBase): | ||
def __init__(self): | ||
super(Section11Rule6.RMDRule.SWHDistRule, self).__init__( | ||
rmds_used=produce_ruleset_model_description( | ||
USER=False, | ||
BASELINE_0=True, | ||
PROPOSED=False, | ||
), | ||
required_fields={ | ||
"$": ["service_water_piping"], | ||
}, | ||
) | ||
|
||
def get_calc_vals(self, context, data=None): | ||
swh_dist_sys_b = context.BASELINE_0 | ||
|
||
piping_losses_modeled_b = [] | ||
for service_water_piping in swh_dist_sys_b["service_water_piping"]: | ||
queue = deque([service_water_piping]) | ||
while queue: | ||
current_piping = queue.popleft() | ||
children_piping = current_piping.get("child", []) | ||
queue.extend(children_piping) | ||
|
||
piping_losses_modeled_b.append( | ||
current_piping.get("are_thermal_losses_modeled") | ||
) | ||
|
||
return {"piping_losses_modeled_b": piping_losses_modeled_b} | ||
|
||
def rule_check(self, context, calc_vals=None, data=None): | ||
piping_losses_modeled_b = calc_vals["piping_losses_modeled_b"] | ||
|
||
return not any(piping_losses_modeled_b) |
143 changes: 143 additions & 0 deletions
143
rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section11/rule_11_6.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
{ | ||
"rule-11-6-a": { | ||
"Section": 11, | ||
"Rule": 6, | ||
"Test": "a", | ||
"test_description": "A one story, single zone building has service hot water piping. The service hot water piping losses are correctly not modeled.", | ||
"expected_rule_outcome": "pass", | ||
"standard": { | ||
"rule_id": "11-6", | ||
"ruleset_reference": "Table G3.1 #11, baseline column, i", | ||
"rule_description": "Piping losses shall not be modeled.", | ||
"applicable_rmr": "Baseline Model", | ||
"rule_assertion": "=", | ||
"comparison_value": "Expected Value", | ||
"mandatory_rule": "Yes", | ||
"schema_version": "0.0.34" | ||
}, | ||
"rmd_transformations": { | ||
"baseline": { | ||
"id": "ASHRAE229 1", | ||
"calendar": { | ||
"is_leap_year": false | ||
}, | ||
"data_timestamp": "2024-02-12T12:00Z", | ||
"ruleset_model_descriptions": [ | ||
{ | ||
"id": "RMD 1", | ||
"buildings": [ | ||
{ | ||
"id": "Building 1", | ||
"building_segments": [ | ||
{ | ||
"id": "Building Segment 1", | ||
"zones": [ | ||
{ | ||
"id": "Thermal Zone 1", | ||
"floor_name": "Floor1", | ||
"spaces": [ | ||
{ | ||
"id": "Space 1", | ||
"service_water_heating_uses": [ | ||
{ | ||
"id": "SHW 1", | ||
"served_by_distribution_system": "SHW Distribution 1" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"service_water_heating_distribution_systems": [ | ||
{ | ||
"id": "SHW Distribution 1", | ||
"service_water_piping": [ | ||
{ | ||
"id": "SHW Piping 1", | ||
"are_thermal_losses_modeled": false | ||
} | ||
] | ||
} | ||
], | ||
"type": "BASELINE_0" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"rule-11-6-b": { | ||
"Section": 11, | ||
"Rule": 6, | ||
"Test": "b", | ||
"test_description": "A one story, single zone building has service hot water piping. The service hot water piping losses are modeled.", | ||
"expected_rule_outcome": "fail", | ||
"standard": { | ||
"rule_id": "11-6", | ||
"ruleset_reference": "Table G3.1 #11, baseline column, i", | ||
"rule_description": "Piping losses shall not be modeled.", | ||
"applicable_rmr": "Baseline Model", | ||
"rule_assertion": "=", | ||
"comparison_value": "Expected Value", | ||
"mandatory_rule": "Yes", | ||
"schema_version": "0.0.34" | ||
}, | ||
"rmd_transformations": { | ||
"baseline": { | ||
"id": "ASHRAE229 1", | ||
"calendar": { | ||
"is_leap_year": false | ||
}, | ||
"data_timestamp": "2024-02-12T12:00Z", | ||
"ruleset_model_descriptions": [ | ||
{ | ||
"id": "RMD 1", | ||
"buildings": [ | ||
{ | ||
"id": "Building 1", | ||
"building_segments": [ | ||
{ | ||
"id": "Building Segment 1", | ||
"zones": [ | ||
{ | ||
"id": "Thermal Zone 1", | ||
"floor_name": "Floor1", | ||
"spaces": [ | ||
{ | ||
"id": "Space 1", | ||
"service_water_heating_space_type": "OFFICE", | ||
"service_water_heating_uses": [ | ||
{ | ||
"id": "SHW 1", | ||
"served_by_distribution_system": "SHW Distribution 1" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"service_water_heating_distribution_systems": [ | ||
{ | ||
"id": "SHW Distribution 1", | ||
"service_water_piping": [ | ||
{ | ||
"id": "SHW Piping 1", | ||
"are_thermal_losses_modeled": true | ||
} | ||
] | ||
} | ||
], | ||
"type": "BASELINE_0" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor -
swh_dist_sys_b
toswh_dist_sys_list_b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed