Skip to content

Commit

Permalink
Merge pull request #1432 from pnnl/RS/JDJ/rule19-18-bug-fix
Browse files Browse the repository at this point in the history
RS/JDJ/Rule19-18 bug fix
  • Loading branch information
weilixu authored Aug 8, 2024
2 parents 81fb2c2 + c473462 commit a2b86e6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions rct229/rulesets/ashrae9012019/section19/section19rule18.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
get_fan_system_object_supply_return_exhaust_relief_total_power_flow,
)
from rct229.schema.config import ureg
from rct229.schema.schema_enums import SchemaEnums
from rct229.utils.assertions import getattr_
from rct229.utils.jsonpath_utils import find_all, find_one
from rct229.utils.pint_utils import ZERO
from rct229.utils.std_comparisons import std_equal

ENERGY_RECOVERY = SchemaEnums.schema_enums["EnergyRecoveryOptions"]
APPLICABLE_SYS_TYPES = [
HVAC_SYS.SYS_3,
HVAC_SYS.SYS_4,
Expand Down Expand Up @@ -172,9 +174,7 @@ def get_calc_vals(self, context, data=None):
)
supply_flow_b = fan_sys_info_b["supply_fans_airflow"].to(ureg.cfm)

more_than_one_supply_fan_b = (
fan_sys_info_b["supply_fans_qty"] != 1
) # the reason why > 1 isn't used is to prevent an error when no supply fan exists
exactly_one_supply_fan = fan_sys_info_b["supply_fans_qty"] == 1
total_fan_power_b = (
(
fan_sys_info_b["supply_fans_power"]
Expand All @@ -183,15 +183,16 @@ def get_calc_vals(self, context, data=None):
+ fan_sys_info_b["relief_fans_power"]
+ zonal_exhaust_fan_elec_power_b
)
if not more_than_one_supply_fan_b
if exactly_one_supply_fan
else ZERO.POWER
).to(ureg.hp)

A = 0.0
more_than_one_exhaust_fan_and_energy_rec_is_relevant_b = False
if (
fan_sys_b.get("air_energy_recovery")
and fan_sys_info_b["exhaust_fans_qty"] == 1
and fan_sys_b["air_energy_recovery"].get("type") != ENERGY_RECOVERY.NONE
and fan_sys_info_b["exhaust_fans_qty"] > 1
):
more_than_one_exhaust_fan_and_energy_rec_is_relevant_b = True
enthalpy_reco_ratio_b = getattr_(
Expand Down Expand Up @@ -257,23 +258,23 @@ def get_calc_vals(self, context, data=None):
min_fan_wattage_b = min_BHP_b / min_motor_efficiency_b

return {
"more_than_one_supply_fan_b": more_than_one_supply_fan_b,
"exactly_one_supply_fan": exactly_one_supply_fan,
"more_than_one_exhaust_fan_and_energy_rec_is_relevant_b": more_than_one_exhaust_fan_and_energy_rec_is_relevant_b,
"total_fan_power_b": total_fan_power_b,
"expected_fan_wattage_b": expected_fan_wattage_b,
"min_fan_wattage_b": min_fan_wattage_b,
}

def manual_check_required(self, context, calc_vals=None, data=None):
more_than_one_supply_fan_b = calc_vals["more_than_one_supply_fan_b"]
exactly_one_supply_fan = calc_vals["exactly_one_supply_fan"]
more_than_one_exhaust_fan_and_energy_rec_is_relevant_b = calc_vals[
"more_than_one_exhaust_fan_and_energy_rec_is_relevant_b"
]
total_fan_power_b = calc_vals["total_fan_power_b"]
expected_fan_wattage_b = calc_vals["expected_fan_wattage_b"]

return (
more_than_one_supply_fan_b
not exactly_one_supply_fan
or more_than_one_exhaust_fan_and_energy_rec_is_relevant_b
or (
not std_equal(total_fan_power_b, expected_fan_wattage_b)
Expand All @@ -288,7 +289,7 @@ def get_manual_check_required_msg(self, context, calc_vals=None, data=None):
more_than_one_exhaust_fan_and_energy_rec_is_relevant_b = calc_vals[
"more_than_one_exhaust_fan_and_energy_rec_is_relevant_b"
]
more_than_one_supply_fan_b = calc_vals["more_than_one_supply_fan_b"]
exactly_one_supply_fan = calc_vals["exactly_one_supply_fan"]
expected_fan_wattage_b = calc_vals["expected_fan_wattage_b"]

black_word = (
Expand All @@ -299,7 +300,7 @@ def get_manual_check_required_msg(self, context, calc_vals=None, data=None):

undetermined_msg = ""
if (
more_than_one_supply_fan_b
not exactly_one_supply_fan
or more_than_one_exhaust_fan_and_energy_rec_is_relevant_b
):
undetermined_msg = (
Expand Down

0 comments on commit a2b86e6

Please sign in to comment.