-
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/JX/Rule16-6 #1344
RS/JX/Rule16-6 #1344
Changes from 16 commits
da43851
be1012f
bc9d72f
94cef46
9896127
4ad9372
d7daf96
f3c4c04
e7f47e5
eb21999
e7d8c61
85b255c
ab752ac
c90a6e3
550b2d7
a79e3e7
66da3bf
b5848d5
d64845e
4cc25d8
c878012
c6cb6c4
e25ed1d
0a82f02
0823f72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"section5", | ||
"section6", | ||
"section10", | ||
"section16", | ||
"section18", | ||
"section19", | ||
"section21", | ||
|
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__) |
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 | ||
from rct229.rulesets.ashrae9012019 import BASELINE_0, PROPOSED | ||
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. No need to import |
||
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) | ||
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. 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( | ||
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. 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, | ||
) |
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.
import error.
produce_ruleset_model_description