Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RS/YJ/Rule 11-17 #1546

Draft
wants to merge 29 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d5cb73e
Initial commit
yunjoonjung-PNNL Aug 13, 2024
3a52cab
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
yunjoonjung-PNNL Aug 14, 2024
6173f28
Updated ashrae229 schema and json pointer enumerations to get things …
Sep 11, 2024
ce9e82b
First cut at rule test 11-6
Sep 11, 2024
05909ea
Update ASHRAE229.schema.json
jugonzal07 Sep 12, 2024
3cf0ef4
Added service weater heating uses to enumerations and made adjustment…
Sep 12, 2024
962ee32
Merge branch 'RT/JG/ruletest_11_master' into RT/JG/ruletest_11_6
Sep 12, 2024
35fc2ef
minor typo correction.
Sep 12, 2024
36b1f34
Merge branch 'RT/JG/ruletest_11_master' into RT/JG/ruletest_11_6
Sep 12, 2024
d0132a8
Addressed issue where SHW distributions were not referenced by any sp…
Sep 12, 2024
c29b727
Flipped pass and fail cases for 11-6 ruletest
Sep 18, 2024
b4277b1
Updated section 11-6
yunjoonjung-PNNL Oct 14, 2024
3d6f51a
Merge branch 'RT/JG/ruletest_11_6' of https://github.com/pnnl/ruleset…
yunjoonjung-PNNL Oct 14, 2024
0ae6b04
Updated RDS
yunjoonjung-PNNL Oct 14, 2024
6385306
updated json_pointer_enumerations for service_water_heating_equipment
Oct 15, 2024
0f2102c
Fixed the func
yunjoonjung-PNNL Oct 15, 2024
67c57df
Updated the func pytest
yunjoonjung-PNNL Oct 15, 2024
5da0d81
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
yunjoonjung-PNNL Oct 18, 2024
af1951c
Merge branch 'RCT/YJ/get_building_segment_swh_bat' of https://github.…
yunjoonjung-PNNL Oct 18, 2024
492114a
Finished func dev
yunjoonjung-PNNL Oct 18, 2024
3cb7e35
Merge branch 'RS/YJ/Rule_11-6_Re' of https://github.com/pnnl/ruleset-…
yunjoonjung-PNNL Oct 21, 2024
67f9fda
Merge branch 'RCT/YJ/get_building_segment_swh_bat' of https://github.…
yunjoonjung-PNNL Oct 21, 2024
fa35da3
Merge branch 'RCT/YJ/get_SWH_bats_and_SWH_use' of https://github.com/…
yunjoonjung-PNNL Oct 21, 2024
97d1f98
Finished 11-17 dev
yunjoonjung-PNNL Oct 21, 2024
b3be13e
isort
yunjoonjung-PNNL Oct 21, 2024
fdf668c
First cut at ruletest 11-17
Nov 8, 2024
4be7afe
Merge branch 'develop' of https://github.com/pnnl/ruleset-checking-to…
yunjoonjung-PNNL Nov 20, 2024
ad8fac9
Merge branch 'RT/JG/ruletest_11_17' of https://github.com/pnnl/rulese…
yunjoonjung-PNNL Nov 20, 2024
0f4bf31
Tested 11-17
yunjoonjung-PNNL Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/ruleset_functions/get_SWH_bats_and_SWH_use.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## get_SWH_bats_and_SWH_use

Description: This function gets all the SWH Uses and the SWH space types and sorts them into a dictionary where the keys are the ServiceWaterHeatingBuildingAreaOptions2019ASHRAE901 and values are a list if ServiceWaterHeatingUse.ids
Description: This function gets all the SWH Uses and the SWH space types and sorts them into a dictionary where the keys are the ServiceWaterHeatingBuildingAreaOptions2019ASHRAE901 and values are a list of ServiceWaterHeatingUse.ids

Inputs:
- **RMD**
Expand All @@ -17,11 +17,10 @@ Function Call:
Logic:
- create a blank dictionary: `swh_and_SWH_use_dict = {}`
- look at each building segment: `for building_segment in RMD.building_segments:`
- get the swh_bat by using the function: get_building_segment_SWH_bat: `swh_bat = get_building_segment_SWH_bat(RMD,building_segment)`
- add this bat to swh_and_SWH_use_dict if it doesnt exist yet: `swh_and_SWH_use_dict.set_default(swh_bat,[])`
- get the service water heating uses in the building segment `service_water_heating_use_ids = get_SWH_uses_associated_with_each_building_segment(P_RMD, building_segment.id)`
- add all of the swh_use ids in the building segment to the list: `for swh_use in building_segment.service_water_heating_uses:`
- append the id of the swh_use to the list: `swh_and_SWH_use_dict[swh_bat].append(swh_use.id)`
- get the swh_bat by using the function: get_building_segment_SWH_bat: `swh_bat = get_building_segment_SWH_bat(RMD,building_segment["id"])`
- add this bat to swh_and_SWH_use_dict if it doesnt exist yet: `swh_and_SWH_use_dict.setdefault(swh_bat,[])`
- get the service water heating use ids in the building segment `service_water_heating_use_ids = get_SWH_uses_associated_with_each_building_segment(RMD, building_segment.id)`
- add all of the swh_use ids in the building segment to the list: `service_water_heating_use_ids[swh_bat].extend(service_water_heating_use_ids) `

**Returns** swh_and_SWH_use_dict

Expand Down
35 changes: 14 additions & 21 deletions docs/section11/Rule11-17.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,21 @@
- **get_SWH_uses_associated_with_each_building_segment**
- **get_component_by_id**

## Applicability Checks:

- look at each building in the proposed RMD: `for building in P_RMD:`
- look at each building segment: `for building_segment in building:`
- we want to look at all building segments, so continue directly to the rule logic: `CONTINUE TO RULE LOGIC`

## Rule Logic:
- get the building segment service water heating building area type: `swh_bat = get_building_segment_SWH_bat(P_RMD,building_segment)`
- check if the building segment has service water heating loads. First create a boolean has_swh_loads and set it to false: `has_swh_loads = false`
- get the service water heating uses in the building segment `service_water_heating_use_ids = get_SWH_uses_associated_with_each_building_segment(P_RMD, building_segment.id)`
- look at each service water heating use id: `for swh_use_id in service_water_heating_use_ids:`
- get the swh_use using get_component_by_ID: `swh_use = get_component_by_ID(P_RMD, swh_use_id)`
- check to see if the use has SWH loads: `if swh_use.use > 0:`
- set has_swh_loads to TRUE and break out of the loop: `has_swh_loads = TRUE; break;`



## Rule Assertion:
- if the building segment has SWH loads, PASS: `if has_swh_loads: PASS`
- if the BAT is UNDETERMINED, then rule outcome is UNDETERMINED and provide a note: `elif swh_bat == 'UNDETERMINED': UNDETERMINED; note = "No SWH loads were simulated. The SWH Building Area type is UNDETERMINED, so this rule cannot assess whether building type is likely to have SWH loads. Recommend manual check to determine if SWH loads should have been simulated based on whether the building will have SWH loads."`
- otherwise, check if the BAT is one of OTHER, WAREHOUSE or PARKING_GARAGE, rule outcome is UNDETERMINED: `elif: swh_bat in ['OTHER', 'WAREHOUSE', 'PARKING_GARAGE']: UNDETERMINED; note = "There are no service water heating loads simulated in this building segment. SWH Building Area type is " + swh_bat + ". Confirm that there will be no service water heating loads in this building segment."`
- otherwise, all other cases fail: `else: FAIL; note = "There were no service water heating loads simulated in this building segment. Service water heating loads are expected for Building Area Type: " + swh_bat`
## Rule Logic:
- get the building segment service water heating building area type: `swh_bat = get_building_segment_SWH_bat(P_RMD,building_segment)`
- check if the building segment has service water heating loads. First create a boolean has_swh_loads and set it to false: `has_swh_loads = false`
- get the service water heating uses in the building segment `service_water_heating_use_ids = get_SWH_uses_associated_with_each_building_segment(P_RMD, building_segment.id)`
- look at each service water heating use id: `for swh_use_id in service_water_heating_use_ids:`
- get the swh_use using get_component_by_ID: `swh_use = get_component_by_ID(P_RMD, swh_use_id)`
- check to see if the use has SWH loads: `if swh_use.use > 0:`
- set has_swh_loads to TRUE and break out of the loop: `has_swh_loads = TRUE; break;`

## Rule Assertion:
- if the building segment has SWH loads, PASS: `if has_swh_loads: PASS`
- if the BAT is UNDETERMINED, then rule outcome is UNDETERMINED and provide a note: `elif swh_bat == 'UNDETERMINED': UNDETERMINED; note = "No SWH loads were simulated. The SWH Building Area type is UNDETERMINED, so this rule cannot assess whether building type is likely to have SWH loads. Recommend manual check to determine if SWH loads should have been simulated based on whether the building will have SWH loads."`
- otherwise, check if the BAT is one of ALL_OTHERS, WAREHOUSE or PARKING_GARAGE, rule outcome is UNDETERMINED: `elif: swh_bat in ['ALL_OTHERS', 'WAREHOUSE', 'PARKING_GARAGE']: UNDETERMINED; note = "There are no service water heating loads simulated in this building segment. SWH Building Area type is " + swh_bat + ". Confirm that there will be no service water heating loads in this building segment."`
- otherwise, all other cases fail: `else: FAIL; note = "There were no service water heating loads simulated in this building segment. Service water heating loads are expected for Building Area Type: " + swh_bat`

## Notes:
1. checking this at the proposed model. The check for the baseline model will be done by checking that proposed = baseline in Rule 11-15
Expand Down
2 changes: 1 addition & 1 deletion docs/section11/Rule11-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Schema Version:** 0.0.37
**Mandatory Rule:** True
**Rule ID:** 11-6
**Rule Description:** Piping losses shall not be modeled.
**Rule Description:** Piping losses shall not be modeled.
**Rule Assertion:** Options are PASS/FAIL/NOT_APPLICABLE/UNDETERMINED
**Appendix G Section Reference:** Table G3.1 #11, baseline column, i

Expand Down
2 changes: 1 addition & 1 deletion rct229/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def cli():
Software test workflow, add sections to do test. \n
--ruleset or -rs: default is ashrae9012019, available: ashrae9012019\n
argument (optional): section string, \n
currently available: section1, section4, section5, section6, section10, section12, section16, section18, section19, section21, section22 and section23"""
currently available: section1, section4, section5, section6, section10, section11, section12, section16, section18, section19, section21, section22 and section23"""


@cli.command(
Expand Down
1 change: 1 addition & 0 deletions rct229/rule_engine/rulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class RuleSetTest:
"section5",
"section6",
"section10",
"section11",
"section12",
"section16",
"section18",
Expand Down
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",
"section11",
"section12",
"section16",
"section18",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_building_segment_swh_bat import (
get_building_segment_swh_bat,
)
from rct229.rulesets.ashrae9012019.ruleset_functions.get_swh_uses_associated_with_each_building_segment import (
get_swh_uses_associated_with_each_building_segment,
)
from rct229.utils.jsonpath_utils import find_all


def get_swh_bats_and_swh_use(rmd: dict) -> dict:
"""
This function gets all the SWH Uses and the SWH space types and sorts them into a dictionary where the keys are the ServiceWaterHeatingBuildingAreaOptions2019ASHRAE901
and values are a list of ServiceWaterHeatingUse.ids

Parameters
----------
rmd: dict
The ruleset model descriptions

Returns
-------
swh_bat_and_SWH_use_dict: dict
A dictionary containing where the keys are the ServiceWaterHeatingSpaceOptions2019ASHRAE901 in the RMD and values are lists of SWHUse ids.
Example: {"DORMITORY":["swh1","swh2","swh3"], "AUTOMOTIVE_FACILITY":["swhg1","swhg2","swhg3"]}
"""

swh_and_swh_use_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)
swh_and_swh_use_dict.setdefault(swh_bat, [])

service_water_heating_use_ids = (
get_swh_uses_associated_with_each_building_segment(rmd, bldg_seg_id)
)

swh_and_swh_use_dict[swh_bat].extend(service_water_heating_use_ids)

return swh_and_swh_use_dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
from rct229.rulesets.ashrae9012019.ruleset_functions.get_swh_bats_and_swh_use import (
get_swh_bats_and_swh_use,
)
from rct229.schema.schema_utils import quantify_rmd
from rct229.schema.validate import schema_validate_rmd

TEST_RMD = {
"id": "test_rmd",
"buildings": [
{
"id": "Building 1",
"building_open_schedule": "Required Building Schedule 1",
"building_segments": [
{
"id": "Building Segment 1",
"zones": [
{
"id": "Zone 1",
"spaces": [
{
"id": "Space 1",
"service_water_heating_building_area_type": "HOTEL",
"service_water_heating_uses": [
{
"id": "service water heating uses 1_1",
"use": 400,
"use_units": "POWER",
},
{
"id": "service water heating uses 1_2",
"use": 500,
"use_units": "POWER",
},
],
}
],
}
],
},
{
"id": "Building Segment 2",
"zones": [
{
"id": "Zone 2",
"spaces": [
{
"id": "Space 2",
"service_water_heating_building_area_type": "OFFICE",
"service_water_heating_uses": [
{
"id": "service water heating uses 2_1",
"use": 400,
"use_units": "POWER",
},
{
"id": "service water heating uses 2_2",
"use": 500,
"use_units": "POWER",
},
],
}
],
}
],
},
],
}
],
"schedules": [
{
"id": "SWH Schedule 1",
"hourly_values": [0.8] * 8760,
},
{
"id": "SWH Entering Water Temp Schedule 1",
"hourly_values": [50] * 8760,
},
],
"service_water_heating_distribution_systems": [
{
"id": "SWH Distribution 1",
"design_supply_temperature": 60,
"drain_heat_recovery_efficiency": 0.3,
"entering_water_mains_temperature_schedule": "SWH Entering Water Temp Schedule 1",
"tanks": [
{
"id": "Tank 1",
}
],
"service_water_piping": [
{
"id": "SWH Piping 1",
}
],
}
],
"type": "BASELINE_0",
}

TEST_RPD_FULL = {
"id": "229",
"ruleset_model_descriptions": [TEST_RMD],
"data_timestamp": "2024-02-12T09:00Z",
}

TEST_RMD = quantify_rmd(TEST_RPD_FULL)["ruleset_model_descriptions"][0]


def test__TEST_RPD__is_valid():
schema_validation_result = schema_validate_rmd(TEST_RPD_FULL)
assert schema_validation_result[
"passed"
], f"Schema error: {schema_validation_result['error']}"


def test__get_swh_bats_and_swh_use__two_bldg_seg():
assert get_swh_bats_and_swh_use(TEST_RMD) == {
"HOTEL": ["service water heating uses 1_1", "service water heating uses 1_2"],
"OFFICE": ["service water heating uses 2_1", "service water heating uses 2_2"],
}
32 changes: 32 additions & 0 deletions rct229/rulesets/ashrae9012019/section11/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Add all available rule modules in __all__
import importlib

__all__ = [
# "section11rule1",
# "section11rule2",
# "section11rule3",
# "section11rule4",
# "section11rule5",
"section11rule6",
# "section11rule7",
# "section11rule8",
# "section11rule9",
# "section11rule10",
# "section11rule11",
# "section11rule12",
# "section11rule13",
# "section11rule14",
# "section11rule15",
# "section11rule16",
"section11rule17",
]


def __getattr__(name):
if name in __all__:
return importlib.import_module("." + name, __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


def __dir__():
return sorted(__all__)
Loading
Loading