Skip to content

Commit

Permalink
Merge branch 'RS/YJ/Rule_11-8' of https://github.com/pnnl/ruleset-che…
Browse files Browse the repository at this point in the history
…cking-tool into RS/YJ/Rule_11-8
  • Loading branch information
yunjoonjung-PNNL committed Dec 3, 2024
2 parents eb99682 + ce25e53 commit dd6034c
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/section11/Rule11-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Schema Version:** 0.0.37
**Mandatory Rule:** True
**Rule ID:** 11-6
**Rule Description:** Piping losses shall not be modeled.
**Rule Description:** Piping losses shall not be modeled.
**Rule Assertion:** Options are PASS/FAIL/NOT_APPLICABLE/UNDETERMINED
**Appendix G Section Reference:** Table G3.1 #11, baseline column, i

Expand All @@ -26,7 +26,7 @@
- set the piping_losses_modeled to true and go directly to rule assertion: `piping_losses_modeled = true: GO TO RULE_ASSERTION`

- **Rule Assertion - Zone:**
- Case1: piping losses are not modeled, PASS: `if !piping_losses_modeled: PASS`
- Case1: piping losses are not modeled, PASS: `if piping_losses_modeled == False: PASS`
- Case2: piping losses are modeled, FAIL: `else: FAIL`


Expand Down
85 changes: 85 additions & 0 deletions rct229/rulesets/ashrae9012019/section11/section11rule6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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_uses_associated_with_each_building_segment import (
get_swh_uses_associated_with_each_building_segment,
)
from rct229.utils.jsonpath_utils import find_all, find_exactly_one_with_field_value


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.BuildingSegmentRule(),
index_rmd=BASELINE_0,
list_path="buildings[*].building_segments[*]",
)

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

return {"rmd_b": rmd_b}

class BuildingSegmentRule(RuleDefinitionBase):
def __init__(self):
super(Section11Rule6.RMDRule.BuildingSegmentRule, self).__init__(
rmds_used=produce_ruleset_model_description(
USER=False,
BASELINE_0=True,
PROPOSED=False,
),
)

def get_calc_vals(self, context, data=None):
rmd_b = data["rmd_b"]
building_segment_b = context.BASELINE_0

swh_distribution_and_eq_list = (
get_swh_uses_associated_with_each_building_segment(
rmd_b, building_segment_b["id"]
)
)

for piping_id in swh_distribution_and_eq_list:
service_water_piping_b = find_exactly_one_with_field_value(
"$.service_water_heating_distribution_systems[*]",
"id",
piping_id,
rmd_b,
)

piping_losses_modeled_b = any(
find_all(
"$.service_water_piping[*].are_thermal_losses_modeled",
service_water_piping_b,
)
)

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 piping_losses_modeled_b
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"rule-11-6-a": {
"Section": 11,
"Rule": 6,
"Test": "a",
"test_description": "A one story building, single zone building has service hot water piping. The service hot water piping losses are correctly 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": "No",
"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": true
}
]
}
],
"type": "BASELINE_0"
}
]
}
}
},
"rule-11-6-b": {
"Section": 11,
"Rule": 6,
"Test": "b",
"test_description": "A one story building, single zone building has service hot water piping. The service hot water piping losses are not 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": "No",
"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"
}
]
}
}
}
}
2 changes: 1 addition & 1 deletion rct229/schema/ASHRAE229.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5094,4 +5094,4 @@
},
"version": "0.0.36",
"$ref": "ASHRAE229.schema.json#/definitions/RulesetProjectDescription"
}
}

0 comments on commit dd6034c

Please sign in to comment.