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

DHW-related verification items development #46

Merged
4 changes: 4 additions & 0 deletions constrain/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
from .G36ReheatTerminalBoxHeatingAirflowSetpoint import *
from .G36ReheatTerminalBoxDeadbandAirflowSetpoint import *
from .G36TerminalBoxCoolingMinimumAirflow import *
from .hpwh_sizing import *
from .dhw_tank_temperature import *

__all__ = [
"AutomaticOADamperControl",
Expand Down Expand Up @@ -110,4 +112,6 @@
"G36ReheatTerminalBoxHeatingAirflowSetpoint",
"G36ReheatTerminalBoxDeadbandAirflowSetpoint",
"G36TerminalBoxCoolingMinimumAirflow",
"HPWH_sizing",
"DHW_tank_temperature",
]
23 changes: 23 additions & 0 deletions constrain/library/dhw_tank_temperature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from constrain.checklib import RuleCheckBase


class DHW_tank_temperature(RuleCheckBase):
yunjoonjung-PNNL marked this conversation as resolved.
Show resolved Hide resolved
points = ["T_dhw", "T_dhw_deadband", "T_dhw_design_parameter"]

def check_dhw_temperature(self, data):
if (
abs(data["T_dhw"] - data["T_dhw_design_parameter"])
<= 0.5 * data["T_dhw_deadband"]
):
return True
else:
return False

def verify(self):
self.result = self.df.apply(lambda d: self.check_dhw_temperature(d), axis=1)

def check_bool(self):
if len(self.result[self.result == False] > 0):
return False
else:
return True
49 changes: 49 additions & 0 deletions constrain/library/hpwh_sizing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from constrain.checklib import RuleCheckBase
import numpy as np

TEMP_TOLERANCE = 0.5 # deg C


class HPWH_sizing(RuleCheckBase):
points = [
"T_amb",
"HeatingRate_dx_coil",
"HeatingRate_waterheater1",
"HeatingRate_waterheater2",
"T_amb_parameter",
"HPWH_output_target_percent",
]

def verify(self):
self.df["total_hpwh_load"] = (
self.df["HeatingRate_dx_coil"]
+ self.df["HeatingRate_waterheater1"]
+ self.df["HeatingRate_waterheater2"]
)

self.df["HPWH_output"] = np.where(
self.df["total_hpwh_load"] != 0.0,
self.df["HeatingRate_dx_coil"] / self.df["total_hpwh_load"] * 100,
0.0,
)

min_hpwh_output = self.df[
(self.df["T_amb"] > self.df["T_amb_parameter"])
& (self.df["HPWH_output"] > 0.0)
]["HPWH_output"].min()
min_hpwh_output = 0.0 if min_hpwh_output is np.nan else min_hpwh_output

HPWH_output_target_percent = self.df["HPWH_output_target_percent"].iloc[0]

if min_hpwh_output >= HPWH_output_target_percent:
self.df["result"] = True
elif min_hpwh_output < HPWH_output_target_percent:
self.df["result"] = False

self.result = self.df["result"]

def check_bool(self):
if len(self.result[self.result == False] > 0):
return False
else:
return True
8,761 changes: 8,761 additions & 0 deletions demo/hpwh_demo/IECC-state-current-5B_ApartmentMidRise_STD2021_WA-Spokane-WA.csv
Copy link
Collaborator Author

@yunjoonjung-PNNL yunjoonjung-PNNL Aug 26, 2024

Choose a reason for hiding this comment

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

@lymereJ
I'll delete all the files in the demo/hpwh_demo, if these shouldn't be included. I included these for your review purpose.

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions demo/hpwh_demo/hpwh_demo_verification_cases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"cases": [
{
"no": 1,
"run_simulation": false,
"simulation_IO": {
"idf": "./test_cases/doe_prototype_cases/ASHRAE901_Hospital_STD2019_Atlanta.idf",
"idd": "./resources/Energy+V9_0_1.idd",
"weather": "./weather/USA_GA_Atlanta-Hartsfield.Jackson.Intl.AP.722190_TMY3.epw",
"output": "../resources/IECC-state-current-5B_ApartmentMidRise_STD2021_WA-Spokane-WA.csv",
"ep_path": "C:\\EnergyPlusV9-0-1\\energyplus.exe"
},
"expected_result": "pass",
"datapoints_source": {
"idf_output_variables": {
"T_amb": {
"subject": "Environment",
"variable": "Site Outdoor Air Drybulb Temperature",
"frequency": "TimeStep"
},
"HeatingRate_dx_coil": {
"subject": "SWHSYS1 HPWH DXCOIL",
"variable": "Cooling Coil Total Water Heating Rate",
"frequency": "TimeStep"
},
"HeatingRate_waterheater1": {
"subject": "SWHSYS1 HPWH TANK",
"variable": "Water Heater Heater 1 Heating Rate",
"frequency": "TimeStep"
},
"HeatingRate_waterheater2": {
"subject": "SWHSYS1 HPWH TANK",
"variable": "Water Heater Heater 2 Heating Rate",
"frequency": "TimeStep"
}
},
"parameters": {
"T_amb_parameter": 3.7,
"HPWH_output_target_percent": 20
}
},
"verification_class": "HPWH_sizing"
},
{
"no": 2,
"run_simulation": false,
"simulation_IO": {
"idf": "./test_cases/doe_prototype_cases/ASHRAE901_Hospital_STD2019_Atlanta.idf",
"idd": "./resources/Energy+V9_0_1.idd",
"weather": "./weather/USA_GA_Atlanta-Hartsfield.Jackson.Intl.AP.722190_TMY3.epw",
"output": "../resources/IECC-state-current-5B_ApartmentMidRise_STD2021_WA-Spokane-WA.csv",
"ep_path": "C:\\EnergyPlusV9-0-1\\energyplus.exe"
},
"expected_result": "pass",
"datapoints_source": {
"idf_output_variables": {
"T_dhw": {
"subject": "SWHSYS1 HPWH TANK",
"variable": "Water Heater Use Side Outlet Temperature",
"frequency": "TimeStep"
}
},
"parameters": {
"T_dhw_deadband": 5.0,
"T_dhw_design_parameter": 60
}
},
"verification_class": "DHW_tank_temperature"
}
]
}
94 changes: 94 additions & 0 deletions demo/hpwh_demo/hpwh_demo_workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"workflow_name": "HPWH workflow",
"meta": {
"author": "Yun Joon Jung",
"date": "08/26/2024",
"version": "1.0",
"description": "Demo workflow to showcase core Workflow API functionalities"
},
"imports": [
"numpy as np",
"pandas as pd",
"glob"
],
"states": {
"load timeseries data": {
"Type": "MethodCall",
"MethodCall": "DataProcessing",
"Parameters": {
"data_path": "./demo/hpwh_demo/IECC-state-current-5B_ApartmentMidRise_STD2021_WA-Spokane-WA.csv",
"data_source": "EnergyPlus"
},
"Payloads": {"data_processing_obj": "$", "data": "$.data"},
"Start": "True",
"Next": "load original verification case"
},
"load original verification case": {
"Type": "MethodCall",
"MethodCall": "VerificationCase",
"Parameters": {
"json_case_path": "./demo/hpwh_demo/hpwh_demo_verification_cases.json"
},
"Payloads": {
"verification_case_obj": "$",
"original_case_keys": "$.case_suite.keys()"
},
"Next": "setup verification"
},
"setup verification": {
"Type": "MethodCall",
"MethodCall": "Verification",
"Parameters": {"verifications": "Payloads['verification_case_obj']"},
"Payloads": {"verification_obj": "$"},
"Next": "configure verification runner"
},
"configure verification runner": {
"Type": "MethodCall",
"MethodCall": "Payloads['verification_obj'].configure",
"Parameters": {
"output_path": "./demo/hpwh_demo/outputs",
"lib_items_path": "./schema/library.json",
"plot_option": "+x None",
"fig_size": "+x (6, 5)",
"num_threads": 1,
"preprocessed_data": "Payloads['data']"
},
"Payloads": {},
"Next": "run verification"
},
"run verification": {
"Type": "MethodCall",
"MethodCall": "Payloads['verification_obj'].run",
"Parameters": {},
"Payloads": {"verification_return": "$"},
"Next": "reporting_object_instantiation"
},
"reporting_object_instantiation": {
"Type": "MethodCall",
"MethodCall": "Reporting",
"Parameters": {
"verification_json": "./demo/hpwh_demo/outputs/*_md.json",
"result_md_name": "report_summary.md",
"report_format": "markdown"
},
"Payloads": {"reporting_obj": "$"},
"Next": "report cases"
},
"report cases": {
"Type": "MethodCall",
"MethodCall": "Payloads['reporting_obj'].report_multiple_cases",
"Parameters": {},
"Payloads": {},
"Next": "Success"
},
"Success": {
"Type": "MethodCall",
"MethodCall": "print",
"Parameters": [
"Congratulations! the demo workflow is executed with expected results and no error!"
],
"Payloads": {},
"End": "True"
}
}
}
10 changes: 10 additions & 0 deletions demo/hpwh_demo/hpwh_demo_workflow_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys
import warnings

sys.path.append("./constrain")
from api import Workflow

warnings.simplefilter(action="ignore", category=FutureWarning)
warnings.simplefilter(action="ignore", category=ResourceWarning)
workflow = Workflow(workflow="./demo/hpwh_demo/hpwh_demo_workflow.json")
workflow.run_workflow(verbose=True)
96 changes: 96 additions & 0 deletions design/dhw_tank_temperature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Control Verification Algorithm -- DHW_tank_temperature
Copy link
Collaborator Author

@yunjoonjung-PNNL yunjoonjung-PNNL Aug 23, 2024

Choose a reason for hiding this comment

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

@lymereJ
I added these markdown documents for your review. I plan to delete these after review.


Author: _Yun Joon Jung, Jeremy Lerond_
Updated: _08/22/2024_

<!--
- Recommend formatting markdown with prettier https://prettier.io/ (available as vscode extension)
- `---` are added for easy presentation later (with things like slidev https://sli.dev/ )
-->

---

## Verification Name

_DHW_tank_temperature_

## Verification Description

_TBD_

## Code Requirements

### Code requirement

**Code Name:** _NA_
**Code Year:** _NA_
**Code Section:** _NA_
**Code Subsection:** _NA_

---

## Verification Approaches

### Verification Approach

_We aim to verify this control verification item by examing water temperature in the domestic hot water tank._

---

#### Verification Type

_rule-based_

#### Verification Applicability

- **Building Type(s):** _any_
- **Space Type(s):** _any_
- **System(s):**
_1. domestic hot water system._
- **Climate Zone(s):** _any_
- **Component(s):**

---

#### Verification Algorithm Data Points
- _T_dhw_
- Data Value Unit: _deg C_
- Data point Description: _Water Heater Temperature_
- Data Point Affiliation: _Domestic Hot Water System_

- _T_dhw_deadband_
- Data Value Unit: _deg C_
- Data point Description: _Water Heater Temperature Temperature Deadband_
- Data Point Affiliation: _Domestic Hot Water System_

- _T_dhw_design_parameter_
- Data Value Unit: _deg C_
- Data point Description: _Water Heater Temperature Parameter_
- Data Point Affiliation: _Domestic Hot Water System_

#### Verification Algorithm Description

_The algorithm verifies whether water temperature in the domestic hot water tank is within the deadband._

#### Verification Algorithm Pseudo Code

```
If abs(T_dhw_outlet - T_design_water_outlet_parameter) <= 0.5 * T_dhw_outlet_deadband
pass
else
fail
```

---

## Unit Tests

- _Provide a synthetic dataset that allow us to test both outcomes shown above: false and true._

---

## Implementation Description

_WIP_

#### Annotations
Loading
Loading