Skip to content

Commit

Permalink
Merge pull request #1259 from pnnl/RS/YJ/Rule_23-5_new
Browse files Browse the repository at this point in the history
RS/YJ/Rule 23-5 (new)
  • Loading branch information
weilixu authored Jan 18, 2024
2 parents 1a427d8 + bed2e07 commit 6be59a5
Show file tree
Hide file tree
Showing 4 changed files with 595 additions and 0 deletions.
1 change: 1 addition & 0 deletions rct229/rulesets/ashrae9012019/section23/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"section23rule2",
"section23rule3",
"section23rule4",
"section23rule5",
"section23rule6",
"section23rule7",
"section23rule8",
Expand Down
97 changes: 97 additions & 0 deletions rct229/rulesets/ashrae9012019/section23/section23rule5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
from pydash import flatten
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_instance
from rct229.rulesets.ashrae9012019 import BASELINE_0
from rct229.rulesets.ashrae9012019.ruleset_functions.baseline_system_type_compare import (
baseline_system_type_compare,
)
from rct229.rulesets.ashrae9012019.ruleset_functions.baseline_systems.baseline_system_util import (
HVAC_SYS,
)
from rct229.rulesets.ashrae9012019.ruleset_functions.get_baseline_system_types import (
get_baseline_system_types,
)
from rct229.utils.assertions import getattr_

APPLICABLE_SYS_TYPES = [
HVAC_SYS.SYS_6,
HVAC_SYS.SYS_8,
]


class Section23Rule5(RuleDefinitionListIndexedBase):
"""Rule 5 of ASHRAE 90.1-2019 Appendix G Section 23 (Air-side)"""

def __init__(self):
super(Section23Rule5, self).__init__(
rmrs_used=produce_ruleset_model_instance(
USER=False, BASELINE_0=True, PROPOSED=False
),
each_rule=Section23Rule5.TerminalRule(),
index_rmr=BASELINE_0,
id="23-5",
description="For baseline systems 6 and 8, Fans in parallel VAV fan-powered boxes shall run as the first stage of heating before the reheat coil is energized.",
ruleset_section_title="HVAC - Airside",
standard_section="G3.1.3.14 Fan Power and Control (Systems 6 and 8)",
is_primary_rule=True,
rmr_context="ruleset_model_descriptions/0",
list_path="$.buildings[*].building_segments[*].zones[*].terminals[*]",
)

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

baseline_system_types_dict = get_baseline_system_types(rmd_b)

hvac_sys_6_or_8_list = flatten(
[
baseline_system_types_dict[system_type]
for system_type in baseline_system_types_dict
for applicable_sys_type in APPLICABLE_SYS_TYPES
if baseline_system_types_dict[system_type]
and baseline_system_type_compare(
system_type, applicable_sys_type, False
)
]
)

return {
"hvac_sys_6_or_8_list": hvac_sys_6_or_8_list,
}

class TerminalRule(RuleDefinitionBase):
def __init__(self):
super(Section23Rule5.TerminalRule, self).__init__(
rmrs_used=produce_ruleset_model_instance(
USER=False, BASELINE_0=True, PROPOSED=False
),
)

def is_applicable(self, context, data=None):
terminal_b = context.BASELINE_0
hvac_sys_6_or_8_list = data["hvac_sys_6_or_8_list"]
served_by_hvac_b = getattr_(
terminal_b,
"terminals",
"served_by_heating_ventilating_air_conditioning_system",
)

return served_by_hvac_b in hvac_sys_6_or_8_list

def get_calc_vals(self, context, data=None):
terminal_b = context.BASELINE_0
is_first_stage_heat_fan_powered_box_b = getattr_(
terminal_b, "terminals", "is_first_stage_heat_fan_powered_box"
)

return {
"is_first_stage_heat_fan_powered_box_b": is_first_stage_heat_fan_powered_box_b
}

def rule_check(self, context, calc_vals=None, data={}):
is_first_stage_heat_fan_powered_box_b = calc_vals[
"is_first_stage_heat_fan_powered_box_b"
]

return is_first_stage_heat_fan_powered_box_b
Loading

0 comments on commit 6be59a5

Please sign in to comment.