diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index 8cc6f0bb..1d0de9c8 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -20,7 +20,7 @@ class Idf: _BUILDING = 'BUILDING' _ZONE = 'ZONE' _LIGHTS = 'LIGHTS' - _APPLIANCES = 'OtherEquipment' + _APPLIANCES = 'OTHEREQUIPMENT' _PEOPLE = 'PEOPLE' _THERMOSTAT = 'HVACTEMPLATE:THERMOSTAT' _IDEAL_LOAD_AIR_SYSTEM = 'HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM' @@ -275,7 +275,7 @@ class Idf: def _add_window_construction_and_material(self, thermal_opening): for window_material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]: if window_material['UFactor'] == thermal_opening.overall_u_value and \ - window_material['Solar_Heat_Gain_Coefficient'] == thermal_opening.g_value: + window_material['Solar_Heat_Gain_Coefficient'] == thermal_opening.g_value: return order = str(len(self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]) + 1) @@ -358,16 +358,16 @@ class Idf: ) def _add_appliances(self, thermal_zone, zone_name): - fueltype='Electricity' + fuel_type = 'Electricity' fraction_radiant = thermal_zone.appliances.radiative_fraction - fraction_convective= thermal_zone.appliances.convective_fraction + fraction_convective = thermal_zone.appliances.convective_fraction fraction_latent = 0 method = 'Watts/Area' watts_per_zone_floor_area = thermal_zone.appliances.density subcategory = f'ELECTRIC EQUIPMENT#{zone_name}#InteriorEquipment' self._idf.newidfobject(self._APPLIANCES, - Fuel_type=fueltype, + Fuel_type=fuel_type, Name=f'{zone_name}_appliances', Zone_or_ZoneList_Name=zone_name, Schedule_Name=f'Appliance schedules {thermal_zone.usage_name}', @@ -378,6 +378,7 @@ class Idf: Fraction_Radiant=fraction_radiant, EndUse_Subcategory=subcategory ) + def _add_infiltration(self, thermal_zone, zone_name): for zone in self._idf.idfobjects["ZONE"]: if zone.Name == f'{zone_name}_infiltration': @@ -454,20 +455,20 @@ class Idf: else: self._add_block(building) # todo: this should change to specific variables per zone to process only the ones in the buildings_to_calculate - for building in self._target_buildings: + for _ in self._target_buildings: continue self._idf.newidfobject( - "OUTPUT:VARIABLE", - Variable_Name="Zone Ideal Loads Supply Air Total Heating Energy", - Reporting_Frequency="Hourly", - ) + "OUTPUT:VARIABLE", + Variable_Name="Zone Ideal Loads Supply Air Total Heating Energy", + Reporting_Frequency="Hourly", + ) self._idf.newidfobject( - "OUTPUT:VARIABLE", - Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy", - Reporting_Frequency="Hourly", - ) + "OUTPUT:VARIABLE", + Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy", + Reporting_Frequency="Hourly", + ) self._idf.match() try: @@ -578,7 +579,7 @@ class Idf: for material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]: if material['Name'] == glazing: if material['UFactor'] == opening.overall_u_value and \ - material['Solar_Heat_Gain_Coefficient'] == opening.g_value: + material['Solar_Heat_Gain_Coefficient'] == opening.g_value: return True return False diff --git a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py index 20e5b728..22565ba9 100644 --- a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py +++ b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py @@ -127,7 +127,7 @@ class InselMonthlyEnergyBalance(Insel): for thermal_boundary in thermal_zone.thermal_boundaries: type_code = _CONSTRUCTION_CODE[thermal_boundary.type] wall_area = thermal_boundary.opaque_area * (1 + thermal_boundary.window_ratio) - if thermal_boundary.type == cte.WALL: + if thermal_boundary.type == cte.WALL and thermal_boundary.parent_surface.percentage_shared is not None: wall_area = wall_area * (1 - thermal_boundary.parent_surface.percentage_shared) window_area = wall_area * thermal_boundary.window_ratio diff --git a/hub/imports/construction/nrcan_physics_parameters.py b/hub/imports/construction/nrcan_physics_parameters.py index ffe45ef7..aee0c48d 100644 --- a/hub/imports/construction/nrcan_physics_parameters.py +++ b/hub/imports/construction/nrcan_physics_parameters.py @@ -78,7 +78,7 @@ class NrcanPhysicsParameters: nrcan_archetypes = nrcan_catalog.entries('archetypes') for building_archetype in nrcan_archetypes: construction_period_limits = building_archetype.construction_period.split('_') - if int(construction_period_limits[0]) <= year_of_construction <= int(construction_period_limits[1]): + if int(construction_period_limits[0]) <= int(year_of_construction) <= int(construction_period_limits[1]): if (str(function) == str(building_archetype.function)) and \ (climate_zone == str(building_archetype.climate_zone)): return building_archetype diff --git a/hub/unittests/test_exports.py b/hub/unittests/test_exports.py index 868770c3..7cf35a4c 100644 --- a/hub/unittests/test_exports.py +++ b/hub/unittests/test_exports.py @@ -100,12 +100,13 @@ class TestExports(TestCase): """ export to IDF """ - city = self._get_citygml('FZK_Haus_LoD_2.gml') - self._city = GeometryFactory('citygml', path=file_path).city - for building in city.buildings: - building.year_of_construction = 2006 - if building.function is None: - building.function = 'large office' + file = 'FZK_Haus_LoD_2.gml' + file_path = (self._example_path / file).resolve() + city = GeometryFactory('citygml', + path=file_path, + function_to_hub=Dictionaries().alkis_function_to_hub_function).city + self.assertIsNotNone(city, 'city is none') + ConstructionFactory('nrcan', city=city) ConstructionFactory('nrcan', city).enrich() UsageFactory('nrcan', city).enrich() try: