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

RS/JX/Rule16-6 #1344

Merged
merged 25 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
da43851
inital commit
Jiarongx-Xie May 3, 2024
be1012f
fix minor
Jiarongx-Xie May 8, 2024
bc9d72f
add rmd_context, minor fix of RDS
Jiarongx-Xie May 8, 2024
94cef46
First cut at ruletest 16-6
May 13, 2024
9896127
forgot the elevator in the proposed case
May 13, 2024
4ad9372
set up testing and add test json
Jiarongx-Xie May 14, 2024
d7daf96
black format
Jiarongx-Xie May 14, 2024
f3c4c04
Merge branch 'RT/JG/ruletest_16_6' of https://github.com/pnnl/ruleset…
Jiarongx-Xie May 14, 2024
e7f47e5
remove rmd_context
Jiarongx-Xie May 14, 2024
eb21999
Merge branch 'develop' into RS/JX/Rule16-6
Jiarongx-Xie May 14, 2024
e7d8c61
black format
Jiarongx-Xie May 14, 2024
85b255c
format
Jiarongx-Xie May 14, 2024
ab752ac
format
Jiarongx-Xie May 14, 2024
c90a6e3
format
Jiarongx-Xie May 14, 2024
550b2d7
black format
Jiarongx-Xie May 14, 2024
a79e3e7
Merge branch 'develop' into RS/JX/Rule16-6
weilixu May 31, 2024
66da3bf
address PR comments
Jiarongx-Xie May 31, 2024
b5848d5
update is_applicable
Jiarongx-Xie Jun 7, 2024
d64845e
Added two not applicable cases to 16-6 rule tests
Jun 14, 2024
4cc25d8
Merge branch 'RT/JG/ruletest_16_6' of https://github.com/pnnl/ruleset…
Jiarongx-Xie Jun 14, 2024
c878012
fix json path, merge test json and test the ruleset
Jiarongx-Xie Jun 17, 2024
c6cb6c4
Merge branch 'develop' into RS/JX/Rule16-6
Jiarongx-Xie Jun 17, 2024
e25ed1d
merge branch into this branch, update init file
Jiarongx-Xie Jun 17, 2024
0a82f02
run black format
Jiarongx-Xie Jun 17, 2024
0823f72
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
weilixu Jun 18, 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
2 changes: 1 addition & 1 deletion docs/section16/Rule16-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
N/A

**Applicability Check 1:**
- Rule is applicable if any building in the proposed RMD has an elevator: `if any(len(building.elevators) > 0 for building in P_RMD...buildings:`
- Rule is applicable if any building in the proposed RMD has an elevator: `if len(building.elevators > 0 for building in P_RMD...buildings:`

## Rule Logic:
- For each elevator in the baseline RMD: `for elevator in B_RMD...elevators`
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",
"section16",
"section18",
"section19",
"section21",
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",
"section16",
"section18",
"section19",
"section21",
Expand Down
16 changes: 16 additions & 0 deletions rct229/rulesets/ashrae9012019/section16/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import importlib

# Add all available rule modules in __all__
__all__ = [
"section16rule6",
]


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__)
73 changes: 73 additions & 0 deletions rct229/rulesets/ashrae9012019/section16/section16rule6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from rct229.schema.config import ureg
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

import error.
produce_ruleset_model_description

from rct229.rulesets.ashrae9012019 import BASELINE_0, PROPOSED
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to import PROPOSED

from rct229.utils.jsonpath_utils import find_all
from rct229.utils.std_comparisons import std_equal
from rct229.utils.pint_utils import ZERO
from rct229.utils.pint_utils import CalcQ

REQ_ELEVATOR_CAB_VENTILATION_FAN_POWER = 0.33 * ureg("W/cfm")


class Section16Rule6(RuleDefinitionListIndexedBase):
"""Rule 6 of ASHRAE 90.1-2019 Appendix G Section 16 (Elevators)"""

def __init__(self):
super(Section16Rule6, self).__init__(
rmds_used=produce_ruleset_model_instance(
USER=False, BASELINE_0=True, PROPOSED=True
),
each_rule=Section16Rule6.ElevatorRule(),
index_rmd=BASELINE_0,
id="16-6",
description="When included in the proposed design, the baseline elevator cab ventilation fan power shall be 0.33 W/cfm.",
ruleset_section_title="Elevators",
standard_section="Table G3.1-16 Baseline Building Performance",
is_primary_rule=True,
list_path="ruleset_model_descriptions[0].buildings[*].elevators[*]",
)

def is_applicable(self, context, data=None):
rmd_p = context.PROPOSED
return find_all("$.ruleset_model_descriptions[0].buildings[*].elevators", rmd_p)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add [*] at the end of the json path?


class ElevatorRule(RuleDefinitionBase):
def __init__(self):
super(Section16Rule6.ElevatorRule, self).__init__(
rmds_used=produce_ruleset_model_instance(
Copy link
Collaborator

Choose a reason for hiding this comment

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

update the function name

USER=False, BASELINE_0=True, PROPOSED=False
),
required_fields={
"$": ["cab_ventilation_fan_power", "cab_ventilation_fan_flow"]
},
)

def get_calc_vals(self, context, data=None):
elevator_b = context.BASELINE_0
elevator_cab_ventilation_fan_power_b = elevator_b[
"cab_ventilation_fan_power"
]
elevator_cab_ventilation_fan_flow_b = elevator_b["cab_ventilation_fan_flow"]
return {
"elevator_cab_ventilation_fan_power_b": CalcQ(
"electric_power", elevator_cab_ventilation_fan_power_b
),
"elevator_cab_ventilation_fan_flow_b": CalcQ(
"air_flow_rate", elevator_cab_ventilation_fan_flow_b
),
}

def rule_check(self, context, calc_vals=None, data=None):
elevator_cab_ventilation_fan_power_b = calc_vals[
"elevator_cab_ventilation_fan_power_b"
]
elevator_cab_ventilation_fan_flow_b = calc_vals[
"elevator_cab_ventilation_fan_flow_b"
]
return elevator_cab_ventilation_fan_flow_b != ZERO.FLOW and std_equal(
elevator_cab_ventilation_fan_power_b
/ elevator_cab_ventilation_fan_flow_b,
REQ_ELEVATOR_CAB_VENTILATION_FAN_POWER,
)
Loading
Loading