Skip to content

Commit

Permalink
Made MONTH_FRACTIONS and DAYS_IN_MONTH global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjoonjung-PNNL committed Aug 1, 2024
1 parent 78262a7 commit a61da3e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
1 change: 1 addition & 0 deletions rct229/rulesets/ashrae9012019/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"section5",
"section6",
"section10",
"section12",
"section16",
"section18",
"section19",
Expand Down
60 changes: 32 additions & 28 deletions rct229/rulesets/ashrae9012019/section12/section12rule4.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@

MISCELLANEOUS_EQUIPMENT = SchemaEnums.schema_enums["MiscellaneousEquipmentOptions"]

MONTH_FRACTIONS = {
1: 0.25,
2: 0.5,
3: 0.75,
4: 1,
5: 0.25,
6: 0.5,
7: 0.75,
8: 1,
9: 0.25,
10: 0.5,
11: 0.75,
12: 1,
}
DAYS_IN_MONTH = {
1: 31,
2: 28, # If leap year, this will be replaced with 29
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
11: 30,
12: 31,
}


class Section12Rule4(RuleDefinitionListIndexedBase):
"""Rule 4 of ASHRAE 90.1-2019 Appendix G Section 12 (Receptacle)"""
Expand Down Expand Up @@ -77,34 +106,9 @@ def get_calc_vals(self, context, data=None):
misc_equip_b = context.BASELINE_0

is_leap_year = data["is_leap_year"]
MONTH_FRACTIONS = {
1: 0.25,
2: 0.5,
3: 0.75,
4: 1,
5: 0.25,
6: 0.5,
7: 0.75,
8: 1,
9: 0.25,
10: 0.5,
11: 0.75,
12: 1,
}
DAYS_IN_MONTH = {
1: 31,
2: 29 if is_leap_year else 28,
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
11: 30,
12: 31,
}

if is_leap_year:
DAYS_IN_MONTH[2] = 29

multiplier_schedule_b = getattr_(
misc_equip_b, "misc_equip", "multiplier_schedule", "hourly_values"
Expand Down

0 comments on commit a61da3e

Please sign in to comment.