diff --git a/input_files/summerschool_one_building.geojson b/input_files/summerschool_one_building.geojson new file mode 100644 index 0000000..0836973 --- /dev/null +++ b/input_files/summerschool_one_building.geojson @@ -0,0 +1,294 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 12, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57945149010348, + 45.49793915473101 + ], + [ + -73.57945502047383, + 45.497935600591106 + ], + [ + -73.57945748913181, + 45.49793681276347 + ], + [ + -73.57945995778985, + 45.49793802493576 + ], + [ + -73.57946108986009, + 45.49793688584562 + ], + [ + -73.57946222064952, + 45.49793574585649 + ], + [ + -73.57946503164756, + 45.497932909392325 + ], + [ + -73.5794800321942, + 45.497917804072586 + ], + [ + -73.57949503273288, + 45.49790269875081 + ], + [ + -73.57950823165471, + 45.49788939886833 + ], + [ + -73.57952143057031, + 45.497876098984314 + ], + [ + -73.57952481016481, + 45.49787269972034 + ], + [ + -73.57952818975889, + 45.49786930045622 + ], + [ + -73.57963374256275, + 45.49776298233438 + ], + [ + -73.57963739684415, + 45.497759299424665 + ], + [ + -73.57956562282082, + 45.49772405755894 + ], + [ + -73.5795624921933, + 45.497722521006246 + ], + [ + -73.57955974509859, + 45.4977252944393 + ], + [ + -73.57953557695755, + 45.497749634054365 + ], + [ + -73.5795114087957, + 45.497773973664174 + ], + [ + -73.57945076790263, + 45.49783505227953 + ], + [ + -73.57939012687844, + 45.49789613086214 + ], + [ + -73.57938759058709, + 45.49789868818189 + ], + [ + -73.57938505429556, + 45.49790124550157 + ], + [ + -73.57941717242674, + 45.49791701633786 + ], + [ + -73.5794136407655, + 45.497920563278754 + ], + [ + -73.57943256542505, + 45.497929854507255 + ], + [ + -73.57944202776348, + 45.49793450461953 + ], + [ + -73.57945149010348, + 45.49793915473101 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 12, + "gml_id": 1340982, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 19.113, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": "2931.350", + "parcelle": " ", + "OBJECTID": 1056, + "gml_id_1": "384b2b1c-2e25-4f6a-b082-d272dba3453f", + "gml_pare_1": 1340982, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 191.404, + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 1058, + "gml_id_12": 1340982, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 19.113, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": "2931.350", + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1056, + "gml_id_12_": "384b2b1c-2e25-4f6a-b082-d272dba3453f", + "gml_pare_3": 1340982, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 191.404, + "cityGML_hi": 0, + "Z_Min": 46.1162, + "Z_Max": 64.399, + "Shape_Leng": 63.6906066955, + "ID_UEV": "01036804", + "CIVIQUE_DE": " 2170", + "CIVIQUE_FI": " 2170", + "NOM_RUE": "rue Bishop (MTL)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1900, + "CODE_UTILI": 6000, + "LIBELLE_UT": "Immeuble à bureaux", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-7770-3-000-0000", + "SUPERFICIE": 259, + "SUPERFIC_1": 490, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00093336765858, + "Shape_Ar_1": 3.0845126501e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 63.69060669550123, + "Shape_Area": 174.69050030775531 + } + } + ] +} \ No newline at end of file diff --git a/main.py b/main.py index 32fbc0b..41d6d67 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ from sra_engine import SraEngine try: - file_path = (Path(__file__).parent / 'input_files' / 'selected_building_warehouse.geojson') + file_path = (Path(__file__).parent / 'input_files' / '195_v1.geojson') climate_reference_city = 'Montreal' weather_format = 'epw' construction_format = 'nrcan' diff --git a/results.py b/results.py index af3eaf7..793016b 100644 --- a/results.py +++ b/results.py @@ -150,3 +150,148 @@ class Results: full_path_metadata = Path(self._path / 'metadata.csv').resolve() with open(full_path_metadata, 'w') as metadata_file: metadata_file.write(file) + + def outputsforgraph(self): + file = 'city name: ' + self._city.name + '\n' + array = [None] * 12 + for building in self._city.buildings: + if cte.MONTH in building.heating_demand.keys(): + heating_results = building.heating_demand[cte.MONTH].rename( + columns={cte.INSEL_MEB: f'{building.name} heating Wh'}) + else: + heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh']) + if cte.MONTH in building.cooling_demand.keys(): + cooling_results = building.cooling_demand[cte.MONTH].rename( + columns={cte.INSEL_MEB: f'{building.name} cooling Wh'}) + else: + cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh']) + if cte.MONTH in building.lighting_electrical_demand.keys(): + lighting_results = building.lighting_electrical_demand[cte.MONTH] \ + .rename(columns={cte.INSEL_MEB: f'{building.name} lighting electrical demand Wh'}) + else: + lighting_results = pd.DataFrame(array, columns=[f'{building.name} lighting electrical demand Wh']) + if cte.MONTH in building.appliances_electrical_demand.keys(): + appliances_results = building.appliances_electrical_demand[cte.MONTH] \ + .rename(columns={cte.INSEL_MEB: f'{building.name} appliances electrical demand Wh'}) + else: + appliances_results = pd.DataFrame(array, columns=[f'{building.name} appliances electrical demand Wh']) + if cte.MONTH in building.domestic_hot_water_heat_demand.keys(): + dhw_results = building.domestic_hot_water_heat_demand[cte.MONTH] \ + .rename(columns={cte.INSEL_MEB: f'{building.name} domestic hot water demand Wh'}) + else: + dhw_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water demand Wh']) + + if cte.MONTH in building.heating_consumption.keys(): + heating_consumption_results = pd.DataFrame(building.heating_consumption[cte.MONTH], + columns=[f'{building.name} heating consumption Wh']) + else: + heating_consumption_results = pd.DataFrame(array, columns=[f'{building.name} heating consumption Wh']) + if cte.MONTH in building.cooling_consumption.keys(): + cooling_consumption_results = pd.DataFrame(building.cooling_consumption[cte.MONTH], + columns=[f'{building.name} cooling consumption Wh']) + else: + cooling_consumption_results = pd.DataFrame(array, columns=[f'{building.name} cooling consumption Wh']) + if cte.MONTH in building.domestic_hot_water_consumption.keys(): + dhw_consumption_results = pd.DataFrame(building.domestic_hot_water_consumption[cte.MONTH], + columns=[f'{building.name} domestic hot water consumption Wh']) + else: + dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh']) + + if cte.MONTH in building.heating_peak_load.keys(): + heating_peak_load_results = pd.DataFrame(building.heating_peak_load[cte.MONTH], + columns=[f'{building.name} heating peak load W']) + else: + heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W']) + if cte.MONTH in building.cooling_peak_load.keys(): + cooling_peak_load_results = pd.DataFrame(building.cooling_peak_load[cte.MONTH], + columns=[f'{building.name} cooling peak load W']) + else: + cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W']) + + if cte.MONTH in building.onsite_electrical_production.keys(): + monthly_onsite_electrical_production = building.onsite_electrical_production[cte.MONTH] + onsite_electrical_production = pd.DataFrame(monthly_onsite_electrical_production, + columns=[f'{building.name} onsite electrical production Wh']) + else: + onsite_electrical_production = pd.DataFrame(array, + columns=[f'{building.name} onsite electrical production Wh']) + + heating = 0 + cooling = 0 + for system in building.energy_systems: + for demand_type in system.demand_types: + if demand_type == cte.HEATING: + heating = 1 + if demand_type == cte.COOLING: + cooling = 1 + if cte.MONTH in building.heating_peak_load.keys() and cte.MONTH in building.cooling_peak_load.keys(): + peak_lighting = 0 + peak_appliances = 0 + for thermal_zone in building.internal_zones[0].thermal_zones: + lighting = thermal_zone.lighting + for schedule in lighting.schedules: + for value in schedule.values: + if value * lighting.density * thermal_zone.total_floor_area > peak_lighting: + peak_lighting = value * lighting.density * thermal_zone.total_floor_area + appliances = thermal_zone.appliances + for schedule in appliances.schedules: + for value in schedule.values: + if value * appliances.density * thermal_zone.total_floor_area > peak_appliances: + peak_appliances = value * appliances.density * thermal_zone.total_floor_area + + monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12 + conditioning_peak = [] + for i, value in enumerate(building.heating_peak_load[cte.MONTH]): + if cooling * building.cooling_peak_load[cte.MONTH][i] > heating * value: + conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][i]) + else: + conditioning_peak.append(heating * value) + monthly_electricity_peak[i] += 0.8 * conditioning_peak[i] + + electricity_peak_load_results = pd.DataFrame(monthly_electricity_peak + , columns=[f'{building.name} electricity peak load W']) + else: + electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W']) + + if cte.MONTH in building.distribution_systems_electrical_consumption.keys(): + extra_electrical_consumption = pd.DataFrame(building.distribution_systems_electrical_consumption[cte.MONTH], + columns=[ + f'{building.name} electrical consumption for distribution Wh']) + else: + extra_electrical_consumption = pd.DataFrame(array, + columns=[ + f'{building.name} electrical consumption for distribution Wh']) + + if print_results is None: + print_results = heating_results + else: + print_results = pd.concat([print_results, heating_results], axis='columns') + print_results = pd.concat([print_results, + cooling_results, + lighting_results, + appliances_results, + dhw_results, + heating_consumption_results, + cooling_consumption_results, + dhw_consumption_results, + heating_peak_load_results, + cooling_peak_load_results, + electricity_peak_load_results, + onsite_electrical_production, + extra_electrical_consumption], axis='columns') + file += '\n' + file += f'name: {building.name}\n' + file += f'year of construction: {building.year_of_construction}\n' + file += f'function: {building.function}\n' + file += f'floor area: {building.floor_area}\n' + if building.average_storey_height is not None and building.eave_height is not None: + file += f'storeys: {int(building.eave_height / building.average_storey_height)}\n' + else: + file += f'storeys: n/a\n' + file += f'volume: {building.volume}\n' + + full_path_results = Path(self._path / 'demand.csv').resolve() + print_results.to_csv(full_path_results, na_rep='null') + full_path_metadata = Path(self._path / 'metadata.csv').resolve() + with open(full_path_metadata, 'w') as metadata_file: + metadata_file.write(file) diff --git a/sra_engine.py b/sra_engine.py index dc08498..bd3bc6e 100644 --- a/sra_engine.py +++ b/sra_engine.py @@ -19,7 +19,7 @@ class SraEngine: if platform.system() == 'Linux': self._executable = 'sra' elif platform.system() == 'Windows': - self._executable = 'shortwave_integer' + self._executable = 'sra.exe' ExportsFactory('sra', self._city, output_file_path).export() self._run() ResultFactory('sra', self._city, output_file_path).enrich()