Skip to content

Commit

Permalink
Merge pull request #1346 from pnnl/RS/YJ/Rule_16-1
Browse files Browse the repository at this point in the history
RS/YJ/Rule 16-1
  • Loading branch information
weilixu authored Jun 21, 2024
2 parents 4a9c322 + 78cfe95 commit 853e161
Show file tree
Hide file tree
Showing 15 changed files with 1,379 additions and 39 deletions.
6 changes: 3 additions & 3 deletions docs/section16/Rule16-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:`
Expand All @@ -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`

Expand Down
23 changes: 23 additions & 0 deletions rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_1.json
Original file line number Diff line number Diff line change
@@ -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": 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}
]
}
14 changes: 14 additions & 0 deletions rct229/rulesets/ashrae9012019/data/ashrae_90_1_table_G3_9_2.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Original file line number Diff line number Diff line change
@@ -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}
]
}
72 changes: 44 additions & 28 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins.py
Original file line number Diff line number Diff line change
@@ -1,9 +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_


class FullLoadMotorEfficiency(TypedDict):
full_load_motor_efficiency_for_modeling: float

def table_G3_9_1_lookup(shaft_input_power):

def table_G3_9_1_lookup(
shaft_input_power: Quantity,
) -> FullLoadMotorEfficiency:
"""Returns the full-load motor efficiency for motors as required by ASHRAE 90.1 Table G3.9.1
Parameters
----------
Expand All @@ -13,54 +23,60 @@ def table_G3_9_1_lookup(shaft_input_power):
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}
"""

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 > 0.0 * ureg("hp"),
"The `shaft_input_power` must be greater than 0.0 hp.",
)
shaft_input_power_mag = shaft_input_power.magnitude

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

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
}
10 changes: 5 additions & 5 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_1_fins_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.840}


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}
42 changes: 42 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing import TypedDict

from rct229.rulesets.ashrae9012019.data import data
from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entry


class MechanicalEfficiency(TypedDict):
mechanical_efficiency: float
motor_type: str


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
----------
number_of_stories: int
number of stories including basement - the value must be greater than 0.
Returns
-------
dict
{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"
)

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 = 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, "motor_type": motor_type}
13 changes: 13 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_2_fins_test.py
Original file line number Diff line number Diff line change
@@ -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, "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, "motor_type": "Traction"}
46 changes: 46 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import math

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_


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
----------
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}
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.to("hp").magnitude
assert_(
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

if shaft_input_power > 40:
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
}
20 changes: 20 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_G3_9_3_fins_test.py
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion rct229/rulesets/ashrae9012019/section16/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Add all available rule modules in __all__
__all__ = [
# "section16rule1",
"section16rule1",
"section16rule2",
"section16rule3",
"section16rule4",
Expand Down
Loading

0 comments on commit 853e161

Please sign in to comment.