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-12 #1524

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from
Open

RS/YJ/Rule 11-12 #1524

wants to merge 25 commits into from

Conversation

yunjoonjung-PNNL
Copy link
Collaborator

This rule hasn't been tested and not ready for review yet.

swh_use_p = context.PROPOSED

return (
getattr_(swh_use_p, "service_water_heating_uses", "use") > 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this part, please see the email between Juan and me (Sep 19th - title: RCT, Question about ServiceWaterHeatingUse-USE unit). Please let me know if you think differently.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to care about the unit for now.
Checking the requirement of rule, it says check to see if the use has SWH loads
This implies we need to verify if the use actually has load - so your implementation here is good.
Perhaps you don't need to use getattr_. We can assume missing data is 0 load.

Copy link
Collaborator

@weilixu weilixu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the rule needs to be updated.

rmd_b = context.BASELINE_0
rmd_p = context.PROPOSED

return {"rmd_b": rmd_b, "rmd_p": rmd_p}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can make a create_data function and add data:

return {
    "is_leap_year_b": find_one("$.calendar.is_leap_year", rmd_b),
    "schedules_b": find_all("$.schedules[*], rmd_b),
    "schedules_p": find_all("$.schedules[*], rmd_p)
}


bldg_open_sch_b = find_exactly_one_schedule(rmd_b, bldg_open_sch_id_b)[
"hourly_values"
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the above create_data suggestion, you can use find_exactly_one_with_field_value("$.schedules_b[*]", "id", bldg_open_sch_id_b, data) to get the bldg_open_sch_b.

def create_data(self, context, data):
building_b = context.BASELINE_0
rmd_b = data["rmd_b"]
is_leap_year_b = data["is_leap_year_b"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_leap_year_b is not in the data with the current implementation.

each_rule=Section11Rule12.RMDRule.BuildingRule.BuildingSegmentRule(),
index_rmd=BASELINE_0,
list_path="$.building_segments[*]",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a is_applicable here to check the logic check that there is SWH in the proposed model AND that the building has a 24hr operating schedule

In RDS logic section, it is also said: A building must both have SWH loads and a 24hr operating schedule for this rule to be applicable. So it is appropriate to add is_applicable check under building level.

bldg_open_sch_b = data["bldg_open_sch_b"]
hours_this_year = data["hours_this_year"]

return sum(bldg_open_sch_b) == hours_this_year
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what is this filtering.
If the intention is just to make sure the building has 24 hours operation, then we should put this logic to is applicable because list_filter is a silence pass - no outcome returned.

get_swh_uses_associated_with_each_building_segment(
rmd_p, building_segment_p["id"]
)
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move this logic to RMD level. for example, creating a

swh_uses_associated_with_each_building_segment_p: 
{
    building_segment_id: get_swh_uses_associated_with_each_building_segment(
                            rmd_p, building_segment_p["id"]
                        )
    for building_segment_id in find_all("$.buildings[*].building_segments[*].id, rmd_p
}

I can skip this create data here.

in service_water_heating_use_ids_list_p
)

class SWHRule(PartialRuleDefinition):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the rule shall be evaluated at service water use level. Instead, I think it should be at the Building level.
if you read the applicable message, it starts with the building not the water use.

Also, if we check the logic - a great amount of logic is to verify whether the building has SWH load and it is operate 24 hours.

swh_use_p = context.PROPOSED

return (
getattr_(swh_use_p, "service_water_heating_uses", "use") > 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to care about the unit for now.
Checking the requirement of rule, it says check to see if the use has SWH loads
This implies we need to verify if the use actually has load - so your implementation here is good.
Perhaps you don't need to use getattr_. We can assume missing data is 0 load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants