From 60c65864b854f0eabdafae0c82e2ab2c102ac9aa Mon Sep 17 00:00:00 2001 From: "Xu, Weili" Date: Mon, 6 Jan 2025 13:24:01 -0800 Subject: [PATCH 1/5] bug fix, changes on ids, make sure reporting work --- rct229/cli.py | 2 +- .../get_building_segment_swh_bat.py | 3 +++ .../ruleset_functions/get_swh_bats_and_swh_use.py | 3 +++ ...swh_components_associated_with_each_swh_bat.py | 3 +++ .../ashrae9012019/section11/section11rule17.py | 2 +- .../ashrae9012019/section11/section11rule9.py | 15 ++++++++------- .../ashrae9012019/section12/section12rule2.py | 3 ++- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/rct229/cli.py b/rct229/cli.py index 958cdc38e4..c7c0201930 100644 --- a/rct229/cli.py +++ b/rct229/cli.py @@ -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/" ) diff --git a/rct229/rulesets/ashrae9012019/ruleset_functions/get_building_segment_swh_bat.py b/rct229/rulesets/ashrae9012019/ruleset_functions/get_building_segment_swh_bat.py index 935c01d6ec..0e99c8fe1f 100644 --- a/rct229/rulesets/ashrae9012019/ruleset_functions/get_building_segment_swh_bat.py +++ b/rct229/rulesets/ashrae9012019/ruleset_functions/get_building_segment_swh_bat.py @@ -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 ---------- diff --git a/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_bats_and_swh_use.py b/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_bats_and_swh_use.py index a6d59d9ee7..56a86b87de 100644 --- a/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_bats_and_swh_use.py +++ b/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_bats_and_swh_use.py @@ -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 diff --git a/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_components_associated_with_each_swh_bat.py b/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_components_associated_with_each_swh_bat.py index 296c8f9285..79b3eb6a6e 100644 --- a/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_components_associated_with_each_swh_bat.py +++ b/rct229/rulesets/ashrae9012019/ruleset_functions/get_swh_components_associated_with_each_swh_bat.py @@ -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 ) diff --git a/rct229/rulesets/ashrae9012019/section11/section11rule17.py b/rct229/rulesets/ashrae9012019/section11/section11rule17.py index 387b59d643..198e146a46 100644 --- a/rct229/rulesets/ashrae9012019/section11/section11rule17.py +++ b/rct229/rulesets/ashrae9012019/section11/section11rule17.py @@ -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)", diff --git a/rct229/rulesets/ashrae9012019/section11/section11rule9.py b/rct229/rulesets/ashrae9012019/section11/section11rule9.py index 75b5159e5b..7bc3ffd092 100644 --- a/rct229/rulesets/ashrae9012019/section11/section11rule9.py +++ b/rct229/rulesets/ashrae9012019/section11/section11rule9.py @@ -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( @@ -85,7 +86,7 @@ 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" ] @@ -93,21 +94,21 @@ def applicability_check(self, context, calc_vals, data): 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 ) diff --git a/rct229/rulesets/ashrae9012019/section12/section12rule2.py b/rct229/rulesets/ashrae9012019/section12/section12rule2.py index 3527ef1c0b..5a3d296bfe 100644 --- a/rct229/rulesets/ashrae9012019/section12/section12rule2.py +++ b/rct229/rulesets/ashrae9012019/section12/section12rule2.py @@ -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, From 69bcfae6e88f11c3f7d5045f820779532f2eac9e Mon Sep 17 00:00:00 2001 From: "Xu, Weili" Date: Mon, 6 Jan 2025 13:34:01 -0800 Subject: [PATCH 2/5] update summary report --- .../ashrae9012019/ashrae901_2019_summary_report.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rct229/reports/ashrae9012019/ashrae901_2019_summary_report.py b/rct229/reports/ashrae9012019/ashrae901_2019_summary_report.py index 9c1b3d465a..7ca086e224 100644 --- a/rct229/reports/ashrae9012019/ashrae901_2019_summary_report.py +++ b/rct229/reports/ashrae9012019/ashrae901_2019_summary_report.py @@ -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", @@ -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", @@ -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 From c07020a5493b867814e7bf8e0772d0b8a0be0d1b Mon Sep 17 00:00:00 2001 From: "Xu, Weili" Date: Mon, 6 Jan 2025 14:02:36 -0800 Subject: [PATCH 3/5] trigger rerun action --- rct229/ruletest_engine/run_ruletests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rct229/ruletest_engine/run_ruletests.py b/rct229/ruletest_engine/run_ruletests.py index ba1f6ce87a..0aae429d6e 100644 --- a/rct229/ruletest_engine/run_ruletests.py +++ b/rct229/ruletest_engine/run_ruletests.py @@ -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']) From 7b418d0bdc8ad4c372058460fd0dab6514e3c5b6 Mon Sep 17 00:00:00 2001 From: "Xu, Weili" Date: Mon, 6 Jan 2025 14:10:23 -0800 Subject: [PATCH 4/5] fix poetry version --- .github/workflows/python-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 52e783da33..333c846d73 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -32,6 +32,7 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 with: + poetry-version: 1.8.4 virtualenvs-create: true virtualenvs-in-project: true installer-parallel: true From 013df342a2064d40f639b9bd7920c1d7f8dfa95f Mon Sep 17 00:00:00 2001 From: "Xu, Weili" Date: Mon, 6 Jan 2025 14:13:46 -0800 Subject: [PATCH 5/5] correct the syntax --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 333c846d73..2f74c97eff 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -32,7 +32,7 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 with: - poetry-version: 1.8.4 + version: 1.8.4 virtualenvs-create: true virtualenvs-in-project: true installer-parallel: true