Skip to content

Commit

Permalink
lookup assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonJ-KC committed Dec 20, 2024
1 parent 3cf0b8e commit 73f7d58
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_7_8_fns.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rct229.schema.config import ureg
from rct229.rulesets.ashrae9012019.data import data
from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entries
from rct229.utils.assertions import assert_


def table_7_8_lookup(
Expand Down Expand Up @@ -35,6 +36,17 @@ def table_7_8_lookup(
]
"""
# Validate equipment type
valid_equipment_types = [
"Electric storage water heater",
"Gas storage water heater"
]
assert_(equipment_type in valid_equipment_types, f"Invalid equipment type. Must be one of {valid_equipment_types}")

# Validate draw pattern
valid_draw_patterns = ["", "Very Small", "Low", "Medium", "High"]
assert_(draw_pattern in valid_draw_patterns, f"Invalid draw pattern. Must be one of {valid_draw_patterns}")

# Filter entries by capacity thresholds
capacity_matched = find_capacity_matched_entries(
input_power, data["ashrae_90_1_table_7_8"]
Expand Down
12 changes: 12 additions & 0 deletions rct229/rulesets/ashrae9012019/data_fns/table_F_2_fns.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rct229.schema.config import ureg
from rct229.rulesets.ashrae9012019.data import data
from rct229.rulesets.ashrae9012019.data_fns.table_utils import find_osstd_table_entries
from rct229.utils.assertions import assert_


def table_f_2_lookup(
Expand Down Expand Up @@ -35,6 +36,17 @@ def table_f_2_lookup(
]
"""
# Validate equipment type
valid_equipment_types = [
"Electric storage water heater",
"Gas storage water heater"
]
assert_(equipment_type in valid_equipment_types, f"Invalid equipment type. Must be one of {valid_equipment_types}")

# Validate draw pattern
valid_draw_patterns = ["Very Small", "Low", "Medium", "High"]
assert_(draw_pattern in valid_draw_patterns, f"Invalid draw pattern. Must be one of {valid_draw_patterns}")

# Filter entries by capacity thresholds
capacity_matched = find_capacity_matched_entries(
storage_capacity, data["ashrae_90_1_table_F_2"]
Expand Down

0 comments on commit 73f7d58

Please sign in to comment.