diff --git a/configuration.py b/configuration.py new file mode 100644 index 0000000..c4da12b --- /dev/null +++ b/configuration.py @@ -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 + } + } + ] +} diff --git a/data/nrcan.xml b/data/nrcan.xml new file mode 100644 index 0000000..757c07f --- /dev/null +++ b/data/nrcan.xml @@ -0,0 +1,76 @@ + + + + + BTAPPRE1980/data/surface_thermal_transmittance.json + + + + BTAP1980TO2010/data/surface_thermal_transmittance.json + + + + NECB2011/data/surface_thermal_transmittance.json + + + + NECB2017/data/surface_thermal_transmittance.json + + + + NECB2020/data/surface_thermal_transmittance.json + + + + + + FullServiceRestaurant/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/8414706d-3ba9-4d70-ad3c-4db62d865e1b-os-report.html + + + HighriseApartment/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/83ab3764-046e-48a8-85cd-a3c0ac761efa-os-report.html + + + Hospital/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/210dac7e-2d51-40a9-bc78-ad0bc1c57a89-os-report.html + + + LargeHotel/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/d0185276-7fe0-4da9-bb5d-8c8a7c13c405-os-report.html + + + LargeOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/2da33707-50a7-4554-91ed-c5fdbc1ce3b9-os-report.html + + + MediumOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/65d97bf8-8749-410b-b53d-5a9c60e0227c-os-report.html + + + MidriseApartment/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/19518153-9c28-4e40-8bbd-98ef949c1bdb-os-report.html + + + Outpatient/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/deab93c7-d086-432d-bb90-33c8c4e1fab3-os-report.html + + + PrimarySchool/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/87f45397-5ef4-4df9-be41-d33c4b6d2fb7-os-report.html + + + QuickServiceRestaurant/CAN_PQ_Montreal.Intl.AP.716270_CWEC/ 0bc55858-a81b-4d07-9923-1d84e8a23194-os-report.html + + + RetailStandalone/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/a3643bcb-0eea-47d4-b6b9-253ed188ec0c-os-report.html + + + RetailStripmall/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/ebaf5a16-00af-49de-9672-6b373fc825be-os-report.html + + + SecondarySchool/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/3a4f105f-93ed-4b8b-9eb3-c8ca40c5de6e-os-report.html + + + SmallHotel/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/dff0a3fc-d9e5-4866-9e6a-dee9a0da60b2-os-report.html + + + SmallOffice/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/a9a3669d-beb8-4951-aa11-c27dbc61a344-os-report.html + + + Warehouse/CAN_PQ_Montreal.Intl.AP.716270_CWEC/os_report/569ec649-8017-4a3c-bd0a-337eba3ec488-os-report.html + + + diff --git a/opaque_surfaces.py b/opaque_surfaces.py new file mode 100644 index 0000000..81d731a --- /dev/null +++ b/opaque_surfaces.py @@ -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) diff --git a/transparent_surfaces.py b/transparent_surfaces.py new file mode 100644 index 0000000..6c243fb --- /dev/null +++ b/transparent_surfaces.py @@ -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)