DHW bug solved. It had to do with the factor of the building surface. Now getting good results
This commit is contained in:
parent
3ccda97830
commit
78b21093bb
|
@ -20,7 +20,7 @@ from hub.catalog_factories.data_models.cost.cost_helper import CostHelper
|
|||
|
||||
class MontrealCustomCatalog(Catalog):
|
||||
def __init__(self, path):
|
||||
path = str(path / 'montreal_costs.xml')
|
||||
path = 'C:/Users/JGAVALDA/PycharmProjects/hub/hub/data/costs/montreal_costs.xml'
|
||||
with open(path) as xml:
|
||||
self._archetypes = xmltodict.parse(xml.read(), force_list='archetype')
|
||||
|
||||
|
@ -67,7 +67,6 @@ class MontrealCustomCatalog(Catalog):
|
|||
item_description = self._item_with_refurbishment_values(shell['B30_roofing'], item_type)
|
||||
items_list.append(item_description)
|
||||
general_chapters.append(Chapter('B_shell', items_list))
|
||||
|
||||
items_list = []
|
||||
item_type = 'D301010_photovoltaic_system'
|
||||
services = entry['D_services']
|
||||
|
@ -82,7 +81,6 @@ class MontrealCustomCatalog(Catalog):
|
|||
item_description = self._item_with_threesome(services['D50_electrical'], item_type)
|
||||
items_list.append(item_description)
|
||||
general_chapters.append(Chapter('D_services', items_list))
|
||||
|
||||
allowances = entry['Z_allowances_overhead_profit']
|
||||
design_allowance = float(allowances['Z10_design_allowance']['#text']) / 100
|
||||
overhead_and_profit = float(allowances['Z20_overhead_profit']['#text']) / 100
|
||||
|
@ -127,9 +125,9 @@ class MontrealCustomCatalog(Catalog):
|
|||
for archetype in archetypes:
|
||||
function = archetype['@function']
|
||||
municipality = archetype['@municipality']
|
||||
country = archetype['@country']
|
||||
lod = float(archetype['@lod'])
|
||||
currency = archetype['currency']
|
||||
country = 'CA'#archetype['@country']
|
||||
lod = 0 #float(archetype['@lod'])
|
||||
currency = 'CAD'#archetype['currency']
|
||||
capital_cost = self._get_capital_costs(archetype['capital_cost'])
|
||||
operational_cost = self._get_operational_costs(archetype['operational_cost'])
|
||||
end_of_life_cost = float(archetype['end_of_life_cost']['#text'])
|
||||
|
|
|
@ -19,7 +19,7 @@ class CostCatalogFactory:
|
|||
"""
|
||||
def __init__(self, file_type, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/costs')
|
||||
base_path = 'C:/Users/JGAVALDA/PycharmProjects/hub/hub/data/costs'
|
||||
self._catalog_type = '_' + file_type.lower()
|
||||
self._path = base_path
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ class Idf:
|
|||
method = 'Watts/Area'
|
||||
factor_size = thermal_zone.total_floor_area / thermal_zone.footprint_area
|
||||
# todo: revision of values of peak flow (too low). Added a factor, but to check original units
|
||||
peak_flow_rate = thermal_zone.domestic_hot_water.peak_flow * factor_size * thermal_zone.total_floor_area
|
||||
peak_flow_rate = thermal_zone.domestic_hot_water.peak_flow * thermal_zone.total_floor_area
|
||||
# = self._idf.newidfobject(self._DHW)
|
||||
# print(vars(_object))
|
||||
self._idf.newidfobject(self._DHW,
|
||||
|
@ -502,7 +502,6 @@ class Idf:
|
|||
self._add_lighting(thermal_zone, building.name)
|
||||
self._add_appliances(thermal_zone, building.name)
|
||||
self._add_DHW(thermal_zone, building.name)
|
||||
print('after schedules')
|
||||
if self._export_type == "Surfaces":
|
||||
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
|
||||
if building.internal_zones[0].thermal_zones is not None:
|
||||
|
@ -608,9 +607,8 @@ class Idf:
|
|||
wind_exposure = 'WindExposed'
|
||||
outside_boundary_condition_object = None
|
||||
# TODO: set assumption in constants, to select minimun shared area
|
||||
print(f'wall {surface.name} {surface.percentage_shared}')
|
||||
if surface.percentage_shared is not None and surface.percentage_shared > 0:
|
||||
print(f'shared wall {surface.name}')
|
||||
#print(f'wall {surface.name} {surface.percentage_shared}')
|
||||
if surface.percentage_shared is not None and surface.percentage_shared > 0.1:
|
||||
outside_boundary_condition = 'Surface'
|
||||
outside_boundary_condition_object = surface.name
|
||||
sun_exposure = 'NoSun'
|
||||
|
@ -650,7 +648,7 @@ class Idf:
|
|||
wind_exposure = 'WindExposed'
|
||||
outside_boundary_condition_object = ''
|
||||
# TODO: set assumption in constants, to select minimun shared area
|
||||
if boundary.parent_surface.percentage_shared is not None and boundary.parent_surface.percentage_shared >= 0:
|
||||
if boundary.parent_surface.percentage_shared is not None and boundary.parent_surface.percentage_shared >= 0.1:
|
||||
outside_boundary_condition = 'Surface'
|
||||
outside_boundary_condition_object = boundary.parent_surface.name
|
||||
sun_exposure = 'NoSun'
|
||||
|
@ -663,7 +661,7 @@ class Idf:
|
|||
construction_name = f'{boundary.construction_name}_{boundary.parent_surface.vegetation.name}'
|
||||
else:
|
||||
construction_name = boundary.construction_name
|
||||
print(f'shared wall {boundary.parent_surface.name} {outside_boundary_condition_object} {idf_surface_type}')
|
||||
#print(f'shared wall {boundary.parent_surface.name} {outside_boundary_condition_object} {idf_surface_type}')
|
||||
surface = self._idf.newidfobject(self._SURFACE, Name=f'{boundary.parent_surface.name}',
|
||||
Surface_Type=idf_surface_type,
|
||||
Zone_Name=zone_name,
|
||||
|
|
|
@ -55,9 +55,9 @@ class EnergyBuildingsExportsFactory:
|
|||
"""
|
||||
idf_data_path = (Path(__file__).parent / './building_energy/idf_files/').resolve()
|
||||
# todo: create a get epw file function based on the city
|
||||
print('path', idf_data_path)
|
||||
#print('path', idf_data_path)
|
||||
weather_path = (Path(__file__).parent / '../data/weather/epw/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw').resolve()
|
||||
print(weather_path)
|
||||
#print(weather_path)
|
||||
return Idf(self._city, self._path, (idf_data_path / 'Minimal.idf'), (idf_data_path / 'Energy+.idd'), weather_path,
|
||||
target_buildings=self._target_buildings, adjacent_buildings=self._adjacent_buildings)
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class Geojson:
|
|||
if point[2] < 0.5:
|
||||
ground_line.append(point)
|
||||
for entry in building_mapped:
|
||||
if building_mapped[entry]['shared_points'] <= 3:
|
||||
if building_mapped[entry]['shared_points'] <= 2:
|
||||
continue
|
||||
line = [building_mapped[entry]['line_start'], building_mapped[entry]['line_end']]
|
||||
neighbour_line = [building_mapped[entry]['neighbour_line_start'],
|
||||
|
@ -173,6 +173,8 @@ class Geojson:
|
|||
GeometryHelper.distance_between_points(neighbour_line[0], neighbour_line[1]) -
|
||||
GeometryHelper.distance_between_points(line[1], neighbour_line[0]) -
|
||||
GeometryHelper.distance_between_points(line[0], neighbour_line[1])) / 2
|
||||
print(line_shared)
|
||||
print()
|
||||
percentage_ground = line_shared / GeometryHelper.distance_between_points(line[0], line[1])
|
||||
percentage_height = neighbour_height / building.max_height
|
||||
if percentage_height > 1:
|
||||
|
|
|
@ -18,11 +18,13 @@ class TestCostsCatalog(TestCase):
|
|||
self.assertIsNotNone(catalog, 'catalog is none')
|
||||
content = catalog.entries()
|
||||
self.assertTrue(len(content.archetypes) == 2)
|
||||
print(catalog)
|
||||
|
||||
# retrieving all the entries should not raise any exceptions
|
||||
for category in catalog_categories:
|
||||
for value in catalog_categories[category]:
|
||||
catalog.get_entry(value)
|
||||
print(value)
|
||||
|
||||
with self.assertRaises(IndexError):
|
||||
catalog.get_entry('unknown')
|
||||
|
|
Loading…
Reference in New Issue
Block a user