Partial implementation

This commit is contained in:
Guille Gutierrez 2023-02-16 08:00:16 -05:00
parent 2f9ff19161
commit 1d4649e252
4 changed files with 362 additions and 0 deletions

193
configuration.py Normal file
View File

@ -0,0 +1,193 @@
from pathlib import Path
data_path = Path('./data/').resolve()
nrcan_urls = Path('./data/nrcan.xml')
output_path = Path('./output/').resolve()
shgc_for_canadian_climate_zones = {'4': 0.39, '5': 0.39, '6': 0.39, '7A': 0.49, '7B': 0.49, '8': 0.41}
transparent_surfaces = ['Window', 'Skylight']
opaque_surfaces = ['Wall', 'RoofCeiling', 'Floor']
hdd_canadian_climate_zones = {'4': 2999,
'5': 3999,
'6': 4999,
'7A': 5999,
'7B': 6999,
'8': 10000
}
heavy_light = {'1000_1979': 0,
'1980_2010': 1,
'2011_2016': 1,
'2017_2019': 1,
'2020_3000': 1}
surface_types = {
"Floor": [
{
"Urea Formaldehyde Foam": 0.1,
"Cast Concrete": 0.1,
"Floor/Roof Screed": 0.07,
"Timber Flooring": 0.03
},
{
"Urea Formaldehyde Foam": 0.1,
"Cast Concrete": 0.1,
"Floor/Roof Screed": 0.07,
"Timber Flooring": 0.03
}
],
"RoofCeiling": [
{
"Asphalt 1": 0.01,
"MW Glass Wool (rolls)": 0.1,
"3_RVAL_3": 0,
"Plasterboard": 0.013
},
{
"Asphalt 1": 0.01,
"MW Glass Wool (rolls)": 0.1,
"3_RVAL_3": 0,
"Plasterboard": 0.013
}
],
"Wall": [
{
"Brickwork Outer": 0.1,
"XPS Extruded Polystyrene - CO2 Blowing": 0.0794,
"Concrete Block (Medium)": 0.1,
"Gypsum Plastering": 0.013
},
{
"Lightweight Metallic Cladding": 0.006,
"XPS Extruded Polystyrene - CO2 Blowing": 0.0877,
"Gypsum Plasterboard": 0.013
}
]
}
materials = {
"materials": [
{
"Urea Formaldehyde Foam": {
"conductivity": 0.04,
"density": 10,
"specific_heat": 1400,
"thermal_emittance": 0.9,
"solar_absorptance": 0.6,
"visible_absorptance": 0.6
}
},
{
"Cast Concrete": {
"conductivity": 1.13,
"density": 2000,
"specific_heat": 1000,
"thermal_emittance": 0.9,
"solar_absorptance": 0.6,
"visible_absorptance": 0.6
}
},
{
"Floor/Roof Screed": {
"conductivity": 0.41,
"density": 1200,
"specific_heat": 840,
"thermal_emittance": 0.9,
"solar_absorptance": 0.73,
"visible_absorptance": 0.73
}
},
{
"Timber Flooring": {
"conductivity": 0.14,
"density": 650,
"specific_heat": 1200,
"thermal_emittance": 0.9,
"solar_absorptance": 0.78,
"visible_absorptance": 0.78
}
},
{
"Asphalt 1": {
"conductivity": 0.7,
"density": 2100,
"specific_heat": 1000,
"thermal_emittance": 0.9,
"solar_absorptance": 0.85,
"visible_absorptance": 0.9
}
},
{
"MW Glass Wool (rolls)": {
"conductivity": 0.04,
"density": 12,
"specific_heat": 840,
"thermal_emittance": 0.9,
"solar_absorptance": 0.6,
"visible_absorptance": 0.6
}
},
{
"Plasterboard": {
"conductivity": 0.25,
"density": 2800,
"specific_heat": 896,
"thermal_emittance": 0.9,
"solar_absorptance": 0.5,
"visible_absorptance": 0.5
}
},
{
"Brickwork Outer": {
"conductivity": 0.84,
"density": 1700,
"specific_heat": 800,
"thermal_emittance": 0.9,
"solar_absorptance": 0.7,
"visible_absorptance": 0.7
}
},
{
"XPS Extruded Polystyrene- CO2 Blowing": {
"conductivity": 0.034,
"density": 35,
"specific_heat": 1400,
"thermal_emittance": 0.9,
"solar_absorptance": 0.6,
"visible_absorptance": 0.6
}
},
{
"Concrete Block (Medium)": {
"conductivity": 0.51,
"density": 1400,
"specific_heat": 1000,
"thermal_emittance": 0.9,
"solar_absorptance": 0.6,
"visible_absorptance": 0.6
}
},
{
"Gypsum Plastering": {
"conductivity": 0.4,
"density": 1000,
"specific_heat": 1000,
"thermal_emittance": 0.9,
"solar_absorptance": 0.5,
"visible_absorptance": 0.5
}
},
{
"Lightweight Metallic Cladding": {
"conductivity": 0.29,
"density": 1250,
"specific_heat": 1000,
"thermal_emittance": 0.9,
"solar_absorptance": 0.4,
"visible_absorptance": 0.4
}
}
]
}

76
data/nrcan.xml Normal file
View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<nrcan base_url_archetypes="https://raw.githubusercontent.com/canmet-energy/necb-2011-baselines/master/output/"
base_url_construction="https://raw.githubusercontent.com/NREL/openstudio-standards/master/lib/openstudio-standards/standards/necb/">
<standards_per_period>
<standard period_of_construction="1000_1979">
<constructions_location>BTAPPRE1980/data/surface_thermal_transmittance.json</constructions_location>
</standard>
<standard period_of_construction="1980_2010">
<constructions_location>BTAP1980TO2010/data/surface_thermal_transmittance.json</constructions_location>
</standard>
<standard period_of_construction="2011_2016">
<constructions_location>NECB2011/data/surface_thermal_transmittance.json</constructions_location>
</standard>
<standard period_of_construction="2017_2019">
<constructions_location>NECB2017/data/surface_thermal_transmittance.json</constructions_location>
</standard>
<standard period_of_construction="2020_3000">
<constructions_location>NECB2020/data/surface_thermal_transmittance.json</constructions_location>
</standard>
</standards_per_period>
<standards_per_function>
<standard function="FullServiceRestaurant">
<file_location>FullServiceRestaurant/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/8414706d-3ba9-4d70-ad3c-4db62d865e1b-os-report.html</file_location>
</standard>
<standard function="HighriseApartment">
<file_location>HighriseApartment/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/83ab3764-046e-48a8-85cd-a3c0ac761efa-os-report.html</file_location>
</standard>
<standard function="Hospital">
<file_location>Hospital/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/210dac7e-2d51-40a9-bc78-ad0bc1c57a89-os-report.html</file_location>
</standard>
<standard function="LargeHotel">
<file_location>LargeHotel/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/d0185276-7fe0-4da9-bb5d-8c8a7c13c405-os-report.html</file_location>
</standard>
<standard function="LargeOffice">
<file_location>LargeOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/2da33707-50a7-4554-91ed-c5fdbc1ce3b9-os-report.html</file_location>
</standard>
<standard function="MediumOffice">
<file_location>MediumOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/65d97bf8-8749-410b-b53d-5a9c60e0227c-os-report.html</file_location>
</standard>
<standard function="MidriseApartment">
<file_location>MidriseApartment/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/19518153-9c28-4e40-8bbd-98ef949c1bdb-os-report.html</file_location>
</standard>
<standard function="Outpatient">
<file_location>Outpatient/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/deab93c7-d086-432d-bb90-33c8c4e1fab3-os-report.html</file_location>
</standard>
<standard function="PrimarySchool">
<file_location>PrimarySchool/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/87f45397-5ef4-4df9-be41-d33c4b6d2fb7-os-report.html</file_location>
</standard>
<standard function="QuickServiceRestaurant">
<file_location>QuickServiceRestaurant/CAN_PQ_Montreal.Intl.AP.716270_CWEC/ 0bc55858-a81b-4d07-9923-1d84e8a23194-os-report.html</file_location>
</standard>
<standard function="RetailStandalone">
<file_location>RetailStandalone/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/a3643bcb-0eea-47d4-b6b9-253ed188ec0c-os-report.html</file_location>
</standard>
<standard function="RetailStripmall">
<file_location>RetailStripmall/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/ebaf5a16-00af-49de-9672-6b373fc825be-os-report.html</file_location>
</standard>
<standard function="SecondarySchool">
<file_location>SecondarySchool/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/3a4f105f-93ed-4b8b-9eb3-c8ca40c5de6e-os-report.html</file_location>
</standard>
<standard function="SmallHotel">
<file_location>SmallHotel/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/dff0a3fc-d9e5-4866-9e6a-dee9a0da60b2-os-report.html</file_location>
</standard>
<standard function="SmallOffice">
<file_location>SmallOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/a9a3669d-beb8-4951-aa11-c27dbc61a344-os-report.html</file_location>
</standard>
<standard function="Warehouse">
<file_location>Warehouse/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/569ec649-8017-4a3c-bd0a-337eba3ec488-os-report.html</file_location>
</standard>
</standards_per_function>
</nrcan>

49
opaque_surfaces.py Normal file
View File

@ -0,0 +1,49 @@
import configuration as c
import xmltodict
import json
from urllib.request import urlopen
def process_formula(formula, hdd):
formula = formula.replace('( hdd < ', '').replace(') ', '').split(':')
for equation in formula:
values = equation.split('? ')
if len(values) == 2:
if float(values[0]) > hdd:
return float(values[1])
else:
return float(equation)
with open(c.nrcan_urls, 'r') as f:
urls = xmltodict.parse(f.read(), force_list=['standard'])
base_url_construction = urls['nrcan']['@base_url_construction']
dictionary = {"opaque_surfaces": []}
for standard in urls['nrcan']['standards_per_period']['standard']:
constructions_location = standard['constructions_location']
url = f'{base_url_construction}/{constructions_location}'
_json = json.loads(urlopen(url).read())
for climate_zone in c.hdd_canadian_climate_zones.keys():
for table in _json['tables']['surface_thermal_transmittance']['table']:
if table['surface'] in c.opaque_surfaces:
u_value = process_formula(table['formula'], c.hdd_canadian_climate_zones[climate_zone])
opaque_surface = {
"opaque_surface": {
"name": f'{standard["@period_of_construction"]}_{climate_zone}',
"period_of_construction": f'{standard["@period_of_construction"]}',
"climate_zone": f'{climate_zone}',
"type": f"{table['boundary_condition']}{table['surface']}",
"u_value": u_value,
"layers": []
}
}
dictionary['opaque_surfaces'].append(
opaque_surface
)
output_dictionary = {"opaque_surfaces": dictionary['opaque_surfaces'], "materials": c.materials['materials']}
with open(f'{c.output_path}/opaque_surfaces.json', 'w') as f:
json.dump(output_dictionary, f, indent=2)

44
transparent_surfaces.py Normal file
View File

@ -0,0 +1,44 @@
import configuration as c
import xmltodict
import json
from urllib.request import urlopen
def process_formula(formula, hdd):
formula = formula.replace('( hdd < ', '').replace(') ', '').split(':')
for equation in formula:
values = equation.split('? ')
if len(values) == 2:
if float(values[0]) > hdd:
return float(values[1])
else:
return float(equation)
with open(c.nrcan_urls, 'r') as f:
urls = xmltodict.parse(f.read(), force_list=['standard'])
base_url_construction = urls['nrcan']['@base_url_construction']
windows_dictionary = {"transparent_surfaces": []}
for standard in urls['nrcan']['standards_per_period']['standard']:
constructions_location = standard['constructions_location']
url = f'{base_url_construction}/{constructions_location}'
_json = json.loads(urlopen(url).read())
for climate_zone in c.hdd_canadian_climate_zones.keys():
for table in _json['tables']['surface_thermal_transmittance']['table']:
if table['surface'] in c.transparent_surfaces:
u_value = process_formula(table['formula'], c.hdd_canadian_climate_zones[climate_zone])
windows_dictionary['transparent_surfaces'].append(
{
"transparent_surface": {
"name": f'{standard["@period_of_construction"]}_{climate_zone}',
"period_of_construction": f'{standard["@period_of_construction"]}',
"climate_zone": f'{climate_zone}',
"shgc": c.shgc_for_canadian_climate_zones[climate_zone],
"type": table['surface'],
"frame_ratio": 0,
"u_value": u_value
}
})
with open(f'{c.output_path}/transparent_surfaces.json', 'w') as f:
json.dump(windows_dictionary, f, indent=2)