Skip to content

Commit

Permalink
Merge pull request #1594 from pnnl/bugfix_report_error_fix
Browse files Browse the repository at this point in the history
Bugfix report error fix
  • Loading branch information
weilixu authored Jan 6, 2025
2 parents 2d44125 + 013df34 commit c4f2d81
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
2 changes: 1 addition & 1 deletion rct229/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run_test(ruleset, section=None):
@cli.command("evaluate", short_help=short_help_text, help=help_text, hidden=True)
@click.option("--rpds", "-f", multiple=True, default=[])
@click.option("--ruleset", "-rs", multiple=False, default="ashrae9012019")
@click.option("--reports", "-r", multiple=True, default=["RAW_OUTPUT"])
@click.option("--reports", "-r", multiple=True, default=["EngineRawSummary"])
@click.option(
"--reports_directory", "-rd", multiple=False, default="./examples/output/"
)
Expand Down
10 changes: 7 additions & 3 deletions rct229/reports/ashrae9012019/ashrae901_2019_summary_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def initialize_ruleset_report(self, rule_outcome=None):
"Envelope",
"Lighting",
"HVAC General",
"Service Hot Water",
"Receptacles",
"Transformers",
"Elevator",
"HVAC-Baseline",
"HVAC-General",
"HVAC-HotWaterSide",
Expand All @@ -35,8 +37,10 @@ def initialize_ruleset_report(self, rule_outcome=None):
"5": "Envelope",
"6": "Lighting",
"10": "HVAC General",
"11": "Service Hot Water",
"12": "Receptacles",
"15": "Transformers",
"16": "Elevator",
"18": "HVAC-Baseline",
"19": "HVAC-General",
"21": "HVAC-HotWaterSide",
Expand Down Expand Up @@ -81,13 +85,13 @@ def initialize_ruleset_report(self, rule_outcome=None):
- user: {user_match["file_name"] if user_match else "N/A"}
- proposed: {proposed_match["file_name"] if proposed_match else "N/A"}
- baseline_0: {baseline_0_match["file_name"] if baseline_0_match else "N/A"}
- baseline_90: {baseline_90_match["file_name"] if baseline_90_match else ""}
- baseline_90: {baseline_90_match["file_name"] if baseline_90_match else "N/A"}
- baseline_180: {baseline_180_match["file_name"] if baseline_180_match else "N/A"}
- baseline_270: {baseline_270_match["file_name"] if baseline_270_match else "N/A"}
### Summary: All Primary Rules
| | All | Performance Calculations | Schedules Setpoints | Envelope | Lighting | HVAC General | Receptacles | Transformers | HVAC-HotWaterSide | HVAC - ChilledWaterSide | HVAC-AirSide | HVAC-General| HVAC-Baseline
|:----------------------------:|:---:|:--------:|:--------:|:--------:|:--------:|:-----------:|:------------:|:------------:|:--------------:|:--------------:|:--------------:|:--------------:|:-----------:|
| | All | Performance Calculations | Schedules Setpoints | Envelope | Lighting | HVAC General | Service Hot Water | Receptacles | Transformers | Elevator | HVAC-HotWaterSide | HVAC - ChilledWaterSide | HVAC-AirSide | HVAC-General| HVAC-Baseline
|:----------------------------:|:---:|:--------:|:--------:|:--------:|:--------:|:-----------:|:------------:|:------------:|:--------------:|:--------------:|:--------------:|:--------------:|:--------------:|:--------------:|:-----------:|
Replace-Rules
Replace-Pass
Replace-Fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def get_building_segment_swh_bat(
) -> str:
"""
This function determines the SWH BAT for the given building segment.
Returns None if there is no service water heating uses and no service_water_heating_building_area_type under building segment,
UNDETERMINED if there are service water heating uses but no service_water_heating_building_area_type under building segment,
A bat type if there is service_water_heating_building_area_type under building segment
Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def get_swh_bats_and_swh_use(rmd: dict) -> dict:
for building_segment in find_all("$.buildings[*].building_segments[*]", rmd):
bldg_seg_id = building_segment["id"]
swh_bat = get_building_segment_swh_bat(rmd, bldg_seg_id)
if swh_bat is None:
# This means there is no service water uses and no types at building segments
swh_bat = "UNDETERMINED"
swh_and_swh_use_dict.setdefault(swh_bat, [])

# TODO: Moving the `service_water_heating_uses` key to the `building_segments` level is being discussed. If the `service_water_heating_uses` key is moved, this function needs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def get_swh_components_associated_with_each_swh_bat(
swh_and_equip_dict = {}
for building_segment in find_all("$.buildings[*].building_segments[*]", rmd):
swh_bat = get_building_segment_swh_bat(rmd, building_segment["id"])
if swh_bat is None:
# if returns None, it means there is no swh system in the RPD.
swh_bat = "UNDETERMINED"
swh_and_equip_dict[swh_bat] = SWHEquipmentAssociations(
energy_required=ZERO.ENERGY
)
Expand Down
2 changes: 1 addition & 1 deletion rct229/rulesets/ashrae9012019/section11/section11rule17.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):
),
each_rule=Section11Rule17.RMDRule(),
index_rmd=PROPOSED,
id="11-6",
id="11-17",
description="All buildings that will have service water heating loads must include those loads in the simulation.",
ruleset_section_title="Service Water Heating",
standard_section="Table G3.1 #1, proposed column, (a)",
Expand Down
15 changes: 8 additions & 7 deletions rct229/rulesets/ashrae9012019/section11/section11rule9.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def create_context_list(self, context, data=None):
building_area_type_and_uses = {}
for (
bat_type,
SWH_use_id,
SWH_use_ids,
) in shw_bat_uses_dict_b.items():
building_area_type_and_uses[bat_type] = {}
building_area_type_and_uses[bat_type]["id"] = SWH_use_id
building_area_type_and_uses[bat_type]["id"] = bat_type
building_area_type_and_uses[bat_type]["swh_use_ids"] = SWH_use_ids

return [
produce_ruleset_model_description(
Expand All @@ -85,29 +86,29 @@ def __init__(self):
)

def applicability_check(self, context, calc_vals, data):
swh_BAT_id_list_b = context.BASELINE_0["id"]
swh_bat_id_list_b = context.BASELINE_0["swh_use_ids"]
service_water_heating_uses_dict_b = data[
"service_water_heating_uses_dict_b"
]

return all(
[
True
if service_water_heating_uses_dict_b[swh_bat_id] > 0.0
if service_water_heating_uses_dict_b[swh_use_id] > 0.0
else False
for swh_bat_id in swh_BAT_id_list_b
for swh_use_id in swh_bat_id_list_b
]
)

def get_manual_check_required_msg(self, context, calc_vals=None, data=None):
swh_BAT_id_list_b = context.BASELINE_0["id"]
swh_bat_id_list_b = context.BASELINE_0["swh_use_ids"]
service_water_heating_uses_dict_b = data[
"service_water_heating_uses_dict_b"
]

swh_bat = ", ".join(
swh_bat_id
for swh_bat_id in swh_BAT_id_list_b
for swh_bat_id in swh_bat_id_list_b
if service_water_heating_uses_dict_b[swh_bat_id] > 0.0
)

Expand Down
3 changes: 2 additions & 1 deletion rct229/rulesets/ashrae9012019/section12/section12rule2.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def get_calc_vals(self, context, data=None):
is_leap_year,
)
return {
"mis_equip_schedule_b_dict": mis_equip_schedule_b_dict,
# No need to report full schedule values.
# "mis_equip_schedule_b_dict": mis_equip_schedule_b_dict,
"space_type_b": space_type_b,
"auto_receptacle_control_b": auto_receptacle_control_b,
"auto_receptacle_control_p": auto_receptacle_control_p,
Expand Down
2 changes: 1 addition & 1 deletion rct229/ruletest_engine/run_ruletests.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def run_test_one_jsontest(test_json):
# run_service_water_heater_tests()


# run_test_one_jsontest("ashrae9012019/section16/rule_16_7.json")
# run_test_one_jsontest("ashrae9012019/section11/rule_11_7.json")
# run_ashrae9012019_tests()
# output_dir = os.path.dirname(__file__)
# generate_ashrae9012019_software_test_report(['tester'])
Expand Down

0 comments on commit c4f2d81

Please sign in to comment.