Skip to content

Commit 7c7d4fd

Browse files
authored
Merge pull request #161 from pnnl/fan_power_limitation_pressure_drop_adjustment
Add new table for fan power limitation pressure drop adjustment
2 parents 5b07548 + 57e3200 commit 7c7d4fd

8 files changed

+3129
-0
lines changed

building_energy_standards_data/database_files/system_requirements_fan_power_allowance_pressure_drop_adjustment_189_1.json

Lines changed: 982 additions & 0 deletions
Large diffs are not rendered by default.

building_energy_standards_data/database_files/system_requirements_fan_power_allowance_pressure_drop_adjustment_90_1.json

Lines changed: 982 additions & 0 deletions
Large diffs are not rendered by default.

building_energy_standards_data/database_files/system_requirements_fan_power_allowance_pressure_drop_adjustment_IECC.json

Lines changed: 982 additions & 0 deletions
Large diffs are not rendered by default.

building_energy_standards_data/database_tables/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
"system_requirements_fan_power_allowance_90_1",
133133
"system_requirements_fan_power_allowance_IECC",
134134
"system_requirements_fan_power_allowance_189_1",
135+
"system_requirements_fan_power_allowance_pressure_drop_adjustment_90_1",
136+
"system_requirements_fan_power_allowance_pressure_drop_adjustment_IECC",
137+
"system_requirements_fan_power_allowance_pressure_drop_adjustment_189_1",
135138
"system_requirements_fan_power_allowance_altitude_correction_factor_90_1",
136139
"system_requirements_heat_rejection_90_1",
137140
"system_requirements_heat_rejection_189_1",
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
from building_energy_standards_data.database_engine.database import DBOperation
2+
from building_energy_standards_data.database_engine.database_util import (
3+
is_float,
4+
getattr_either,
5+
)
6+
7+
RECORD_HELP = """
8+
Must provide a tuple that contains:
9+
template: TEXT
10+
device: TEXT
11+
adjustment_in_wc: NUMERIC
12+
adjustment_in_wc_at_fan_system_design_conditions: TEXT
13+
adjustment_in_wc_2_times_at_fan_system_design_conditions: TEXT
14+
adjustment_in_wc_effectiveness_multiplier: NUMERIC
15+
adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft: NUMERIC
16+
annotation: TEXT (optional)
17+
"""
18+
19+
CREATE_SYSTEM_requirements_fan_power_allowance_pressure_drop_adjustment_TABLE = """
20+
CREATE TABLE IF NOT EXISTS %s
21+
(id INTEGER PRIMARY KEY,
22+
template TEXT NOT NULL,
23+
device TEXT,
24+
adjustment_in_wc NUMERIC,
25+
adjustment_in_wc_at_fan_system_design_conditions TEXT,
26+
adjustment_in_wc_2_times_at_fan_system_design_conditions TEXT,
27+
adjustment_in_wc_effectiveness_multiplier NUMERIC,
28+
adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft NUMERIC,
29+
annotation TEXT);
30+
"""
31+
32+
INSERT_A_SYSTEM_requirements_fan_power_allowance_pressure_drop_adjustment_RECORD = """
33+
INSERT INTO %s (
34+
template,
35+
device,
36+
adjustment_in_wc,
37+
adjustment_in_wc_at_fan_system_design_conditions,
38+
adjustment_in_wc_2_times_at_fan_system_design_conditions,
39+
adjustment_in_wc_effectiveness_multiplier,
40+
adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft,
41+
annotation
42+
)
43+
VALUES (?, ?, ?, ?, ?, ?, ?, ?);
44+
"""
45+
46+
RECORD_TEMPLATE = {
47+
"template": "",
48+
"device": "",
49+
"adjustment_in_wc": 0.0,
50+
"adjustment_in_wc_at_fan_system_design_conditions": "",
51+
"adjustment_in_wc_2_times_at_fan_system_design_conditions": "",
52+
"adjustment_in_wc_effectiveness_multiplier": 0.0,
53+
"adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft": 0.0,
54+
"annotation": "",
55+
}
56+
57+
58+
class SystemRequirementsFanPowerAllowancePressureDropAdjustment(DBOperation):
59+
def __init__(self, table_name, initial_data_directory):
60+
super(SystemRequirementsFanPowerAllowancePressureDropAdjustment, self).__init__(
61+
table_name=table_name,
62+
record_template=RECORD_TEMPLATE,
63+
initial_data_directory=initial_data_directory,
64+
create_table_query=CREATE_SYSTEM_requirements_fan_power_allowance_pressure_drop_adjustment_TABLE
65+
% table_name,
66+
insert_record_query=INSERT_A_SYSTEM_requirements_fan_power_allowance_pressure_drop_adjustment_RECORD
67+
% table_name,
68+
)
69+
70+
def get_record_info(self):
71+
"""
72+
A function to return the record info of the table
73+
:return:
74+
"""
75+
return RECORD_HELP
76+
77+
def validate_record_datatype(self, record):
78+
str_expected = [
79+
"template",
80+
"device" "adjustment_in_wc_at_fan_system_design_conditions",
81+
"adjustment_in_wc_2_times_at_fan_system_design_conditions",
82+
]
83+
84+
for f in str_expected:
85+
if record.get(f):
86+
assert isinstance(
87+
record[f], str
88+
), f"{f} requires to be a string, instead got {record[f]}"
89+
90+
float_expected = [
91+
"adjustment_in_wc",
92+
"adjustment_in_wc_effectiveness_multiplier",
93+
"adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft",
94+
]
95+
96+
for f in float_expected:
97+
if record.get(f):
98+
assert is_float(
99+
record.get(f)
100+
), f"{f} requires to be numeric data type, instead got {record[f]}"
101+
return True
102+
103+
def _preprocess_record(self, record):
104+
"""
105+
106+
:param record: dict
107+
:return:
108+
"""
109+
110+
return (
111+
getattr_either("template", record),
112+
getattr_either("device", record),
113+
getattr_either("adjustment_in_wc", record),
114+
getattr_either("adjustment_in_wc_at_fan_system_design_conditions", record),
115+
getattr_either(
116+
"adjustment_in_wc_2_times_at_fan_system_design_conditions", record
117+
),
118+
getattr_either("adjustment_in_wc_effectiveness_multiplier", record),
119+
getattr_either(
120+
"adjustment_in_wc_per_100_ft_of_verticaul_duct_exceeding_75_ft", record
121+
),
122+
getattr_either("annotation", record),
123+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sqlite3
2+
3+
from building_energy_standards_data.database_tables.system_requirements_fan_power_allowance_pressure_drop_adjustment import (
4+
SystemRequirementsFanPowerAllowancePressureDropAdjustment,
5+
)
6+
7+
TABLE_NAME = "system_requirements_fan_power_allowance_pressure_drop_adjustment_189_1"
8+
9+
10+
class SystemRequirementsFanPowerAllowancePressureDropAdjustment1891Table(
11+
SystemRequirementsFanPowerAllowancePressureDropAdjustment
12+
):
13+
def __init__(self):
14+
super(
15+
SystemRequirementsFanPowerAllowancePressureDropAdjustment1891Table, self
16+
).__init__(
17+
table_name=TABLE_NAME,
18+
initial_data_directory=f"building_energy_standards_data/database_files/{TABLE_NAME}",
19+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sqlite3
2+
3+
from building_energy_standards_data.database_tables.system_requirements_fan_power_allowance_pressure_drop_adjustment import (
4+
SystemRequirementsFanPowerAllowancePressureDropAdjustment,
5+
)
6+
7+
TABLE_NAME = "system_requirements_fan_power_allowance_pressure_drop_adjustment_90_1"
8+
9+
10+
class SystemRequirementsFanPowerAllowancePressureDropAdjustment901Table(
11+
SystemRequirementsFanPowerAllowancePressureDropAdjustment
12+
):
13+
def __init__(self):
14+
super(
15+
SystemRequirementsFanPowerAllowancePressureDropAdjustment901Table, self
16+
).__init__(
17+
table_name=TABLE_NAME,
18+
initial_data_directory=f"building_energy_standards_data/database_files/{TABLE_NAME}",
19+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sqlite3
2+
3+
from building_energy_standards_data.database_tables.system_requirements_fan_power_allowance_pressure_drop_adjustment import (
4+
SystemRequirementsFanPowerAllowancePressureDropAdjustment,
5+
)
6+
7+
TABLE_NAME = "system_requirements_fan_power_allowance_pressure_drop_adjustment_IECC"
8+
9+
10+
class SystemRequirementsFanPowerAllowancePressureDropAdjustmentIECCTable(
11+
SystemRequirementsFanPowerAllowancePressureDropAdjustment
12+
):
13+
def __init__(self):
14+
super(
15+
SystemRequirementsFanPowerAllowancePressureDropAdjustmentIECCTable, self
16+
).__init__(
17+
table_name=TABLE_NAME,
18+
initial_data_directory=f"building_energy_standards_data/database_files/{TABLE_NAME}",
19+
)

0 commit comments

Comments
 (0)