From 12d742ce7354e866dec3d7c7e5027c05ebc2e0c8 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 24 Mar 2023 10:40:57 -0400 Subject: [PATCH] added ground values from epw file --- loads_calculation.py | 11 ++++------- peak_loads.py | 5 ++--- unittests/test_peak_loads_workflow.py | 14 +++++++------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/loads_calculation.py b/loads_calculation.py index e6a0867..8b29d94 100644 --- a/loads_calculation.py +++ b/loads_calculation.py @@ -6,10 +6,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ -import helpers.constants as cte - -AIR_DENSITY = 1.293 # kg/m3 -AIR_HEAT_CAPACITY = 1005.2 # J/kgK +import hub.helpers.constants as cte class LoadsCalculation: @@ -44,12 +41,12 @@ class LoadsCalculation: @staticmethod def _get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature): load_renovation_sensible = 0 - for usage in thermal_zone.usage_zones: - load_renovation_sensible += AIR_DENSITY * AIR_HEAT_CAPACITY * usage.mechanical_air_change \ + for usage in thermal_zone.usages: + load_renovation_sensible += cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * usage.mechanical_air_change \ * thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \ * (internal_temperature - ambient_temperature) - load_infiltration_sensible = AIR_DENSITY * AIR_HEAT_CAPACITY * float(thermal_zone.infiltration_rate_system_off) \ + load_infiltration_sensible = cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * thermal_zone.infiltration_rate_system_off \ * thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \ * (internal_temperature - ambient_temperature) diff --git a/peak_loads.py b/peak_loads.py index 9fbbca6..f0f823f 100644 --- a/peak_loads.py +++ b/peak_loads.py @@ -7,7 +7,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca from pathlib import Path -import helpers.constants as cte +import hub.helpers.constants as cte from loads_calculation import LoadsCalculation @@ -47,13 +47,12 @@ class PeakLoads: def _workflow(self): for building in self._city.buildings: ambient_temperature = building.external_temperature[cte.HOUR][self._weather_format] - ground_temperature = 0 + ground_temperature = building.ground_temperature[cte.YEAR]['2'][0] heating_ambient_temperature = 100 cooling_ambient_temperature = -100 heating_calculation_hour = -1 cooling_calculation_hour = -1 for hour, temperature in enumerate(ambient_temperature): - ground_temperature += temperature / 8760 if temperature < heating_ambient_temperature: heating_ambient_temperature = temperature heating_calculation_hour = hour diff --git a/unittests/test_peak_loads_workflow.py b/unittests/test_peak_loads_workflow.py index 878ce2f..515d02f 100644 --- a/unittests/test_peak_loads_workflow.py +++ b/unittests/test_peak_loads_workflow.py @@ -8,12 +8,12 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca from pathlib import Path from unittest import TestCase import pandas as pd -import helpers.constants as cte +import hub.helpers.constants as cte from helpers.monthly_values import MonthlyValues -from imports.geometry_factory import GeometryFactory -from imports.construction_factory import ConstructionFactory -from imports.usage_factory import UsageFactory -from imports.weather_factory import WeatherFactory +from hub.imports.geometry_factory import GeometryFactory +from hub.imports.construction_factory import ConstructionFactory +from hub.imports.usage_factory import UsageFactory +from hub.imports.weather_factory import WeatherFactory from peak_loads import PeakLoads @@ -96,7 +96,7 @@ class TestPeakLoadsWorkflow(TestCase): weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw' weather_format = 'epw' irradiance_format = 'sra' - construction_format = 'nrel' - usage_format = 'comnet' + construction_format = 'nrcan' + usage_format = 'nrcan' self._enrich_city(city, weather_file, weather_format, irradiance_format, construction_format, usage_format) PeakLoads(city, outputs_path, weather_format, irradiance_format)