From b5389221c61e4d544c751430d9f85f8d17ab5bb7 Mon Sep 17 00:00:00 2001 From: guille Date: Fri, 17 Feb 2023 06:52:56 -0500 Subject: [PATCH] Added opaque surfaces --- configuration.py | 33 ++++++++++++++++++++++++--------- opaque_surfaces.py | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/configuration.py b/configuration.py index c4da12b..5bb9d36 100644 --- a/configuration.py +++ b/configuration.py @@ -16,22 +16,18 @@ hdd_canadian_climate_zones = {'4': 2999, '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, + "virtual_no_mass": 0, "Cast Concrete": 0.1, "Floor/Roof Screed": 0.07, "Timber Flooring": 0.03 }, { "Urea Formaldehyde Foam": 0.1, + "virtual_no_mass": 0, "Cast Concrete": 0.1, "Floor/Roof Screed": 0.07, "Timber Flooring": 0.03 @@ -40,37 +36,45 @@ surface_types = { "RoofCeiling": [ { "Asphalt 1": 0.01, + "virtual_no_mass": 0, "MW Glass Wool (rolls)": 0.1, - "3_RVAL_3": 0, "Plasterboard": 0.013 }, { "Asphalt 1": 0.01, + "virtual_no_mass": 0, "MW Glass Wool (rolls)": 0.1, - "3_RVAL_3": 0, "Plasterboard": 0.013 } ], "Wall": [ { "Brickwork Outer": 0.1, + "virtual_no_mass": 0, "XPS Extruded Polystyrene - CO2 Blowing": 0.0794, "Concrete Block (Medium)": 0.1, "Gypsum Plastering": 0.013 }, { "Lightweight Metallic Cladding": 0.006, + "virtual_no_mass": 0, "XPS Extruded Polystyrene - CO2 Blowing": 0.0877, "Gypsum Plasterboard": 0.013 - } ] } +heavy_light = {'1000_1979': 0, + '1980_2010': 1, + '2011_2016': 1, + '2017_2019': 1, + '2020_3000': 1} + materials = { "materials": [ { "Urea Formaldehyde Foam": { + "no_mass": False, "conductivity": 0.04, "density": 10, "specific_heat": 1400, @@ -81,6 +85,7 @@ materials = { }, { "Cast Concrete": { + "no_mass": False, "conductivity": 1.13, "density": 2000, "specific_heat": 1000, @@ -91,6 +96,7 @@ materials = { }, { "Floor/Roof Screed": { + "no_mass": False, "conductivity": 0.41, "density": 1200, "specific_heat": 840, @@ -101,6 +107,7 @@ materials = { }, { "Timber Flooring": { + "no_mass": False, "conductivity": 0.14, "density": 650, "specific_heat": 1200, @@ -111,6 +118,7 @@ materials = { }, { "Asphalt 1": { + "no_mass": False, "conductivity": 0.7, "density": 2100, "specific_heat": 1000, @@ -121,6 +129,7 @@ materials = { }, { "MW Glass Wool (rolls)": { + "no_mass": False, "conductivity": 0.04, "density": 12, "specific_heat": 840, @@ -131,6 +140,7 @@ materials = { }, { "Plasterboard": { + "no_mass": False, "conductivity": 0.25, "density": 2800, "specific_heat": 896, @@ -141,6 +151,7 @@ materials = { }, { "Brickwork Outer": { + "no_mass": False, "conductivity": 0.84, "density": 1700, "specific_heat": 800, @@ -151,6 +162,7 @@ materials = { }, { "XPS Extruded Polystyrene- CO2 Blowing": { + "no_mass": False, "conductivity": 0.034, "density": 35, "specific_heat": 1400, @@ -161,6 +173,7 @@ materials = { }, { "Concrete Block (Medium)": { + "no_mass": False, "conductivity": 0.51, "density": 1400, "specific_heat": 1000, @@ -171,6 +184,7 @@ materials = { }, { "Gypsum Plastering": { + "no_mass": False, "conductivity": 0.4, "density": 1000, "specific_heat": 1000, @@ -181,6 +195,7 @@ materials = { }, { "Lightweight Metallic Cladding": { + "no_mass": False, "conductivity": 0.29, "density": 1250, "specific_heat": 1000, diff --git a/opaque_surfaces.py b/opaque_surfaces.py index 81d731a..3d67a18 100644 --- a/opaque_surfaces.py +++ b/opaque_surfaces.py @@ -13,12 +13,33 @@ def process_formula(formula, hdd): else: return float(equation) +def create_virtual_no_mass_material(u_value, name, materials, construction): + r_value = 0 + for key in construction: + if key != 'virtual_no_mass': + material_thickness = construction[key] + for material in materials: + if key in material.keys(): + print(material[key]['conductivity']) + material_conductivity = material[key]['conductivity'] + r_value += (material_thickness/material_conductivity) + r_value = 1/u_value - r_value + new_virtual_no_mass_material = { + name: { + "no_mass": True, + "thermal_resistance": r_value + } + } + materials.append(new_virtual_no_mass_material) + 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": []} +no_mass_index = 0 +materials = c.materials['materials'] for standard in urls['nrcan']['standards_per_period']['standard']: constructions_location = standard['constructions_location'] url = f'{base_url_construction}/{constructions_location}' @@ -27,9 +48,16 @@ for standard in urls['nrcan']['standards_per_period']['standard']: 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]) - - - + layers = {} + construction = c.surface_types[table['surface']][c.heavy_light[standard["@period_of_construction"]]] + for key in construction: + if key != 'virtual_no_mass': + layers[key] = construction[key] + else: + material_name = f'virtual_no_mass_{no_mass_index}' + layers[material_name] = 0 + no_mass_index += 1 + create_virtual_no_mass_material(u_value,material_name, materials, construction) opaque_surface = { "opaque_surface": { "name": f'{standard["@period_of_construction"]}_{climate_zone}', @@ -37,13 +65,12 @@ for standard in urls['nrcan']['standards_per_period']['standard']: "climate_zone": f'{climate_zone}', "type": f"{table['boundary_condition']}{table['surface']}", "u_value": u_value, - "layers": [] + "layers": layers } } - dictionary['opaque_surfaces'].append( opaque_surface ) -output_dictionary = {"opaque_surfaces": dictionary['opaque_surfaces'], "materials": c.materials['materials']} +output_dictionary = {"opaque_surfaces": dictionary['opaque_surfaces'], "materials": materials} with open(f'{c.output_path}/opaque_surfaces.json', 'w') as f: json.dump(output_dictionary, f, indent=2)