diff --git a/hub/catalog_factories/cost/montreal_custom_catalog.py b/hub/catalog_factories/cost/montreal_custom_catalog.py
index a0679b89..5ab47d31 100644
--- a/hub/catalog_factories/cost/montreal_custom_catalog.py
+++ b/hub/catalog_factories/cost/montreal_custom_catalog.py
@@ -54,35 +54,38 @@ class MontrealCustomCatalog(Catalog):
def _get_capital_costs(self, entry):
general_chapters = []
chapters_titles = CostHelper().chapters_in_lod1
+ shell = entry['B_shell']
items_list = []
item_type = 'B10_superstructure'
- item_description = self._item_with_refurbishment_values(entry, item_type)
+ item_description = self._item_with_refurbishment_values(shell, item_type)
items_list.append(item_description)
- for item in entry['B20_envelope']:
+ for item in shell['B20_envelope']:
item_type = item
- item_description = self._item_with_refurbishment_values(entry['B20_envelope'], item_type)
+ item_description = self._item_with_refurbishment_values(shell['B20_envelope'], item_type)
items_list.append(item_description)
- item_type = 'B30_roofing'
- item_description = self._item_with_refurbishment_values(entry, item_type)
+ item_type = 'B3010_opaque_roof'
+ 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'
- item_description = self._item_with_threesome(entry['D30_hvac']['D3010_energy_supply'], item_type)
+ services = entry['D_services']
+ item_description = self._item_with_threesome(services['D30_hvac']['D3010_energy_supply'], item_type)
items_list.append(item_description)
item_type_list = ['D3020_heat_generating_systems', 'D3030_cooling_generation_systems', 'D3040_distribution_systems',
'D3080_other_hvac_ahu']
for item_type in item_type_list:
- item_description = self._item_with_threesome(entry['D30_hvac'], item_type)
+ item_description = self._item_with_threesome(services['D30_hvac'], item_type)
items_list.append(item_description)
- item_type = 'D5020lighting_and_branch_wiring'
- item_description = self._item_with_threesome(entry['D50_electrical'], item_type)
+ item_type = 'D5020_lighting_and_branch_wiring'
+ item_description = self._item_with_threesome(services['D50_electrical'], item_type)
items_list.append(item_description)
general_chapters.append(Chapter('D_services', items_list))
- design_allowance = float(entry['Z_allowances_overhead_profit']['Z10_design_allowance']['#text']) / 100
- overhead_and_profit = float(entry['Z_allowances_overhead_profit']['Z10_overhead_and_profit']['#text']) / 100
+ 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
_capital_cost = CapitalCost(general_chapters, design_allowance, overhead_and_profit)
return _capital_cost
@@ -90,17 +93,17 @@ class MontrealCustomCatalog(Catalog):
@staticmethod
def _get_operational_costs(entry):
fuels = []
- for item in entry['fuels']:
- fuel_type = item['fuel']['@fuel_type']
- fuel_variable = float(entry['fuel']['variable']['#text'])
- fuel_variable_units = float(entry['fuel']['variable']['@cost_unit'])
+ for item in entry['fuels']['fuel']:
+ fuel_type = item['@fuel_type']
+ fuel_variable = float(item['variable']['#text'])
+ fuel_variable_units = item['variable']['@cost_unit']
fuel_fixed_monthly = None
fuel_fixed_peak = None
if fuel_type == 'electricity':
- fuel_fixed_monthly = float(entry['fuel']['fixed']['fixed_monthly']['#text'])
- fuel_fixed_peak = float(entry['fuel']['fixed']['fixed_power']['#text']) / 1000
+ fuel_fixed_monthly = float(item['fixed_monthly']['#text'])
+ fuel_fixed_peak = float(item['fixed_power']['#text']) / 1000
elif fuel_type == 'gas':
- fuel_fixed_monthly = float(entry['fuel']['fixed']['fixed_monthly']['#text'])
+ fuel_fixed_monthly = float(item['fixed_monthly']['#text'])
fuel = Fuel(fuel_type,
fixed_monthly=fuel_fixed_monthly,
fixed_power=fuel_fixed_peak,
@@ -110,7 +113,7 @@ class MontrealCustomCatalog(Catalog):
heating_equipment_maintenance = float(entry['maintenance']['heating_equipment']['#text']) / 1000
cooling_equipment_maintenance = float(entry['maintenance']['cooling_equipment']['#text']) / 1000
photovoltaic_system_maintenance = float(entry['maintenance']['photovoltaic_system']['#text'])
- co2_emissions = float(entry['CO2_cost']['#text'])
+ co2_emissions = float(entry['co2_cost']['#text'])
_operational_cost = OperationalCost(fuels,
heating_equipment_maintenance,
cooling_equipment_maintenance,
@@ -127,14 +130,13 @@ class MontrealCustomCatalog(Catalog):
country = archetype['@country']
lod = float(archetype['@lod'])
currency = archetype['currency']
- print(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'])
- construction = float(archetype['incomes']['subsidies']['construction_subsidy']['#text'])
- hvac = float(archetype['incomes']['subsidies']['hvac_subsidy']['#text'])
- photovoltaic_system = float(archetype['incomes']['subsidies']['photovoltaic_subsidy']['#text'])
- electricity_exports = float(archetype['incomes']['energy_exports']['electricity']['#text']) / 1000 / 3600
+ construction = float(archetype['incomes']['subsidies']['construction']['#text'])
+ hvac = float(archetype['incomes']['subsidies']['hvac']['#text'])
+ photovoltaic_system = float(archetype['incomes']['subsidies']['photovoltaic']['#text'])
+ electricity_exports = float(archetype['incomes']['electricity_export']['#text']) / 1000 / 3600
reduction_tax = float(archetype['incomes']['tax_reduction']['#text']) / 100
income = Income(construction_subsidy=construction,
hvac_subsidy=hvac,
diff --git a/hub/data/costs/montreal_costs.xml b/hub/data/costs/montreal_costs.xml
index 1b40f6b8..6a30e95f 100644
--- a/hub/data/costs/montreal_costs.xml
+++ b/hub/data/costs/montreal_costs.xml
@@ -4,7 +4,7 @@
- 0
+ 0
@@ -24,7 +24,7 @@
- 800
+ 800
800
25
@@ -51,16 +51,16 @@
-
- 139
+
+ 139
139
20
-
+
2.5
- 14
+ 14
@@ -81,23 +81,21 @@
0.09
-
- 40
- 40
- 1
-
+
+ 40
+ 40
+ 1
+
30
6.3
-
- 2
- 1.5
- 3.6
+
+ 2
+ 1.5
+ 3.6
-
- 0
-
+ 0
2
@@ -106,7 +104,7 @@
- 0
+ 0
@@ -126,7 +124,7 @@
- 800
+ 800
800
25
@@ -142,7 +140,7 @@
15
- 0
+ 0
0
15
@@ -154,7 +152,7 @@
- 139
+ 139
139
20
@@ -166,38 +164,38 @@
-
- 12.27
- 0
- 0.075
-
-
- 17.71
- 0.640
-
-
- 1.2
-
-
- 0.09
-
-
- 40
- 40
- 1
-
- 30
+
+
+ 12.27
+ 0
+ 0.075
+
+
+ 17.71
+ 0.640
+
+
+ 1.2
+
+
+ 0.09
+
+
+
+ 40
+ 40
+ 1
+
+ 30
6.3
-
- 2
- 1.5
- 3.6
+
+ 2
+ 1.5
+ 3.6
-
- 0
-
+ 0
2
diff --git a/hub/imports/weather/epw_weather_parameters.py b/hub/imports/weather/epw_weather_parameters.py
index 89315ab0..2c7de4e2 100644
--- a/hub/imports/weather/epw_weather_parameters.py
+++ b/hub/imports/weather/epw_weather_parameters.py
@@ -131,4 +131,26 @@ class EpwWeatherParameters:
if cte.YEAR not in building.cold_water_temperature:
building.cold_water_temperature[cte.YEAR] = wh().get_yearly_mean_values(
building.cold_water_temperature[cte.HOUR][['epw']])
+
+ # If the usage has already being imported, the domestic hot water missing values must be calculated here that
+ # the cold water temperature is finally known
+ cold_temperature = building.cold_water_temperature[cte.YEAR]['epw']
+ for internal_zone in building.internal_zones:
+ if internal_zone.usages is not None:
+ for usage in internal_zone.usages:
+ if usage.domestic_hot_water.peak_flow is None:
+ if usage.domestic_hot_water.density is None:
+ continue
+ peak_flow = 0
+ if (usage.domestic_hot_water.service_temperature - cold_temperature) > 0:
+ peak_flow = usage.domestic_hot_water.density / cte.WATER_DENSITY / cte.WATER_HEAT_CAPACITY \
+ / (usage.domestic_hot_water.service_temperature - cold_temperature)
+ usage.domestic_hot_water.peak_flow = peak_flow
+ if usage.domestic_hot_water.density is None:
+ if usage.domestic_hot_water.peak_flow is None:
+ continue
+ density = usage.domestic_hot_water.peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY \
+ * (usage.domestic_hot_water.service_temperature - cold_temperature)
+ usage.domestic_hot_water.density = density
+
self._city.level_of_detail.weather = 2
diff --git a/hub/unittests/test_costs_catalog.py b/hub/unittests/test_costs_catalog.py
index 22786f30..1dd25021 100644
--- a/hub/unittests/test_costs_catalog.py
+++ b/hub/unittests/test_costs_catalog.py
@@ -17,7 +17,7 @@ class TestCostsCatalog(TestCase):
catalog_categories = catalog.names()
self.assertIsNotNone(catalog, 'catalog is none')
content = catalog.entries()
- self.assertTrue(len(content.archetypes) == 1)
+ self.assertTrue(len(content.archetypes) == 2)
# retrieving all the entries should not raise any exceptions
for category in catalog_categories: