forked from s_ranjbar/city_retrofit
solved feature in idf generator
This commit is contained in:
parent
c0a2a8a2f9
commit
4ccf16411c
|
@ -617,8 +617,11 @@ class ThermalZone:
|
||||||
_mean_peak_flow = 0
|
_mean_peak_flow = 0
|
||||||
_mean_service_temperature = 0
|
_mean_service_temperature = 0
|
||||||
for usage in self.usages:
|
for usage in self.usages:
|
||||||
|
if usage.domestic_hot_water.density is not None:
|
||||||
_mean_peak_density_load += usage.percentage * usage.domestic_hot_water.density
|
_mean_peak_density_load += usage.percentage * usage.domestic_hot_water.density
|
||||||
|
if usage.domestic_hot_water.peak_flow is not None:
|
||||||
_mean_peak_flow += usage.percentage * usage.domestic_hot_water.peak_flow
|
_mean_peak_flow += usage.percentage * usage.domestic_hot_water.peak_flow
|
||||||
|
if usage.domestic_hot_water.service_temperature is not None:
|
||||||
_mean_service_temperature += usage.percentage * usage.domestic_hot_water.service_temperature
|
_mean_service_temperature += usage.percentage * usage.domestic_hot_water.service_temperature
|
||||||
self._domestic_hot_water.density = _mean_peak_density_load
|
self._domestic_hot_water.density = _mean_peak_density_load
|
||||||
self._domestic_hot_water.peak_flow = _mean_peak_flow
|
self._domestic_hot_water.peak_flow = _mean_peak_flow
|
||||||
|
|
|
@ -83,6 +83,7 @@ class Idf:
|
||||||
def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path, export_type="Surfaces",
|
def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path, export_type="Surfaces",
|
||||||
target_buildings=None):
|
target_buildings=None):
|
||||||
self._city = city
|
self._city = city
|
||||||
|
self._sanity_check()
|
||||||
self._output_path = str(output_path.resolve())
|
self._output_path = str(output_path.resolve())
|
||||||
self._output_file = str((output_path / f'{city.name}.idf').resolve())
|
self._output_file = str((output_path / f'{city.name}.idf').resolve())
|
||||||
self._export_type = export_type
|
self._export_type = export_type
|
||||||
|
@ -106,6 +107,25 @@ class Idf:
|
||||||
self._adjacent_buildings += building.neighbours
|
self._adjacent_buildings += building.neighbours
|
||||||
self._export()
|
self._export()
|
||||||
|
|
||||||
|
def _sanity_check(self):
|
||||||
|
levels_of_detail = self._city.level_of_detail
|
||||||
|
if levels_of_detail.geometry is None:
|
||||||
|
raise AttributeError('Level of detail of geometry not assigned')
|
||||||
|
if levels_of_detail.geometry < 1:
|
||||||
|
raise AttributeError(f'Level of detail of geometry = {levels_of_detail.geometry}. Required minimum level 1')
|
||||||
|
if levels_of_detail.construction is None:
|
||||||
|
raise AttributeError('Level of detail of construction not assigned')
|
||||||
|
if levels_of_detail.construction < 2:
|
||||||
|
raise AttributeError(f'Level of detail of construction = {levels_of_detail.construction}. Required minimum level 2')
|
||||||
|
if levels_of_detail.usage is None:
|
||||||
|
raise AttributeError('Level of detail of usage not assigned')
|
||||||
|
if levels_of_detail.usage < 2:
|
||||||
|
raise AttributeError(f'Level of detail of usage = {levels_of_detail.usage}. Required minimum level 2')
|
||||||
|
if levels_of_detail.weather is None:
|
||||||
|
raise AttributeError('Level of detail of weather not assigned')
|
||||||
|
if levels_of_detail.weather < 2:
|
||||||
|
raise AttributeError(f'Level of detail of weather = {levels_of_detail.weather}. Required minimum level 2')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _matrix_to_list(points, lower_corner):
|
def _matrix_to_list(points, lower_corner):
|
||||||
lower_x = lower_corner[0]
|
lower_x = lower_corner[0]
|
||||||
|
@ -294,9 +314,9 @@ class Idf:
|
||||||
return
|
return
|
||||||
|
|
||||||
def _add_construction(self, thermal_boundary):
|
def _add_construction(self, thermal_boundary):
|
||||||
vegetation_name = f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}'
|
|
||||||
for construction in self._idf.idfobjects[self._CONSTRUCTION]:
|
for construction in self._idf.idfobjects[self._CONSTRUCTION]:
|
||||||
if thermal_boundary.parent_surface.vegetation is not None:
|
if thermal_boundary.parent_surface.vegetation is not None:
|
||||||
|
vegetation_name = f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}'
|
||||||
if construction.Name == vegetation_name:
|
if construction.Name == vegetation_name:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -313,6 +333,7 @@ class Idf:
|
||||||
layers = thermal_boundary.layers
|
layers = thermal_boundary.layers
|
||||||
# The constructions should have at least one layer
|
# The constructions should have at least one layer
|
||||||
if thermal_boundary.parent_surface.vegetation is not None:
|
if thermal_boundary.parent_surface.vegetation is not None:
|
||||||
|
vegetation_name = f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}'
|
||||||
_kwargs = {'Name': vegetation_name,
|
_kwargs = {'Name': vegetation_name,
|
||||||
'Outside_Layer': thermal_boundary.parent_surface.vegetation.name}
|
'Outside_Layer': thermal_boundary.parent_surface.vegetation.name}
|
||||||
for i in range(0, len(layers) - 1):
|
for i in range(0, len(layers) - 1):
|
||||||
|
@ -430,8 +451,10 @@ class Idf:
|
||||||
if zone.Name == f'{zone_name}_infiltration':
|
if zone.Name == f'{zone_name}_infiltration':
|
||||||
return
|
return
|
||||||
schedule = f'Infiltration schedules {thermal_zone.usage_name}'
|
schedule = f'Infiltration schedules {thermal_zone.usage_name}'
|
||||||
if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
|
# todo: if the schedule doesn't exist, does the idf notices??
|
||||||
return
|
# We shouldn't check this because the schedules could be written later
|
||||||
|
# if schedule not in self._idf.idfobjects[self._COMPACT_SCHEDULE]:
|
||||||
|
# return
|
||||||
self._idf.newidfobject(self._INFILTRATION,
|
self._idf.newidfobject(self._INFILTRATION,
|
||||||
Name=f'{zone_name}_infiltration',
|
Name=f'{zone_name}_infiltration',
|
||||||
Zone_or_ZoneList_Name=zone_name,
|
Zone_or_ZoneList_Name=zone_name,
|
||||||
|
@ -445,9 +468,10 @@ class Idf:
|
||||||
if zone.Name == f'{zone_name}_ventilation':
|
if zone.Name == f'{zone_name}_ventilation':
|
||||||
return
|
return
|
||||||
schedule = f'Ventilation schedules {thermal_zone.usage_name}'
|
schedule = f'Ventilation schedules {thermal_zone.usage_name}'
|
||||||
#if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
|
# todo: if the schedule doesn't exist, does the idf notices??
|
||||||
|
# We shouldn't check this because the schedules could be written later
|
||||||
|
# if schedule not in self._idf.idfobjects[self._COMPACT_SCHEDULE]:
|
||||||
# return
|
# return
|
||||||
# todo: revise ventilation with Pilar
|
|
||||||
self._idf.newidfobject(self._VENTILATION,
|
self._idf.newidfobject(self._VENTILATION,
|
||||||
Name=f'{zone_name}_ventilation',
|
Name=f'{zone_name}_ventilation',
|
||||||
Zone_or_ZoneList_Name=zone_name,
|
Zone_or_ZoneList_Name=zone_name,
|
||||||
|
|
|
@ -76,7 +76,7 @@ class InselMonthlyEnergyBalance:
|
||||||
if levels_of_detail.geometry is None:
|
if levels_of_detail.geometry is None:
|
||||||
raise AttributeError('Level of detail of geometry not assigned')
|
raise AttributeError('Level of detail of geometry not assigned')
|
||||||
if levels_of_detail.geometry < 1:
|
if levels_of_detail.geometry < 1:
|
||||||
raise AttributeError(f'Level of detail of geometry = {levels_of_detail.geometry}. Required minimum level 0.5')
|
raise AttributeError(f'Level of detail of geometry = {levels_of_detail.geometry}. Required minimum level 1')
|
||||||
if levels_of_detail.construction is None:
|
if levels_of_detail.construction is None:
|
||||||
raise AttributeError('Level of detail of construction not assigned')
|
raise AttributeError('Level of detail of construction not assigned')
|
||||||
if levels_of_detail.construction < 1:
|
if levels_of_detail.construction < 1:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user