From 5a3bcd2d3618cf82912b233d6f0bf7431e852e90 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Mon, 6 May 2024 14:30:12 -0700 Subject: [PATCH 01/25] Finished dev 16-1 --- docs/section16/Rule16-1.md | 6 +- .../data/ashrae_90_1_table_G3_9_1.json | 23 ++++ .../data/ashrae_90_1_table_G3_9_2.json | 14 ++ .../data/ashrae_90_1_table_G3_9_3.json | 9 ++ .../data_fns/table_G3_9_2_fins.py | 28 ++++ .../data_fns/table_G3_9_2_fins_test.py | 13 ++ .../data_fns/table_G3_9_3_fins.py | 39 ++++++ .../data_fns/table_G3_9_3_fins_test.py | 20 +++ .../ashrae9012019/section16/__init__.py | 3 +- .../ashrae9012019/section16/section16rule1.py | 121 ++++++++++++++++++ 10 files changed, 271 insertions(+), 5 deletions(-) create mode 100644 rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json create mode 100644 rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_2.json create mode 100644 rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_3.json create mode 100644 rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py create mode 100644 rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py create mode 100644 rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py create mode 100644 rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins_test.py create mode 100644 rct229/rulesets/ashrae9012019/section16/section16rule1.py diff --git a/docs/section16/Rule16-1.md b/docs/section16/Rule16-1.md index 15b7e4f267..1dde7506b2 100644 --- a/docs/section16/Rule16-1.md +++ b/docs/section16/Rule16-1.md @@ -5,7 +5,7 @@ **Rule Description:** The elevator peak motor power shall be calculated according to the equation in Table G3.1-16 **Rule Assertion:** B-RMR = expected value **Appendix G Section:** G3.1 -**Appendix G Section Reference:** Table G3.1-16 Baseline Building Performance +**Appendix G Section Reference:** Table G3.1-16 Baseline Building Performance **Data Lookup:** Table G3.9.1, Table G3.9.2, Table G3.9.3 **Evaluation Context:** Each elevator @@ -26,7 +26,7 @@ data_lookup - Get the elevator cab counterweight: `elevator_cab_counterweight_b = elevator.cab_counterweight` - Get the elevator design load: `elevator_design_load_b = elevator.design_load` - Get the elevator speed: `elevator_speed_b = elevator.speed` - - If any detailed elevator data parameters are not defined: `if any(param == Null for param in [total_floors_served_b, elevator_motor_power_b, elevator_cab_weight_b, elevator_cab_counterweight_b, elevator_design_load_b, elevator_speed_b]): is_undetermined = true` + - If any detailed elevator data parameters are not defined: `if any(param == Null for param in [total_floors_served_b, elevator_motor_power_b, elevator_cab_weight_b, elevator_cab_counterweight_b, elevator_design_load_b, elevator_speed_b]): has_undetermined = true` - Get the elevator mechanical efficiency: `elevator_mechanical_efficiency_b = data_lookup('table_g3.9.2', total_floors_served_b)['mechanical_efficiency']` - Calculate the motor brake horsepower: `motor_brake_horsepower_b = (elevator_cab_weight_b + elevator_design_load_b - elevator_cab_counterweight_b) * elevator_speed_b / 33000 / elevator_mechanical_efficiency_b` - If the total number of floors is greater than 4: `if total_floors_served_b > 4:` @@ -36,7 +36,7 @@ data_lookup - Calculate the expected peak motor power: `expected_peak_motor_power = motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b` **Rule Assertion:** - - Case 1: If the number of floors in the building could not be determined or any detailed elevator data parameters are not defined, outcome = UNDETERMINED: `if is_undetermined: UNDETERMINED` + - Case 1: If the number of floors in the building could not be determined or any detailed elevator data parameters are not defined, outcome = UNDETERMINED: `if has_undetermined: UNDETERMINED` - Case 2: If the calculated peak motor power is equal to the expected value: `if elevator_motor_power_b == expected_peak_motor_power: PASS` - Case 3: Else: `else: FAIL` diff --git a/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json new file mode 100644 index 0000000000..19e6cae24a --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json @@ -0,0 +1,23 @@ +{ + "performance_rating_method_motor_efficiency_requirements": [ + {"shaft_input_power": 1.0, "full_load_motor_efficiency_for_modeling": 0.825}, + {"shaft_input_power": 1.5, "full_load_motor_efficiency_for_modeling": 0.840}, + {"shaft_input_power": 2.0, "full_load_motor_efficiency_for_modeling": 0.840}, + {"shaft_input_power": 3.0, "full_load_motor_efficiency_for_modeling": 0.875}, + {"shaft_input_power": 5.0, "full_load_motor_efficiency_for_modeling": 0.875}, + {"shaft_input_power": 7.5, "full_load_motor_efficiency_for_modeling": 0.895}, + {"shaft_input_power": 10.0, "full_load_motor_efficiency_for_modeling": 0.895}, + {"shaft_input_power": 15.0, "full_load_motor_efficiency_for_modeling": 0.910}, + {"shaft_input_power": 20.0, "full_load_motor_efficiency_for_modeling": 0.910}, + {"shaft_input_power": 25.0, "full_load_motor_efficiency_for_modeling": 0.924}, + {"shaft_input_power": 30.0, "full_load_motor_efficiency_for_modeling": 0.924}, + {"shaft_input_power": 40.0, "full_load_motor_efficiency_for_modeling": 0.930}, + {"shaft_input_power": 50.0, "full_load_motor_efficiency_for_modeling": 0.930}, + {"shaft_input_power": 60.0, "full_load_motor_efficiency_for_modeling": 0.936}, + {"shaft_input_power": 75.0, "full_load_motor_efficiency_for_modeling": 0.941}, + {"shaft_input_power": 100.0, "full_load_motor_efficiency_for_modeling": 0.945}, + {"shaft_input_power": 1250, "full_load_motor_efficiency_for_modeling": 0.945}, + {"shaft_input_power": 150.0, "full_load_motor_efficiency_for_modeling": 0.950}, + {"shaft_input_power": 200.0, "full_load_motor_efficiency_for_modeling": 0.950} + ] +} diff --git a/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_2.json b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_2.json new file mode 100644 index 0000000000..69e0130ce3 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_2.json @@ -0,0 +1,14 @@ +{ + "performance_rating_method_baseline_elevator_motor": [ + { + "number_of_stories": "less than or equal to 4", + "motor_type": "Hydraulic", + "mechanical_efficiency": 0.58 + }, + { + "number_of_stories": "greater than 4", + "motor_type": "Traction", + "mechanical_efficiency": 0.64 + } + ] +} diff --git a/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_3.json b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_3.json new file mode 100644 index 0000000000..7b661755e9 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_3.json @@ -0,0 +1,9 @@ +{ + "performance_rating_method_hydraulic_elevator_motor_efficiency": [ + {"shaft_input_power": 10, "full_load_motor_efficiency_for_modeling": 0.72}, + {"shaft_input_power": 20, "full_load_motor_efficiency_for_modeling": 0.75}, + {"shaft_input_power": 30, "full_load_motor_efficiency_for_modeling": 0.78}, + {"shaft_input_power": 40, "full_load_motor_efficiency_for_modeling": 0.78}, + {"shaft_input_power": 100, "full_load_motor_efficiency_for_modeling": 0.80} + ] +} diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py new file mode 100644 index 0000000000..cc90d4a36a --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py @@ -0,0 +1,28 @@ +from rct229.rulesets.ashrae9012019.data import data +from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry + + +def table_G3_9_2_lookup(number_of_stories: int) -> dict[str, float]: + """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.2 + Parameters + ---------- + number_of_stories: int + number of stories including basement + + Returns + ------- + dict + {mechanical_efficiency - The mechanical efficiency by Table G3.9.2} + + """ + + number_of_stories = ( + "less than or equal to 4" if number_of_stories <= 4 else "greater than 4" + ) + + mechanical_efficiency = find_osstd_table_entry( + [("number_of_stories", number_of_stories)], + osstd_table=data["ashrae_90_1_table_G3_9_2"], + )["mechanical_efficiency"] + + return {"mechanical_efficiency": mechanical_efficiency} diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py new file mode 100644 index 0000000000..cc522cac11 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py @@ -0,0 +1,13 @@ +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup + + +def test__table_G3_9_lookup__4_story_building(): + assert table_G3_9_2_lookup( + number_of_stories=4, + ) == {"mechanical_efficiency": 0.58} + + +def test__table_G3_9_lookup__6_story_building(): + assert table_G3_9_2_lookup( + number_of_stories=6, + ) == {"mechanical_efficiency": 0.64} diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py new file mode 100644 index 0000000000..9809799303 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -0,0 +1,39 @@ +from pint import Quantity +from rct229.rulesets.ashrae9012019.data import data +from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry +from rct229.schema.config import ureg + + +def table_G3_9_3_lookup(shaft_input_power: Quantity) -> dict[str, float]: + """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.2 + Parameters + ---------- + shaft_input_power: Quantity + shaft input power value + + Returns + ------- + dict + {full_load_motor_efficiency_for_modeling - The full load motor efficiency for modeling by Table G3.9.3} + + """ + + if 0 * ureg("hp") <= shaft_input_power <= 10.0 * ureg("hp"): + shaft_input_power = 10 + elif 10 * ureg("hp") < shaft_input_power <= 20.0 * ureg("hp"): + shaft_input_power = 20 + elif 20 * ureg("hp") < shaft_input_power <= 30.0 * ureg("hp"): + shaft_input_power = 30 + elif 30 * ureg("hp") < shaft_input_power <= 40.0 * ureg("hp"): + shaft_input_power = 40 + elif 40 * ureg("hp") < shaft_input_power: + shaft_input_power = 100 + + full_load_motor_efficiency_for_modeling = find_osstd_table_entry( + [("shaft_input_power", shaft_input_power)], + osstd_table=data["ashrae_90_1_table_G3_9_3"], + )["full_load_motor_efficiency_for_modeling"] + + return { + "full_load_motor_efficiency_for_modeling": full_load_motor_efficiency_for_modeling + } diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins_test.py new file mode 100644 index 0000000000..08c037e2c4 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins_test.py @@ -0,0 +1,20 @@ +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup +from rct229.schema.config import ureg + + +def test__table_G3_9_lookup__15_hp_shaft_power(): + assert table_G3_9_3_lookup( + shaft_input_power=15.0 * ureg("hp"), + ) == {"full_load_motor_efficiency_for_modeling": 0.75} + + +def test__table_G3_9_lookup__25_hp_shaft_power(): + assert table_G3_9_3_lookup( + shaft_input_power=25.0 * ureg("hp"), + ) == {"full_load_motor_efficiency_for_modeling": 0.78} + + +def test__table_G3_9_lookup__105_hp_shaft_power(): + assert table_G3_9_3_lookup( + shaft_input_power=105.0 * ureg("hp"), + ) == {"full_load_motor_efficiency_for_modeling": 0.80} diff --git a/rct229/rulesets/ashrae9012019/section16/__init__.py b/rct229/rulesets/ashrae9012019/section16/__init__.py index f12e62e1e8..d52c4f2a21 100644 --- a/rct229/rulesets/ashrae9012019/section16/__init__.py +++ b/rct229/rulesets/ashrae9012019/section16/__init__.py @@ -2,11 +2,10 @@ # Add all available rule modules in __all__ __all__ = [ - # "section16rule1", + "section16rule1", "section16rule2", "section16rule3", "section16rule4", - # "section16rule5", # "section16rule6", # "section16rule7", ] diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py new file mode 100644 index 0000000000..7ac9561da1 --- /dev/null +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -0,0 +1,121 @@ +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, USER +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import table_G3_9_1_lookup +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup +from rct229.utils.jsonpath_utils import find_all +from rct229.utils.pint_utils import CalcQ +from rct229.utils.std_comparisons import std_equal + + +class Section16Rule1(RuleDefinitionListIndexedBase): + """Rule 1 of ASHRAE 90.1-2019 Appendix G Section 16 (Elevators)""" + + def __init__(self): + super(Section16Rule1, self).__init__( + rmds_used=produce_ruleset_model_instance( + USER=False, + BASELINE_0=True, + PROPOSED=False, + ), + each_rule=Section16Rule1.ElevatorRule(), + index_rmd="baseline", + id="16-1", + description="The elevator peak motor power shall be calculated according to the equation in Table G3.1-16.", + ruleset_section_title="Elevators", + standard_section="Section G3.1", + is_primary_rule=True, + rmd_context="ruleset_model_descriptions/0", + list_path="ruleset_model_descriptions[0].buildings[*].elevators[*]", + ) + + def is_applicable(self, context, data=None): + rmd_p = context.PROPOSED + + return ( + len( + find_all( + "$.ruleset_model_descriptions[0].buildings[*].elevators", rmd_p + ) + ) + > 0 + ) + + class ElevatorRule(RuleDefinitionBase): + def __init__(self): + super(Section16Rule1.ElevatorRule, self).__init__( + rmds_used=produce_ruleset_model_instance( + USER=False, + BASELINE_0=True, + PROPOSED=False, + ), + ) + + def get_calc_vals(self, context, data=None): + elevator_b = context.BASELINE_0 + + total_floors_served_b = elevator_b.get("number_of_floors_served") + elevator_motor_power_b = elevator_b.get("motor_power") + elevator_cab_weight_b = elevator_b.get("cab_weight") + elevator_cab_counterweight_b = elevator_b.get("cab_counterweight") + elevator_design_load_b = elevator_b.get("design_load") + elevator_speed_b = elevator_b.get("speed") + + has_undetermined = any( + [ + param is None + for param in ( + total_floors_served_b, + elevator_motor_power_b, + elevator_cab_weight_b, + elevator_cab_counterweight_b, + elevator_design_load_b, + elevator_speed_b, + ) + ] + ) + + elevator_mechanical_efficiency_b = 1 + motor_brake_horsepower_b = ( + ( + elevator_cab_weight_b + + elevator_design_load_b + - elevator_cab_counterweight_b + ) + * elevator_speed_b + / 33000 + / elevator_mechanical_efficiency_b + ) + + elevator_motor_efficiency_b = ( + table_G3_9_1_lookup(motor_brake_horsepower_b)["motor_efficiency"] + if total_floors_served_b > 4 + else table_G3_9_3_lookup(motor_brake_horsepower_b)["motor_efficiency"] + ) + + expected_peak_motor_power_b = ( + motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b + ) + + return { + "expected_peak_motor_power_b": CalcQ( + "electric_power", expected_peak_motor_power_b + ), + "elevator_motor_power_b": CalcQ( + "electric_power", elevator_motor_power_b + ), + "has_undetermined": has_undetermined, + } + + def manual_check_required(self, context, calc_vals=None, data=None): + has_undetermined = calc_vals["has_undetermined"] + + return has_undetermined + + def rule_check(self, context, calc_vals=None, data=None): + expected_peak_motor_power_b = calc_vals["expected_peak_motor_power_b"] + elevator_motor_power_b = calc_vals["elevator_motor_power_b"] + + return std_equal(expected_peak_motor_power_b, elevator_motor_power_b) From bf1e78bd22366b387cfd418cbb9a83353201ee63 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Mon, 6 May 2024 14:32:35 -0700 Subject: [PATCH 02/25] Fixed elevator_mechanical_efficiency_b --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 7ac9561da1..187fe3afa0 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -77,7 +77,9 @@ def get_calc_vals(self, context, data=None): ] ) - elevator_mechanical_efficiency_b = 1 + elevator_mechanical_efficiency_b = table_G3_9_2_lookup( + total_floors_served_b + )["mechanical_efficiency"] motor_brake_horsepower_b = ( ( elevator_cab_weight_b @@ -88,13 +90,11 @@ def get_calc_vals(self, context, data=None): / 33000 / elevator_mechanical_efficiency_b ) - elevator_motor_efficiency_b = ( table_G3_9_1_lookup(motor_brake_horsepower_b)["motor_efficiency"] if total_floors_served_b > 4 else table_G3_9_3_lookup(motor_brake_horsepower_b)["motor_efficiency"] ) - expected_peak_motor_power_b = ( motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b ) From bc54e0f2b3546f83cc635de432a113f3c191ae88 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 7 May 2024 22:52:26 -0700 Subject: [PATCH 03/25] Addressed PR comments --- .../data_fns/extra_schema_fns.py | 1 - .../ashrae9012019/data_fns/table_8_4_4_fns.py | 1 - .../data_fns/table_8_4_4_fns_test.py | 1 - .../data_fns/table_G3_5_1_fns.py | 5 +- .../data_fns/table_G3_5_2_fns.py | 5 +- .../data_fns/table_G3_5_2_fns_test.py | 2 +- .../data_fns/table_G3_5_3_fns.py | 2 +- .../data_fns/table_G3_5_4_fns.py | 3 +- .../data_fns/table_G3_5_4_fns_test.py | 2 +- .../data_fns/table_G3_5_5_fns.py | 3 +- .../data_fns/table_G3_5_5_fns_test.py | 2 +- .../data_fns/table_G3_9_2_fins.py | 8 +- .../data_fns/table_G3_9_3_fins.py | 28 +++++-- .../ashrae9012019/section16/section16rule1.py | 76 +++++++++---------- 14 files changed, 78 insertions(+), 61 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/extra_schema_fns.py b/rct229/rulesets/ashrae9012019/data_fns/extra_schema_fns.py index 23cb00a343..d93ee411da 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/extra_schema_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/extra_schema_fns.py @@ -2,7 +2,6 @@ from functools import partial from pint import Quantity - from rct229.rulesets.ashrae9012019.data import data EXTRA_SCHEMA = data["ASHRAE229.9012019.extra.schema"] diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns.py index 110b827c5e..45b64aa5d8 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns.py @@ -1,5 +1,4 @@ from numpy import interp - from rct229.rulesets.ashrae9012019.data import data from rct229.schema.config import ureg from rct229.schema.schema_enums import SchemaEnums diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns_test.py index 8800b5dfb4..c4f90c4719 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_8_4_4_fns_test.py @@ -1,6 +1,5 @@ import pytest from numpy.testing import assert_approx_equal - from rct229.rulesets.ashrae9012019.data_fns.table_8_4_4_fns import ( SINGLE_PHASE, THREE_PHASE, diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_1_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_1_fns.py index c43261ce13..09e8e5eb5a 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_1_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_1_fns.py @@ -1,9 +1,10 @@ +from typing import TypedDict, Union + from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import ( - find_osstd_table_entry, find_osstd_table_entries, + find_osstd_table_entry, ) -from typing import TypedDict, Union class AppGAirSysEffTableSearchInfo(TypedDict): diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns.py index 91c88c13cf..88d2a3e4a9 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns.py @@ -1,9 +1,10 @@ +from typing import TypedDict, Union + from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import ( - find_osstd_table_entry, find_osstd_table_entries, + find_osstd_table_entry, ) -from typing import TypedDict, Union class AppGAirSysEffTableSearchInfo(TypedDict): diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns_test.py index 2101f53b9f..ac320d8642 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_2_fns_test.py @@ -1,7 +1,7 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_5_2_fns import ( - table_g3_5_2_lookup, HeatPumpEquipmentType, RatingCondition, + table_g3_5_2_lookup, ) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_3_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_3_fns.py index 081dab996e..4c8c3bbf8e 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_3_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_3_fns.py @@ -1,7 +1,7 @@ +from pint import Quantity from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.schema.config import ureg -from pint import Quantity # This dictionary maps the ChillerCompressorOptions enumerations to # the corresponding chiller types diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns.py index 6b82e3de91..834fa0b93b 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns.py @@ -1,6 +1,7 @@ +from typing import TypedDict + from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry -from typing import TypedDict class AppGAirSysEffTableSearchInfo(TypedDict): diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns_test.py index ab362c4a9e..a5c744336d 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_4_fns_test.py @@ -1,6 +1,6 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_5_4_fns import ( - table_g3_5_4_lookup, EquipmentType, + table_g3_5_4_lookup, ) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns.py index 19ac21e160..10ce0b55b8 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns.py @@ -1,6 +1,7 @@ +from typing import TypedDict, Union + from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entries -from typing import TypedDict, Union class AppGAirSysEffTableSearchInfo(TypedDict): diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns_test.py index 0cc81b29db..fc16b9c9d2 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_5_5_fns_test.py @@ -1,6 +1,6 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_5_5_fns import ( - table_g3_5_5_lookup, GasHeatingEquipmentType, + table_g3_5_5_lookup, ) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py index cc90d4a36a..2c3031ad5a 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py @@ -1,8 +1,14 @@ +from typing import TypedDict + from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry -def table_G3_9_2_lookup(number_of_stories: int) -> dict[str, float]: +class MechanicalEfficiency(TypedDict): + mechanical_efficiency: float + + +def table_G3_9_2_lookup(number_of_stories: int) -> MechanicalEfficiency: """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.2 Parameters ---------- diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index 9809799303..f599ec01b2 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -1,10 +1,18 @@ +import math +from typing import TypedDict + from pint import Quantity from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.schema.config import ureg +from rct229.utils.assertions import assert_ + +class FullLoadMotorEfficiency(TypedDict): + full_load_motor_efficiency_for_modeling: float -def table_G3_9_3_lookup(shaft_input_power: Quantity) -> dict[str, float]: + +def table_G3_9_3_lookup(shaft_input_power: Quantity) -> FullLoadMotorEfficiency: """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.2 Parameters ---------- @@ -18,15 +26,23 @@ def table_G3_9_3_lookup(shaft_input_power: Quantity) -> dict[str, float]: """ - if 0 * ureg("hp") <= shaft_input_power <= 10.0 * ureg("hp"): + shaft_input_power_mag = shaft_input_power * ureg("hp") + shaft_input_power_mag = shaft_input_power_mag.magnitude + assert_( + shaft_input_power_mag >= 0, + "shaft input power is negative value, incorrect data.", + ) + shaft_input_power = math.ceil(shaft_input_power_mag / 10) * 10 + + if 0 <= shaft_input_power <= 10.0: shaft_input_power = 10 - elif 10 * ureg("hp") < shaft_input_power <= 20.0 * ureg("hp"): + elif 10 < shaft_input_power <= 20.0: shaft_input_power = 20 - elif 20 * ureg("hp") < shaft_input_power <= 30.0 * ureg("hp"): + elif 20 < shaft_input_power <= 30.0: shaft_input_power = 30 - elif 30 * ureg("hp") < shaft_input_power <= 40.0 * ureg("hp"): + elif 30 < shaft_input_power <= 40.0: shaft_input_power = 40 - elif 40 * ureg("hp") < shaft_input_power: + elif 40 < shaft_input_power: shaft_input_power = 100 full_load_motor_efficiency_for_modeling = find_osstd_table_entry( diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 187fe3afa0..a6cb6a2e05 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -5,9 +5,11 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import table_G3_9_1_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup +from rct229.utils.assertions import getattr_ from rct229.utils.jsonpath_utils import find_all from rct229.utils.pint_utils import CalcQ from rct229.utils.std_comparisons import std_equal +from rct229.schema.config import ureg class Section16Rule1(RuleDefinitionListIndexedBase): @@ -17,8 +19,8 @@ def __init__(self): super(Section16Rule1, self).__init__( rmds_used=produce_ruleset_model_instance( USER=False, - BASELINE_0=True, - PROPOSED=False, + BASELINE_0=False, + PROPOSED=True, ), each_rule=Section16Rule1.ElevatorRule(), index_rmd="baseline", @@ -34,14 +36,7 @@ def __init__(self): def is_applicable(self, context, data=None): rmd_p = context.PROPOSED - return ( - len( - find_all( - "$.ruleset_model_descriptions[0].buildings[*].elevators", rmd_p - ) - ) - > 0 - ) + return find_all("$.ruleset_model_descriptions[0].buildings[*].elevators", rmd_p) class ElevatorRule(RuleDefinitionBase): def __init__(self): @@ -56,39 +51,41 @@ def __init__(self): def get_calc_vals(self, context, data=None): elevator_b = context.BASELINE_0 - total_floors_served_b = elevator_b.get("number_of_floors_served") - elevator_motor_power_b = elevator_b.get("motor_power") - elevator_cab_weight_b = elevator_b.get("cab_weight") - elevator_cab_counterweight_b = elevator_b.get("cab_counterweight") - elevator_design_load_b = elevator_b.get("design_load") - elevator_speed_b = elevator_b.get("speed") - - has_undetermined = any( - [ - param is None - for param in ( - total_floors_served_b, - elevator_motor_power_b, - elevator_cab_weight_b, - elevator_cab_counterweight_b, - elevator_design_load_b, - elevator_speed_b, - ) - ] + total_floors_served_b = getattr_( + elevator_b, "elevator", "number_of_floors_served" ) + elevator_motor_power_b = getattr_(elevator_b, "elevator", "motor_power") + elevator_cab_weight_b = getattr_(elevator_b, "elevator", "cab_weight") + elevator_cab_counterweight_b = getattr_( + elevator_b, "elevator", "cab_counterweight" + ) + elevator_design_load_b = getattr_(elevator_b, "elevator", "design_load") + elevator_speed_b = getattr_(elevator_b, "elevator", "speed") elevator_mechanical_efficiency_b = table_G3_9_2_lookup( total_floors_served_b )["mechanical_efficiency"] + + # From Table G3.1 16 Elevators + # bhp = (Weight of Car + Rated Load – Counterweight) × Speed of Car / (33, 000 × h_mechanical) + # P_m = bhp x 746 / h_motor + # Where, + # Weight of Car: the proposed design elevator car weight, lb + # Rated Load: the proposed design elevator load at which to operate, lb + # Counterweight of Car: the elevator car counterweight, from Table G3.9.2, lb + # Speed of Car: the speed of the proposed elevator, ft/min + # h_mechanical: the mechanical efficiency of the elevator from Table G3.9.2 + # h_motor: the motor efficiency from Table G3.9.2 + # Pm: peak elevator motor power, W motor_brake_horsepower_b = ( ( - elevator_cab_weight_b - + elevator_design_load_b - - elevator_cab_counterweight_b + elevator_cab_weight_b * ureg("lb") + + elevator_design_load_b * ureg("lb") + - elevator_cab_counterweight_b * ureg("lb") ) * elevator_speed_b - / 33000 - / elevator_mechanical_efficiency_b + * ureg("ft/min") + / (33000 * elevator_mechanical_efficiency_b) ) elevator_motor_efficiency_b = ( table_G3_9_1_lookup(motor_brake_horsepower_b)["motor_efficiency"] @@ -96,7 +93,10 @@ def get_calc_vals(self, context, data=None): else table_G3_9_3_lookup(motor_brake_horsepower_b)["motor_efficiency"] ) expected_peak_motor_power_b = ( - motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b + motor_brake_horsepower_b.m + * ureg("hp") + * 746 + / elevator_motor_efficiency_b ) return { @@ -106,14 +106,8 @@ def get_calc_vals(self, context, data=None): "elevator_motor_power_b": CalcQ( "electric_power", elevator_motor_power_b ), - "has_undetermined": has_undetermined, } - def manual_check_required(self, context, calc_vals=None, data=None): - has_undetermined = calc_vals["has_undetermined"] - - return has_undetermined - def rule_check(self, context, calc_vals=None, data=None): expected_peak_motor_power_b = calc_vals["expected_peak_motor_power_b"] elevator_motor_power_b = calc_vals["elevator_motor_power_b"] From 641b064bd4db58e8d9bf7c0630cd7b3a91efc077 Mon Sep 17 00:00:00 2001 From: gonz102 Date: Mon, 13 May 2024 14:54:42 -0400 Subject: [PATCH 04/25] First cut at 16-1 --- .../ashrae9012019/section16/rule_16_1.json | 392 ++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json diff --git a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json new file mode 100644 index 0000000000..32295887d5 --- /dev/null +++ b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json @@ -0,0 +1,392 @@ +{ + "rule-16-1-a": { + "Section": 16, + "Rule": 1, + "Test": "a", + "test_description": "A baseline building with an elevator does not have the number of floors defined. ", + "expected_rule_outcome": "undetermined", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "motor_power": 15000, + "cab_counterweight": 1814.4000000000003, + "cab_weight": 680.4000000000001, + "design_load": 907.2000000000002, + "speed": 0.5079999999999999 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + }, + "rule-16-1-b": { + "Section": 16, + "Rule": 1, + "Test": "b", + "test_description": "A baseline building with an elevator does not have important elevator parameters defined.", + "expected_rule_outcome": "undetermined", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + }, + "rule-16-1-c": { + "Section": 16, + "Rule": 1, + "Test": "c", + "test_description": "A baseline building with 4 floors and an elevator has the appropriate performance metrics to meet the elevator motor power defined in Table G3.9.3. Expected result: PASS", + "expected_rule_outcome": "pass", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4, + "motor_power": 24984.593950111193, + "cab_counterweight": 226.80000000000004, + "cab_weight": 680.4000000000001, + "design_load": 1814.4000000000003, + "speed": 0.5079999999999999 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + }, + "rule-16-1-d": { + "Section": 16, + "Rule": 1, + "Test": "d", + "test_description": "A baseline building with 4 floors and an elevator does not have the appropriate performance metrics to meet the elevator motor power defined in Table G3.9.3. Expected result: FAIL", + "expected_rule_outcome": "fail", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4, + "motor_power": 20000, + "cab_counterweight": 226.80000000000004, + "cab_weight": 680.4000000000001, + "design_load": 1814.4000000000003, + "speed": 0.5079999999999999 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + } +} \ No newline at end of file From b5275f568759cc0df1fce7a22bb836d073c7c92b Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 14 May 2024 12:14:53 -0700 Subject: [PATCH 05/25] Fixed wrong part --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index a6cb6a2e05..e512a99ab9 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -19,24 +19,24 @@ def __init__(self): super(Section16Rule1, self).__init__( rmds_used=produce_ruleset_model_instance( USER=False, - BASELINE_0=False, + BASELINE_0=True, PROPOSED=True, ), each_rule=Section16Rule1.ElevatorRule(), - index_rmd="baseline", + index_rmd=BASELINE_0, id="16-1", description="The elevator peak motor power shall be calculated according to the equation in Table G3.1-16.", ruleset_section_title="Elevators", standard_section="Section G3.1", is_primary_rule=True, rmd_context="ruleset_model_descriptions/0", - list_path="ruleset_model_descriptions[0].buildings[*].elevators[*]", + list_path="$.buildings[*].elevators[*]", ) def is_applicable(self, context, data=None): rmd_p = context.PROPOSED - return find_all("$.ruleset_model_descriptions[0].buildings[*].elevators", rmd_p) + return find_all("$.buildings[*].elevators", rmd_p) class ElevatorRule(RuleDefinitionBase): def __init__(self): From a1eded80952b3a80c1d1f4faf6dbebabfdf2f4d9 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Wed, 15 May 2024 12:31:43 -0700 Subject: [PATCH 06/25] Updated unneeded import --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index e512a99ab9..72c515332a 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -1,7 +1,7 @@ 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, USER +from rct229.rulesets.ashrae9012019 import BASELINE_0 from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import table_G3_9_1_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup From 5bffe19c77005b58420f6880739ba08fe0e52d45 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Wed, 15 May 2024 17:14:50 -0700 Subject: [PATCH 07/25] Isort --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 72c515332a..cc12582023 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -5,11 +5,11 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import table_G3_9_1_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup +from rct229.schema.config import ureg from rct229.utils.assertions import getattr_ from rct229.utils.jsonpath_utils import find_all from rct229.utils.pint_utils import CalcQ from rct229.utils.std_comparisons import std_equal -from rct229.schema.config import ureg class Section16Rule1(RuleDefinitionListIndexedBase): From ef966ee6ff9bf2e21ab7e3acb22b9b8beacf173d Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 28 May 2024 11:06:45 -0700 Subject: [PATCH 08/25] Replaced rmi with rmd --- .../ashrae9012019/section16/section16rule1.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index cc12582023..f387ab4b28 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -1,6 +1,6 @@ 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.rule_engine.ruleset_model_factory import produce_ruleset_model_description from rct229.rulesets.ashrae9012019 import BASELINE_0 from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import table_G3_9_1_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup @@ -17,7 +17,7 @@ class Section16Rule1(RuleDefinitionListIndexedBase): def __init__(self): super(Section16Rule1, self).__init__( - rmds_used=produce_ruleset_model_instance( + rmds_used=produce_ruleset_model_description( USER=False, BASELINE_0=True, PROPOSED=True, @@ -36,12 +36,12 @@ def __init__(self): def is_applicable(self, context, data=None): rmd_p = context.PROPOSED - return find_all("$.buildings[*].elevators", rmd_p) + return find_all("$.buildings[*].elevators[*]", rmd_p) class ElevatorRule(RuleDefinitionBase): def __init__(self): super(Section16Rule1.ElevatorRule, self).__init__( - rmds_used=produce_ruleset_model_instance( + rmds_used=produce_ruleset_model_description( USER=False, BASELINE_0=True, PROPOSED=False, @@ -52,15 +52,15 @@ def get_calc_vals(self, context, data=None): elevator_b = context.BASELINE_0 total_floors_served_b = getattr_( - elevator_b, "elevator", "number_of_floors_served" + elevator_b, "elevators", "number_of_floors_served" ) - elevator_motor_power_b = getattr_(elevator_b, "elevator", "motor_power") - elevator_cab_weight_b = getattr_(elevator_b, "elevator", "cab_weight") + elevator_motor_power_b = getattr_(elevator_b, "elevators", "motor_power") + elevator_cab_weight_b = getattr_(elevator_b, "elevators", "cab_weight") elevator_cab_counterweight_b = getattr_( - elevator_b, "elevator", "cab_counterweight" + elevator_b, "elevators", "cab_counterweight" ) - elevator_design_load_b = getattr_(elevator_b, "elevator", "design_load") - elevator_speed_b = getattr_(elevator_b, "elevator", "speed") + elevator_design_load_b = getattr_(elevator_b, "elevators", "design_load") + elevator_speed_b = getattr_(elevator_b, "elevators", "speed") elevator_mechanical_efficiency_b = table_G3_9_2_lookup( total_floors_served_b From 4b306e81414d9b3db2daed630c5e14eedac7529e Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 28 May 2024 11:19:42 -0700 Subject: [PATCH 09/25] Fixed table G3 9 3 fins file --- .../ashrae9012019/data_fns/table_G3_9_3_fins.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index f599ec01b2..85412beec2 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -34,15 +34,7 @@ def table_G3_9_3_lookup(shaft_input_power: Quantity) -> FullLoadMotorEfficiency: ) shaft_input_power = math.ceil(shaft_input_power_mag / 10) * 10 - if 0 <= shaft_input_power <= 10.0: - shaft_input_power = 10 - elif 10 < shaft_input_power <= 20.0: - shaft_input_power = 20 - elif 20 < shaft_input_power <= 30.0: - shaft_input_power = 30 - elif 30 < shaft_input_power <= 40.0: - shaft_input_power = 40 - elif 40 < shaft_input_power: + if shaft_input_power > 40: shaft_input_power = 100 full_load_motor_efficiency_for_modeling = find_osstd_table_entry( From 4e833ee9f20eb459e0bc1a95be69d83767caefae Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Fri, 31 May 2024 14:10:56 -0700 Subject: [PATCH 10/25] Added not applicable case when there is no or empty elevator in baseline --- .../rulesets/ashrae9012019/section16/section16rule1.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index f387ab4b28..338b8c942e 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -7,7 +7,7 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup from rct229.schema.config import ureg from rct229.utils.assertions import getattr_ -from rct229.utils.jsonpath_utils import find_all +from rct229.utils.jsonpath_utils import find_all, find_one from rct229.utils.pint_utils import CalcQ from rct229.utils.std_comparisons import std_equal @@ -34,9 +34,14 @@ def __init__(self): ) def is_applicable(self, context, data=None): + rmd_b = context.BASELINE_0 rmd_p = context.PROPOSED - return find_all("$.buildings[*].elevators[*]", rmd_p) + elevators_list_b = find_all("$.buildings[*].elevators[*]", rmd_b) + elevators_list_p = find_all("$.buildings[*].elevators[*]", rmd_p) + elevators_dict_b = find_one("$.buildings[*].elevators[*]", rmd_b) + + return elevators_list_p and (elevators_dict_b is not None and elevators_list_b) class ElevatorRule(RuleDefinitionBase): def __init__(self): From cc20befa13dbc1f78e8b27e6ee224e8b506259af Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 4 Jun 2024 13:57:56 -0700 Subject: [PATCH 11/25] Fixed is applicable logic --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 338b8c942e..9c3cc6b252 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -7,7 +7,7 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup from rct229.schema.config import ureg from rct229.utils.assertions import getattr_ -from rct229.utils.jsonpath_utils import find_all, find_one +from rct229.utils.jsonpath_utils import find_all from rct229.utils.pint_utils import CalcQ from rct229.utils.std_comparisons import std_equal @@ -39,9 +39,11 @@ def is_applicable(self, context, data=None): elevators_list_b = find_all("$.buildings[*].elevators[*]", rmd_b) elevators_list_p = find_all("$.buildings[*].elevators[*]", rmd_p) - elevators_dict_b = find_one("$.buildings[*].elevators[*]", rmd_b) - return elevators_list_p and (elevators_dict_b is not None and elevators_list_b) + return not ( + bool(elevators_list_p) is False + or (bool(elevators_list_p) is True and bool(elevators_list_b) is False) + ) class ElevatorRule(RuleDefinitionBase): def __init__(self): From 5a10c8609ac4f4be0439611407426bffde17b7ae Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Fri, 7 Jun 2024 10:57:07 -0700 Subject: [PATCH 12/25] Updated the not applicable logic from Jiarong --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 9c3cc6b252..e9a82f7cbf 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -40,10 +40,7 @@ def is_applicable(self, context, data=None): elevators_list_b = find_all("$.buildings[*].elevators[*]", rmd_b) elevators_list_p = find_all("$.buildings[*].elevators[*]", rmd_p) - return not ( - bool(elevators_list_p) is False - or (bool(elevators_list_p) is True and bool(elevators_list_b) is False) - ) + return elevators_list_p and elevators_list_b class ElevatorRule(RuleDefinitionBase): def __init__(self): From 47c7a684b2dce50da03574b1ca8556a06b431dd6 Mon Sep 17 00:00:00 2001 From: gonz102 Date: Fri, 14 Jun 2024 11:47:21 -0400 Subject: [PATCH 13/25] Updated 16-1 ruletest to include not applicable ruletest --- .../ashrae9012019/section16/rule_16_1.json | 640 +++++++++++++++++- 1 file changed, 633 insertions(+), 7 deletions(-) diff --git a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json index 32295887d5..f8a4b89c5f 100644 --- a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json +++ b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json @@ -17,6 +17,80 @@ "schema_version": "0.0.34" }, "rmr_transformations": { + "proposed": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4 + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, "baseline": { "id": "ASHRAE229 1", "weather": { @@ -82,6 +156,7 @@ "elevators": [ { "id": "Elevator 1", + "number_of_floors_served": 4, "motor_power": 15000, "cab_counterweight": 1814.4000000000003, "cab_weight": 680.4000000000001, @@ -115,6 +190,80 @@ "schema_version": "0.0.34" }, "rmr_transformations": { + "proposed": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4 + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, "baseline": { "id": "ASHRAE229 1", "weather": { @@ -209,6 +358,80 @@ "schema_version": "0.0.34" }, "rmr_transformations": { + "proposed": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4 + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, "baseline": { "id": "ASHRAE229 1", "weather": { @@ -308,7 +531,7 @@ "schema_version": "0.0.34" }, "rmr_transformations": { - "baseline": { + "proposed": { "id": "ASHRAE229 1", "weather": { "climate_zone": "CZ4A" @@ -373,12 +596,415 @@ "elevators": [ { "id": "Elevator 1", - "number_of_floors_served": 4, - "motor_power": 20000, - "cab_counterweight": 226.80000000000004, - "cab_weight": 680.4000000000001, - "design_load": 1814.4000000000003, - "speed": 0.5079999999999999 + "number_of_floors_served": 4 + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4, + "motor_power": 20000, + "cab_counterweight": 226.80000000000004, + "cab_weight": 680.4000000000001, + "design_load": 1814.4000000000003, + "speed": 0.5079999999999999 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + }, + "rule-16-1-e": { + "Section": 16, + "Rule": 1, + "Test": "e", + "test_description": "A baseline building with 4 floors and an elevator exists but has no proposed equivalent. Expected result: NOT APPLICABLE", + "expected_rule_outcome": "not_applicable", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "proposed": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4, + "motor_power": 20000, + "cab_counterweight": 226.80000000000004, + "cab_weight": 680.4000000000001, + "design_load": 1814.4000000000003, + "speed": 0.5079999999999999 + } + ] + } + ], + "type": "BASELINE_0" + } + ] + } + } + }, + "rule-16-1-f": { + "Section": 16, + "Rule": 1, + "Test": "f", + "test_description": "A propsed building with 4 floors and an elevator exists but has no baseline elevator equivalent. Expected result: NOT APPLICABLE", + "expected_rule_outcome": "not_applicable", + "standard": { + "rule_id": "16-1", + "ruleset_reference": 0, + "rule_description": "The elevator peak motor power shall be calculated according to the equation in Table G3.1-16", + "applicable_rmr": "Baseline Model", + "rule_assertion": "=", + "comparison_value": "Expected Value", + "rule_dependency": 0, + "mandatory_rule": "Yes", + "schema_version": "0.0.34" + }, + "rmr_transformations": { + "proposed": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] + } + ], + "elevators": [ + { + "id": "Elevator 1", + "number_of_floors_served": 4 + } + ] + } + ], + "type": "PROPOSED" + } + ] + }, + "baseline": { + "id": "ASHRAE229 1", + "weather": { + "climate_zone": "CZ4A" + }, + "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": "Floor 1" + }, + { + "id": "Thermal Zone 2", + "floor_name": "Floor 2", + "spaces": [ + { + "id": "Space 2" + } + ] + }, + { + "id": "Thermal Zone 3", + "spaces": [ + { + "id": "Space 3" + } + ], + "floor_name": "Floor 3" + }, + { + "id": "Thermal Zone 4", + "spaces": [ + { + "id": "Space 4" + } + ], + "floor_name": "Floor 4" + }, + { + "id": "Thermal Zone 5", + "spaces": [ + { + "id": "Space 5" + } + ], + "floor_name": "Floor 5" + } + ] } ] } From 424a65295d4bd311b47fe30626ef367ba2cc5f18 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Tue, 18 Jun 2024 11:07:28 -0700 Subject: [PATCH 14/25] Updated motor_brake_horsepower_b unit conversion --- .../ashrae9012019/section16/section16rule1.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index e9a82f7cbf..6b0fd1d63f 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -71,7 +71,7 @@ def get_calc_vals(self, context, data=None): )["mechanical_efficiency"] # From Table G3.1 16 Elevators - # bhp = (Weight of Car + Rated Load – Counterweight) × Speed of Car / (33, 000 × h_mechanical) + # bhp = (Weight of Car + Rated Load – Counterweight) × Speed of Car / (33,000 × h_mechanical) # P_m = bhp x 746 / h_motor # Where, # Weight of Car: the proposed design elevator car weight, lb @@ -90,17 +90,18 @@ def get_calc_vals(self, context, data=None): * elevator_speed_b * ureg("ft/min") / (33000 * elevator_mechanical_efficiency_b) - ) + ).m * ureg("hp") elevator_motor_efficiency_b = ( - table_G3_9_1_lookup(motor_brake_horsepower_b)["motor_efficiency"] + table_G3_9_1_lookup(motor_brake_horsepower_b)[ + "nominal_full_load_efficiency" + ] if total_floors_served_b > 4 - else table_G3_9_3_lookup(motor_brake_horsepower_b)["motor_efficiency"] + else table_G3_9_3_lookup(motor_brake_horsepower_b)[ + "full_load_motor_efficiency_for_modeling" + ] ) expected_peak_motor_power_b = ( - motor_brake_horsepower_b.m - * ureg("hp") - * 746 - / elevator_motor_efficiency_b + motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b ) return { From 2e82d358ba1842dded96f1dfc6d492b1373b7d0c Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Thu, 20 Jun 2024 12:38:44 -0700 Subject: [PATCH 15/25] Addressed WX PR comments --- .../data_fns/table_G3_9_2_fins.py | 18 +++++++++++++----- .../data_fns/table_G3_9_2_fins_test.py | 4 ++-- .../data_fns/table_G3_9_3_fins.py | 10 ++++++---- .../ashrae9012019/section16/section16rule1.py | 7 ++++++- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py index 2c3031ad5a..ff08c7293b 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py @@ -6,6 +6,7 @@ class MechanicalEfficiency(TypedDict): mechanical_efficiency: float + motor_type: str def table_G3_9_2_lookup(number_of_stories: int) -> MechanicalEfficiency: @@ -13,22 +14,29 @@ def table_G3_9_2_lookup(number_of_stories: int) -> MechanicalEfficiency: Parameters ---------- number_of_stories: int - number of stories including basement + number of stories including basement - the value must be greater than 0. Returns ------- dict - {mechanical_efficiency - The mechanical efficiency by Table G3.9.2} + {mechanical_efficiency - The mechanical efficiency by Table G3.9.2 + motor_type - The motor type by Table G3.9.2} + Raises: + ------- + TypeError: when the number_of_stories is less or equal to 0, the function will raise this error """ number_of_stories = ( "less than or equal to 4" if number_of_stories <= 4 else "greater than 4" ) - mechanical_efficiency = find_osstd_table_entry( + ashrae_90_1_table_G3_9_2 = find_osstd_table_entry( [("number_of_stories", number_of_stories)], osstd_table=data["ashrae_90_1_table_G3_9_2"], - )["mechanical_efficiency"] + ) + + mechanical_efficiency = ashrae_90_1_table_G3_9_2["mechanical_efficiency"] + motor_type = ashrae_90_1_table_G3_9_2["motor_type"] - return {"mechanical_efficiency": mechanical_efficiency} + return {"mechanical_efficiency": mechanical_efficiency, "motor_type": motor_type} diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py index cc522cac11..4c8ec49838 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py @@ -4,10 +4,10 @@ def test__table_G3_9_lookup__4_story_building(): assert table_G3_9_2_lookup( number_of_stories=4, - ) == {"mechanical_efficiency": 0.58} + ) == {"mechanical_efficiency": 0.58, "motor_type": "Hydraulic"} def test__table_G3_9_lookup__6_story_building(): assert table_G3_9_2_lookup( number_of_stories=6, - ) == {"mechanical_efficiency": 0.64} + ) == {"mechanical_efficiency": 0.64, "motor_type": "Traction"} diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index 85412beec2..e6b0ac1ae9 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -24,13 +24,15 @@ def table_G3_9_3_lookup(shaft_input_power: Quantity) -> FullLoadMotorEfficiency: dict {full_load_motor_efficiency_for_modeling - The full load motor efficiency for modeling by Table G3.9.3} + Raises: + ------- + TypeError: when the shaft_input_power_mag is less or equal to 0, the function will raise this error """ - shaft_input_power_mag = shaft_input_power * ureg("hp") - shaft_input_power_mag = shaft_input_power_mag.magnitude + shaft_input_power_mag = shaft_input_power.to("hp").magnitude assert_( - shaft_input_power_mag >= 0, - "shaft input power is negative value, incorrect data.", + shaft_input_power_mag > 0, + "shaft input power is a negative value, incorrect data.", ) shaft_input_power = math.ceil(shaft_input_power_mag / 10) * 10 diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 6b0fd1d63f..e0add8b352 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -6,7 +6,7 @@ from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_2_fins import table_G3_9_2_lookup from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_3_fins import table_G3_9_3_lookup from rct229.schema.config import ureg -from rct229.utils.assertions import getattr_ +from rct229.utils.assertions import assert_, getattr_ from rct229.utils.jsonpath_utils import find_all from rct229.utils.pint_utils import CalcQ from rct229.utils.std_comparisons import std_equal @@ -58,6 +58,11 @@ def get_calc_vals(self, context, data=None): total_floors_served_b = getattr_( elevator_b, "elevators", "number_of_floors_served" ) + assert_( + total_floors_served_b > 1, + "The `number of floors served` value must be greater than 1.", + ) + elevator_motor_power_b = getattr_(elevator_b, "elevators", "motor_power") elevator_cab_weight_b = getattr_(elevator_b, "elevators", "cab_weight") elevator_cab_counterweight_b = getattr_( From bd6db4e246f7abbf809bc61626fcb7d4701f75a1 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Thu, 20 Jun 2024 13:22:28 -0700 Subject: [PATCH 16/25] Updated to use ashrae_90_1_table_G3_9_1.json table --- .../data_fns/table_G3_9_1_fins.py | 22 ++++++++++++------- .../data_fns/table_G3_9_1_fins_test.py | 10 ++++----- .../ashrae9012019/section16/section16rule1.py | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py index 34d9cac2b6..d8136a3bf4 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py @@ -1,6 +1,7 @@ from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.schema.config import ureg +from rct229.utils.assertions import assert_ def table_G3_9_1_lookup(shaft_input_power): @@ -17,9 +18,12 @@ def table_G3_9_1_lookup(shaft_input_power): """ - if 0 * ureg("hp") <= shaft_input_power < 1.0 * ureg("hp"): - minimum_shaft_input_power = 0.0 - elif 1.0 * ureg("hp") <= shaft_input_power < 1.5 * ureg("hp"): + assert_( + shaft_input_power >= 1.0 * ureg("hp"), + "The `shaft_input_power` must be greater or equal to 1.0 hp.", + ) + + if 1.0 * ureg("hp") <= shaft_input_power < 1.5 * ureg("hp"): minimum_shaft_input_power = 1.0 elif 1.5 * ureg("hp") <= shaft_input_power < 2.0 * ureg("hp"): minimum_shaft_input_power = 1.5 @@ -58,9 +62,11 @@ def table_G3_9_1_lookup(shaft_input_power): elif 200.0 * ureg("hp") <= shaft_input_power: minimum_shaft_input_power = 200.0 - nominal_full_load_efficiency = find_osstd_table_entry( - [("minimum_capacity", minimum_shaft_input_power)], - osstd_table=data["ashrae_90_1_prm_2019.motors"], - )["nominal_full_load_efficiency"] + full_load_motor_efficiency_for_modeling = find_osstd_table_entry( + [("shaft_input_power", minimum_shaft_input_power)], + osstd_table=data["ashrae_90_1_table_G3_9_1"], + )["full_load_motor_efficiency_for_modeling"] - return {"nominal_full_load_efficiency": nominal_full_load_efficiency} + return { + "full_load_motor_efficiency_for_modeling": full_load_motor_efficiency_for_modeling + } diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py index ee4f067665..0bca9b5149 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py @@ -2,19 +2,19 @@ from rct229.schema.config import ureg -def test__table_G3_9_lookup__1_shaft_input_power(): +def test__table_G3_9_lookup__1_2_shaft_input_power(): assert table_G3_9_1_lookup( - shaft_input_power=0.5 * ureg("hp"), - ) == {"nominal_full_load_efficiency": 0.825} + shaft_input_power=1.2 * ureg("hp"), + ) == {"full_load_motor_efficiency_for_modeling": 0.825} def test__table_G3_9_lookup__7_5_shaft_input_power(): assert table_G3_9_1_lookup( shaft_input_power=7.5 * ureg("hp"), - ) == {"nominal_full_load_efficiency": 0.895} + ) == {"full_load_motor_efficiency_for_modeling": 0.895} def test__table_G3_9_lookup__50_shaft_input_power(): assert table_G3_9_1_lookup( shaft_input_power=50.0 * ureg("hp"), - ) == {"nominal_full_load_efficiency": 0.93} + ) == {"full_load_motor_efficiency_for_modeling": 0.93} diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index e0add8b352..25a14b0acb 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -98,7 +98,7 @@ def get_calc_vals(self, context, data=None): ).m * ureg("hp") elevator_motor_efficiency_b = ( table_G3_9_1_lookup(motor_brake_horsepower_b)[ - "nominal_full_load_efficiency" + "full_load_motor_efficiency_for_modeling" ] if total_floors_served_b > 4 else table_G3_9_3_lookup(motor_brake_horsepower_b)[ From 3f85c918835a7e9655e6e7dc8239bbef17f03a46 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Thu, 20 Jun 2024 13:45:27 -0700 Subject: [PATCH 17/25] Added typehint for table_G3_9_1_lookup func --- .../ashrae9012019/data_fns/table_G3_9_1_fins.py | 11 ++++++++++- .../ashrae9012019/data_fns/table_G3_9_3_fins.py | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py index d8136a3bf4..99ad5cfa70 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py @@ -1,10 +1,19 @@ +from typing import TypedDict + +from pint import Quantity from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.schema.config import ureg from rct229.utils.assertions import assert_ -def table_G3_9_1_lookup(shaft_input_power): +class FullLoadMotorEfficiencyForModeling(TypedDict): + full_load_motor_efficiency_for_modeling: float + + +def table_G3_9_1_lookup( + shaft_input_power: Quantity, +) -> FullLoadMotorEfficiencyForModeling: """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.1 Parameters ---------- diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index e6b0ac1ae9..12e270b296 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -4,7 +4,6 @@ from pint import Quantity from rct229.rulesets.ashrae9012019.data import data from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry -from rct229.schema.config import ureg from rct229.utils.assertions import assert_ From 9506c407a98d831f42de12c4d8dd1ef32f77540a Mon Sep 17 00:00:00 2001 From: Weili Xu Date: Fri, 21 Jun 2024 11:04:37 -0700 Subject: [PATCH 18/25] update error key name --- rct229/rulesets/ashrae9012019/section19/section19rule18.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section19/section19rule18.py b/rct229/rulesets/ashrae9012019/section19/section19rule18.py index a50178d753..1b8cd13efa 100644 --- a/rct229/rulesets/ashrae9012019/section19/section19rule18.py +++ b/rct229/rulesets/ashrae9012019/section19/section19rule18.py @@ -247,10 +247,10 @@ def get_calc_vals(self, context, data=None): min_BHP_b = (0.00062 * supply_flow_b).m * ureg("hp") expected_motor_efficiency_b = table_G3_9_1_lookup(expected_BHP_b)[ - "nominal_full_load_efficiency" + "full_load_motor_efficiency_for_modeling" ] min_motor_efficiency_b = table_G3_9_1_lookup(min_BHP_b)[ - "nominal_full_load_efficiency" + "full_load_motor_efficiency_for_modeling" ] expected_fan_wattage_b = expected_BHP_b / expected_motor_efficiency_b From 96519ec1856bd2dbf634287aaf2f3ee1800f1781 Mon Sep 17 00:00:00 2001 From: Weili Xu Date: Fri, 21 Jun 2024 12:08:23 -0700 Subject: [PATCH 19/25] fix the logic in the data function --- .../data/ashrae_90_1_table_G3_9_1.json | 2 +- .../data_fns/table_G3_9_1_fins.py | 45 ++++++++++--------- .../data_fns/table_G3_9_1_fins_test.py | 2 +- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json index 19e6cae24a..079d54e9a3 100644 --- a/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json +++ b/rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json @@ -16,7 +16,7 @@ {"shaft_input_power": 60.0, "full_load_motor_efficiency_for_modeling": 0.936}, {"shaft_input_power": 75.0, "full_load_motor_efficiency_for_modeling": 0.941}, {"shaft_input_power": 100.0, "full_load_motor_efficiency_for_modeling": 0.945}, - {"shaft_input_power": 1250, "full_load_motor_efficiency_for_modeling": 0.945}, + {"shaft_input_power": 125.0, "full_load_motor_efficiency_for_modeling": 0.945}, {"shaft_input_power": 150.0, "full_load_motor_efficiency_for_modeling": 0.950}, {"shaft_input_power": 200.0, "full_load_motor_efficiency_for_modeling": 0.950} ] diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py index 99ad5cfa70..38a2ab6356 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py @@ -23,52 +23,53 @@ def table_G3_9_1_lookup( Returns ------- dict - {nominal_full_load_efficiency - The full load motor efficiency by Table G3.9.1} + {full_load_motor_efficiency_for_modeling - The full load motor efficiency by Table G3.9.1} """ assert_( - shaft_input_power >= 1.0 * ureg("hp"), - "The `shaft_input_power` must be greater or equal to 1.0 hp.", + shaft_input_power > 0.0 * ureg("hp"), + "The `shaft_input_power` must be greater than 0.0 hp.", ) + shaft_input_power_mag = shaft_input_power.magnitude - if 1.0 * ureg("hp") <= shaft_input_power < 1.5 * ureg("hp"): + if shaft_input_power_mag <= 1.0: minimum_shaft_input_power = 1.0 - elif 1.5 * ureg("hp") <= shaft_input_power < 2.0 * ureg("hp"): + elif shaft_input_power_mag <= 1.5: minimum_shaft_input_power = 1.5 - elif 2.0 * ureg("hp") <= shaft_input_power < 5.0 * ureg("hp"): + elif shaft_input_power_mag <= 2.0: minimum_shaft_input_power = 2.0 - elif 3.0 * ureg("hp") <= shaft_input_power < 7.5 * ureg("hp"): + elif shaft_input_power_mag <= 3.0: minimum_shaft_input_power = 3.0 - elif 5.0 * ureg("hp") <= shaft_input_power < 7.5 * ureg("hp"): + elif shaft_input_power_mag <= 5.0: minimum_shaft_input_power = 5.0 - elif 7.5 * ureg("hp") <= shaft_input_power < 10.0 * ureg("hp"): + elif shaft_input_power_mag <= 7.5: minimum_shaft_input_power = 7.5 - elif 10.0 * ureg("hp") <= shaft_input_power < 15.0 * ureg("hp"): + elif shaft_input_power_mag <= 10.0: minimum_shaft_input_power = 10.0 - elif 15.0 * ureg("hp") <= shaft_input_power < 20.0 * ureg("hp"): + elif shaft_input_power_mag <= 15.0: minimum_shaft_input_power = 15.0 - elif 20.0 * ureg("hp") <= shaft_input_power < 25.0 * ureg("hp"): + elif shaft_input_power_mag <= 20.0: minimum_shaft_input_power = 20.0 - elif 25.0 * ureg("hp") <= shaft_input_power < 30.0 * ureg("hp"): + elif shaft_input_power_mag <= 25.0: minimum_shaft_input_power = 25.0 - elif 30.0 * ureg("hp") <= shaft_input_power < 40.0 * ureg("hp"): + elif shaft_input_power_mag <= 30.0: minimum_shaft_input_power = 30.0 - elif 40.0 * ureg("hp") <= shaft_input_power < 50.0 * ureg("hp"): + elif shaft_input_power_mag <= 40.0: minimum_shaft_input_power = 40.0 - elif 50.0 * ureg("hp") <= shaft_input_power < 60.0 * ureg("hp"): + elif shaft_input_power_mag <= 50.0: minimum_shaft_input_power = 50.0 - elif 60.0 * ureg("hp") <= shaft_input_power < 75.0 * ureg("hp"): + elif shaft_input_power_mag <= 60.0: minimum_shaft_input_power = 60.0 - elif 75.0 * ureg("hp") <= shaft_input_power < 100.0 * ureg("hp"): + elif shaft_input_power_mag <= 75.0: minimum_shaft_input_power = 75.0 - elif 100.0 * ureg("hp") <= shaft_input_power < 125.0 * ureg("hp"): + elif shaft_input_power_mag <= 100.0: minimum_shaft_input_power = 100.0 - elif 125.0 * ureg("hp") <= shaft_input_power < 150.0 * ureg("hp"): + elif shaft_input_power_mag <= 125.0: minimum_shaft_input_power = 125.0 - elif 150.0 * ureg("hp") <= shaft_input_power < 200.0 * ureg("hp"): + elif shaft_input_power_mag <= 150.0: minimum_shaft_input_power = 150.0 - elif 200.0 * ureg("hp") <= shaft_input_power: + else: minimum_shaft_input_power = 200.0 full_load_motor_efficiency_for_modeling = find_osstd_table_entry( diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py index 0bca9b5149..b6f77fc571 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py @@ -5,7 +5,7 @@ def test__table_G3_9_lookup__1_2_shaft_input_power(): assert table_G3_9_1_lookup( shaft_input_power=1.2 * ureg("hp"), - ) == {"full_load_motor_efficiency_for_modeling": 0.825} + ) == {"full_load_motor_efficiency_for_modeling": 0.840} def test__table_G3_9_lookup__7_5_shaft_input_power(): From a50be39f1ec7726cd5ffad2985cb6b5fd2c07912 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Fri, 21 Jun 2024 13:23:57 -0700 Subject: [PATCH 20/25] Corrected the wrong parts in the rule and ruletest --- .../ashrae9012019/section16/section16rule1.py | 21 +++++++++++++------ .../ashrae9012019/section16/rule_16_1.json | 18 +++++++++------- rct229/utils/pint_utils.py | 1 + 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 25a14b0acb..15455c08f9 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -8,7 +8,7 @@ from rct229.schema.config import ureg from rct229.utils.assertions import assert_, getattr_ from rct229.utils.jsonpath_utils import find_all -from rct229.utils.pint_utils import CalcQ +from rct229.utils.pint_utils import ZERO, CalcQ from rct229.utils.std_comparisons import std_equal @@ -88,14 +88,23 @@ def get_calc_vals(self, context, data=None): # Pm: peak elevator motor power, W motor_brake_horsepower_b = ( ( - elevator_cab_weight_b * ureg("lb") - + elevator_design_load_b * ureg("lb") - - elevator_cab_counterweight_b * ureg("lb") + elevator_cab_weight_b.to("lb") + + elevator_design_load_b.to("lb") + - elevator_cab_counterweight_b.to("lb") ) - * elevator_speed_b - * ureg("ft/min") + * elevator_speed_b.to("ft/min") / (33000 * elevator_mechanical_efficiency_b) ).m * ureg("hp") + + assert_( + elevator_cab_weight_b + + elevator_design_load_b + - elevator_cab_counterweight_b + > ZERO.WEIGHT, + "Elevator cab counter weight shall be smaller than the sum of cab weight and design load. A " + "typical cab counter weight is the sum of cab weight and 40% of design load.", + ) + elevator_motor_efficiency_b = ( table_G3_9_1_lookup(motor_brake_horsepower_b)[ "full_load_motor_efficiency_for_modeling" diff --git a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json index f8a4b89c5f..9d1323a367 100644 --- a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json +++ b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json @@ -156,9 +156,8 @@ "elevators": [ { "id": "Elevator 1", - "number_of_floors_served": 4, - "motor_power": 15000, - "cab_counterweight": 1814.4000000000003, + "motor_power": 11185500.0, + "cab_counterweight": 1360.8000000000002, "cab_weight": 680.4000000000001, "design_load": 907.2000000000002, "speed": 0.5079999999999999 @@ -498,7 +497,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 24984.593950111193, + "motor_power": 18631011.708597917, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, @@ -671,7 +670,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 20000, + "motor_power": 14914000.0, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, @@ -838,7 +837,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 20000, + "motor_power": 14914000.0, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, @@ -936,7 +935,12 @@ "elevators": [ { "id": "Elevator 1", - "number_of_floors_served": 4 + "number_of_floors_served": 4, + "motor_power": 20000, + "cab_counterweight": 500, + "cab_weight": 1500, + "design_load": 4000, + "speed": 100 } ] } diff --git a/rct229/utils/pint_utils.py b/rct229/utils/pint_utils.py index 8f9f165b9b..0a247319e5 100644 --- a/rct229/utils/pint_utils.py +++ b/rct229/utils/pint_utils.py @@ -88,6 +88,7 @@ class ZERO: """Class holding zero values for various pint quantities""" LENGTH: Quantity = 0 * ureg("ft") + WEIGHT: Quantity = 0 * ureg("lb") AREA: Quantity = LENGTH * LENGTH VOLUME: Quantity = AREA * LENGTH From 951ade6ff5436818c3fdb2f3b8303ad35920b508 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Fri, 21 Jun 2024 14:34:05 -0700 Subject: [PATCH 21/25] delete 746 since it's a conversion factor hp-W --- rct229/rulesets/ashrae9012019/section16/section16rule1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 15455c08f9..063ffacb0e 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -115,7 +115,7 @@ def get_calc_vals(self, context, data=None): ] ) expected_peak_motor_power_b = ( - motor_brake_horsepower_b * 746 / elevator_motor_efficiency_b + motor_brake_horsepower_b / elevator_motor_efficiency_b ) return { From 15edff0584ff2582f22be0205311befeddb75ea3 Mon Sep 17 00:00:00 2001 From: Weili Xu Date: Fri, 21 Jun 2024 14:35:18 -0700 Subject: [PATCH 22/25] update types --- rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py | 4 ++-- rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py index 38a2ab6356..42c1ce5058 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py @@ -7,13 +7,13 @@ from rct229.utils.assertions import assert_ -class FullLoadMotorEfficiencyForModeling(TypedDict): +class FullLoadMotorEfficiency(TypedDict): full_load_motor_efficiency_for_modeling: float def table_G3_9_1_lookup( shaft_input_power: Quantity, -) -> FullLoadMotorEfficiencyForModeling: +) -> FullLoadMotorEfficiency: """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.1 Parameters ---------- diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index 12e270b296..9f203677db 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -1,16 +1,12 @@ import math -from typing import TypedDict from pint import Quantity from rct229.rulesets.ashrae9012019.data import data +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import FullLoadMotorEfficiency from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.utils.assertions import assert_ -class FullLoadMotorEfficiency(TypedDict): - full_load_motor_efficiency_for_modeling: float - - def table_G3_9_3_lookup(shaft_input_power: Quantity) -> FullLoadMotorEfficiency: """Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.2 Parameters From e44561a878da49a1ee3bea3cea01da35620acf0a Mon Sep 17 00:00:00 2001 From: gonz102 Date: Fri, 21 Jun 2024 17:38:43 -0400 Subject: [PATCH 23/25] Corrected ruletest JSON values. --- .../ruletest_jsons/ashrae9012019/section16/rule_16_1.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json index 9d1323a367..9bf0b95b37 100644 --- a/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json +++ b/rct229/ruletest_engine/ruletest_jsons/ashrae9012019/section16/rule_16_1.json @@ -156,7 +156,7 @@ "elevators": [ { "id": "Elevator 1", - "motor_power": 11185500.0, + "motor_power": 15000, "cab_counterweight": 1360.8000000000002, "cab_weight": 680.4000000000001, "design_load": 907.2000000000002, @@ -497,7 +497,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 18631011.708597917, + "motor_power": 24984.593950111193, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, @@ -670,7 +670,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 14914000.0, + "motor_power": 20000, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, @@ -837,7 +837,7 @@ { "id": "Elevator 1", "number_of_floors_served": 4, - "motor_power": 14914000.0, + "motor_power": 20000, "cab_counterweight": 226.80000000000004, "cab_weight": 680.4000000000001, "design_load": 1814.4000000000003, From d464e5099340e0eab0aa3332c8aa70bd401fa773 Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Fri, 21 Jun 2024 14:44:20 -0700 Subject: [PATCH 24/25] black formatting --- rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py index 9f203677db..3015ea225e 100644 --- a/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py +++ b/rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py @@ -2,7 +2,9 @@ from pint import Quantity from rct229.rulesets.ashrae9012019.data import data -from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import FullLoadMotorEfficiency +from rct229.rulesets.ashrae9012019.data_fns.table_G3_9_1_fins import ( + FullLoadMotorEfficiency, +) from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry from rct229.utils.assertions import assert_ From 78cfe95bbbb36bb712aa519d1479279506d64186 Mon Sep 17 00:00:00 2001 From: Weili Xu Date: Fri, 21 Jun 2024 16:00:00 -0700 Subject: [PATCH 25/25] update --- .../ashrae9012019/section16/section16rule1.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/rct229/rulesets/ashrae9012019/section16/section16rule1.py b/rct229/rulesets/ashrae9012019/section16/section16rule1.py index 063ffacb0e..daf0b2191f 100644 --- a/rct229/rulesets/ashrae9012019/section16/section16rule1.py +++ b/rct229/rulesets/ashrae9012019/section16/section16rule1.py @@ -64,20 +64,29 @@ def get_calc_vals(self, context, data=None): ) elevator_motor_power_b = getattr_(elevator_b, "elevators", "motor_power") + elevator_cab_weight_b = getattr_(elevator_b, "elevators", "cab_weight") elevator_cab_counterweight_b = getattr_( elevator_b, "elevators", "cab_counterweight" ) elevator_design_load_b = getattr_(elevator_b, "elevators", "design_load") - elevator_speed_b = getattr_(elevator_b, "elevators", "speed") + assert_( + elevator_cab_weight_b + + elevator_design_load_b + - elevator_cab_counterweight_b + > ZERO.WEIGHT, + "Elevator cab counter weight shall be smaller than the sum of cab weight and design load. A " + "typical cab counter weight is the sum of cab weight and 40% of design load.", + ) + elevator_speed_b = getattr_(elevator_b, "elevators", "speed") elevator_mechanical_efficiency_b = table_G3_9_2_lookup( total_floors_served_b )["mechanical_efficiency"] # From Table G3.1 16 Elevators - # bhp = (Weight of Car + Rated Load – Counterweight) × Speed of Car / (33,000 × h_mechanical) - # P_m = bhp x 746 / h_motor + # bhp (hp) = (Weight of Car + Rated Load – Counterweight) × Speed of Car / (33,000 × h_mechanical) + # P_m (W) = bhp x 746 / h_motor # Where, # Weight of Car: the proposed design elevator car weight, lb # Rated Load: the proposed design elevator load at which to operate, lb @@ -96,15 +105,6 @@ def get_calc_vals(self, context, data=None): / (33000 * elevator_mechanical_efficiency_b) ).m * ureg("hp") - assert_( - elevator_cab_weight_b - + elevator_design_load_b - - elevator_cab_counterweight_b - > ZERO.WEIGHT, - "Elevator cab counter weight shall be smaller than the sum of cab weight and design load. A " - "typical cab counter weight is the sum of cab weight and 40% of design load.", - ) - elevator_motor_efficiency_b = ( table_G3_9_1_lookup(motor_brake_horsepower_b)[ "full_load_motor_efficiency_for_modeling"