Skip to content

Commit

Permalink
Finished dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjoonjung-PNNL committed Sep 12, 2024
1 parent d2d0ff3 commit a9fd6e2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rct229/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def cli():
Software test workflow, add sections to do test. \n
--ruleset or -rs: default is ashrae9012019, available: ashrae9012019\n
argument (optional): section string, \n
currently available: section1, section4, section5, section6, section10, section12, section16, section18, section19, section21, section22 and section23"""
currently available: section1, section4, section5, section6, section10, section11, section12, section16, section18, section19, section21, section22 and section23"""


@cli.command(
Expand Down
1 change: 1 addition & 0 deletions rct229/rule_engine/rulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class RuleSetTest:
"section5",
"section6",
"section10",
"section11",
"section12",
"section16",
"section18",
Expand Down
1 change: 1 addition & 0 deletions rct229/rulesets/ashrae9012019/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"section5",
"section6",
"section10",
"section11",
"section12",
"section16",
"section18",
Expand Down
62 changes: 62 additions & 0 deletions rct229/rulesets/ashrae9012019/section11/section11rule6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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_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(RuleDefinitionBase):
def __init__(self):
super(Section11Rule6.RMDRule, 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 = context.BASELINE_0

swh_distribution_and_eq_dict = (
get_swh_uses_associated_with_each_building_segment(rmd_b)
)

piping_losses_modeled = False
for piping_id in swh_distribution_and_eq_dict:
service_water_piping = find_exactly_one_with_field_value(
"$.service_water_heating_distribution_systems[*]",
"id",
piping_id,
rmd_b,
)
if service_water_piping.get("are_thermal_losses_modeled"):
piping_losses_modeled = service_water_piping[
"are_thermal_losses_modeled"
]

return {"piping_losses_modeled": piping_losses_modeled}

def rule_check(self, context, calc_vals=None, data=None):
piping_losses_modeled = calc_vals["piping_losses_modeled"]

return not piping_losses_modeled

0 comments on commit a9fd6e2

Please sign in to comment.