-
Notifications
You must be signed in to change notification settings - Fork 5
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
RCT/YJ/Updating report file names #1365
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import re | ||
|
||
from pydash import find | ||
|
||
from rct229.report_engine.rct_report import RCTReport | ||
from rct229.rule_engine.rct_outcome_label import RCTOutcomeLabel | ||
|
||
|
@@ -12,24 +11,30 @@ def __init__(self): | |
self.title = "ASHRAE STD 229P RULESET CHECKING TOOL" | ||
self.purpose = "Summary Report" | ||
self.ruleset = "ASHRAE 90.1-2019 Performance Rating Method (Appendix G)" | ||
self.ruleset_report_file = "ashrae901_2019_summary_report.md" | ||
self.ruleset_report_file = f"{self.__class__.__name__}.md" | ||
|
||
def initialize_ruleset_report(self, rule_outcome=None): | ||
self.section_list = [ | ||
"All", | ||
"Performance Calculations", | ||
"Schedules Setpoints", | ||
"Envelope", | ||
"Lighting", | ||
"HVAC General", | ||
"Receptacles", | ||
"Transformers", | ||
"HVAC-Baseline", | ||
"HVAC-General", | ||
"HVAC-HotWaterSide", | ||
"HVAC-ChilledWaterSide", | ||
"HVAC-AirSide", | ||
] | ||
] # TODO: need to expand as more sections are developed | ||
self.section_dict = { | ||
"1": "Performance Calculations", | ||
"4": "Schedules Setpoints", | ||
"5": "Envelope", | ||
"6": "Lighting", | ||
"10": "HVAC General", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @weilixu Both sections 10 and 19 have the same section name. Should we update one of these section names? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yunjoonjung-PNNL There are several things happening here. Section 19 and Section 10 are sort of mixed. I know there are some discussions on moving the unmet load hours check to section 10 but we currently put this on hold until everything becomes more stable. For now, using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds great! I'll move the rules when they are reorganized. |
||
"12": "Receptacles", | ||
"15": "Transformers", | ||
"18": "HVAC-Baseline", | ||
|
@@ -73,16 +78,16 @@ def initialize_ruleset_report(self, rule_outcome=None): | |
##### Date: {self.date_run} | ||
|
||
### RMD Files | ||
- user: {user_match["file_name"] if user_match else ""} | ||
- proposed: {proposed_match["file_name"] if proposed_match else ""} | ||
- baseline_0: {baseline_0_match["file_name"] if baseline_0_match else ""} | ||
- 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_180: {baseline_180_match["file_name"] if baseline_180_match else ""} | ||
- baseline_270: {baseline_270_match["file_name"] if baseline_270_match else ""} | ||
- 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 | Envelope | Lighting | Receptacles | Transformers | HVAC-HotWaterSide | HVAC - ChilledWaterSide | HVAC-AirSide | HVAC-General| HVAC-Baseline | ||
|:----------------------------:|:---:|:--------:|:--------:|:-----------:|:------------:|:--------------:|:--------------:|:--------------:|:--------------:|:-----------:| | ||
| | All | Performance Calculations | Schedules Setpoints | Envelope | Lighting | HVAC General | Receptacles | Transformers | HVAC-HotWaterSide | HVAC - ChilledWaterSide | HVAC-AirSide | HVAC-General| HVAC-Baseline | ||
|:----------------------------:|:---:|:--------:|:--------:|:--------:|:--------:|:-----------:|:------------:|:------------:|:--------------:|:--------------:|:--------------:|:--------------:|:-----------:| | ||
Replace-Rules | ||
Replace-Pass | ||
Replace-Fail | ||
|
@@ -155,7 +160,7 @@ def add_rule_to_ruleset_report(self, ruleset_report, rule_report, rule_outcome): | |
def save_ruleset_report(self, ruleset_report, report_dir): | ||
overall_rules_count = {name: 0 for name in self.section_list} | ||
|
||
for key in self.ruleset_outcome.keys(): | ||
for key in self.ruleset_outcome: | ||
for outcome in [ | ||
RCTOutcomeLabel.PASS, | ||
RCTOutcomeLabel.FAILED, | ||
|
@@ -164,11 +169,13 @@ def save_ruleset_report(self, ruleset_report, report_dir): | |
]: | ||
overall_rules_count[key] += self.ruleset_outcome[key][outcome] | ||
|
||
rules_line = f"|Rules|{overall_rules_count['All']}|{overall_rules_count['Envelope']}|{overall_rules_count['Lighting']}|{overall_rules_count['Receptacles']}|{overall_rules_count['Transformers']}|{overall_rules_count['HVAC-HotWaterSide']}|{overall_rules_count['HVAC-ChilledWaterSide']}|{overall_rules_count['HVAC-AirSide']}|{overall_rules_count['HVAC-General']}|{overall_rules_count['HVAC-Baseline']}|" | ||
pass_line = f"|Pass|{self.ruleset_outcome['All'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['Envelope'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['Lighting'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['Receptacles'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['Transformers'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['HVAC-HotWaterSide'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['HVAC-ChilledWaterSide'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['HVAC-AirSide'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['HVAC-General'][RCTOutcomeLabel.PASS]}|{self.ruleset_outcome['HVAC-Baseline'][RCTOutcomeLabel.PASS]}|" | ||
fail_line = f"|Fail|{self.ruleset_outcome['All'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['Envelope'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['Lighting'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['Receptacles'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['Transformers'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['HVAC-HotWaterSide'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['HVAC-ChilledWaterSide'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['HVAC-AirSide'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['HVAC-General'][RCTOutcomeLabel.FAILED]}|{self.ruleset_outcome['HVAC-Baseline'][RCTOutcomeLabel.FAILED]}|" | ||
not_applicable_line = f"|Not Applicable|{self.ruleset_outcome['All'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['Envelope'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['Lighting'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['Receptacles'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['Transformers'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['HVAC-HotWaterSide'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['HVAC-ChilledWaterSide'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['HVAC-AirSide'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['HVAC-General'][RCTOutcomeLabel.NOT_APPLICABLE]}|{self.ruleset_outcome['HVAC-Baseline'][RCTOutcomeLabel.NOT_APPLICABLE]}|" | ||
undetermined_line = f"|Undetermined (manual review)|{self.ruleset_outcome['All'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['Envelope'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['Lighting'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['Receptacles'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['Transformers'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['HVAC-HotWaterSide'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['HVAC-ChilledWaterSide'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['HVAC-AirSide'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['HVAC-General'][RCTOutcomeLabel.UNDETERMINED]}|{self.ruleset_outcome['HVAC-Baseline'][RCTOutcomeLabel.UNDETERMINED]}|" | ||
( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part was simplified with the private function ( |
||
rules_line, | ||
pass_line, | ||
fail_line, | ||
not_applicable_line, | ||
undetermined_line, | ||
) = self._generate_line(self.ruleset_outcome, overall_rules_count) | ||
|
||
self.summary_report = re.sub("Replace-Rules", rules_line, self.summary_report) | ||
self.summary_report = re.sub("Replace-Pass", pass_line, self.summary_report) | ||
|
@@ -191,3 +198,25 @@ def _section_name_helper(self, rule_outcome): | |
""" | ||
else: | ||
return None | ||
|
||
def _generate_line(self, outcome_data, overall_rules_count): | ||
rule_line = "|Rules|" | ||
pass_line = "|Pass|" | ||
fail_line = "|fail|" | ||
not_applicable_line = f"|Not Applicable|" | ||
undetermined_line = f"|Undetermined (manual review)|" | ||
|
||
for section_name, count in overall_rules_count.items(): | ||
rule_line += f"{overall_rules_count[section_name]}|" | ||
|
||
for section in self.section_list: | ||
pass_line += f"{outcome_data[section][RCTOutcomeLabel.PASS]}|" | ||
fail_line += f"{outcome_data[section][RCTOutcomeLabel.FAILED]}|" | ||
not_applicable_line += ( | ||
f"{outcome_data[section][RCTOutcomeLabel.NOT_APPLICABLE]}|" | ||
) | ||
undetermined_line += ( | ||
f"{outcome_data[section][RCTOutcomeLabel.UNDETERMINED]}|" | ||
) | ||
|
||
return rule_line, pass_line, fail_line, not_applicable_line, undetermined_line |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import json | ||
import os | ||
|
||
from rct229.reports.utils import aggregate_outcomes | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
|
||
class Section4Rule1(RuleDefinitionListIndexedBase): | ||
"""Rule 1 of ASHRAE 90.1-2019 Appendix G Section 4 (Airside System)""" | ||
"""Rule 1 of ASHRAE 90.1-2019 Appendix G Section 4 (Schedules Setpoints)""" | ||
|
||
def __init__(self): | ||
super(Section4Rule1, self).__init__( | ||
|
@@ -40,17 +40,16 @@ def __init__(self): | |
index_rmd=BASELINE_0, | ||
id="4-1", | ||
description="Temperature Control Setpoints shall be the same for proposed design and baseline building design.", | ||
ruleset_section_title="Airside System", | ||
ruleset_section_title="Schedules Setpoints", | ||
standard_section="Section G3.1-4 Schedule Modeling Requirements for the Proposed design and Baseline building", | ||
is_primary_rule=True, | ||
list_path="ruleset_model_descriptions[0]", | ||
data_items={"is_leap_year_b": (BASELINE_0, "calendar/is_leap_year")}, | ||
data_items={ | ||
"climate_zone_b": (BASELINE_0, "weather/climate_zone"), | ||
"is_leap_year_b": (BASELINE_0, "calendar/is_leap_year"), | ||
}, | ||
) | ||
|
||
def create_data(self, context, data=None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted since this can be integrated into |
||
rmr_b = context.BASELINE_0 | ||
return {"climate_zone": rmr_b["weather"]["climate_zone"]} | ||
|
||
class RuleSetModelInstanceRule(RuleDefinitionListIndexedBase): | ||
def __init__(self): | ||
super(Section4Rule1.RuleSetModelInstanceRule, self).__init__( | ||
|
@@ -59,7 +58,7 @@ def __init__(self): | |
), | ||
each_rule=Section4Rule1.RuleSetModelInstanceRule.ZoneRule(), | ||
index_rmd=BASELINE_0, | ||
list_path="$.buildings[*].zones[*]", | ||
list_path="$.buildings[*].building_segments[*].zones[*]", | ||
required_fields={"$": ["schedules"]}, | ||
) | ||
|
||
|
@@ -70,7 +69,7 @@ def create_data(self, context, data=None): | |
"schedules_b": rmd_b["schedules"], | ||
"schedules_p": rmd_p["schedules"], | ||
"zcc_dict_b": get_zone_conditioning_category_rmi_dict( | ||
data["climate_zone"], rmd_b | ||
data["climate_zone_b"], rmd_b | ||
), | ||
} | ||
|
||
|
@@ -127,8 +126,8 @@ def get_calc_vals(self, context, data=None): | |
) | ||
if thermostat_cooling_stpt_sch_id_b | ||
else [ | ||
zone_b.getattr_( | ||
zone_b, "design_thermostat_cooling_setpoint" | ||
getattr_( | ||
zone_b, "zones", "design_thermostat_cooling_setpoint" | ||
).magnitude | ||
] | ||
* number_of_hours | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted b/c it's not in use.