cost_workflow v2

This commit is contained in:
atiya 2023-01-18 10:24:29 -05:00
parent f7e15a4284
commit 666e11dd3d
3 changed files with 42 additions and 15 deletions

View File

@ -4,22 +4,31 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Project Coder Atiya atiya.atiya@mail.concordia.ca Copyright © 2022 Project Coder Atiya atiya.atiya@mail.concordia.ca
""" """
from city_model_structure.city import City
class CapitalCost: class CapitalCost:
def __init__(self, city): def calculate_capital_cost(building_area, building_volume, content):
self._city = city structural_cost = float(content.costs[0].capital_cost.structural_cost) * building_volume
sub_structural_cost = float(content.costs[0].capital_cost.sub_structural_cost) * building_volume
lighting_cost = float(content.costs[0].capital_cost.lighting_cost) * building_volume
surface_finish_cost = float(content.costs[0].capital_cost.surface_finish_cost) * building_volume
engineer_cost = float(content.costs[0].capital_cost.engineer_cost) * building_volume
envelop_cost = float(content.costs[0].capital_cost.EnvelopCost.reposition) * building_volume +
# system_cost = float(content.costs[0].capital_cost.system_cost) * building_volume
# subsidy = float(content.costs[0].capital_cost.subsidy) * building_volume
print("structural_cost ", structural_cost)
print("sub_structural_cost ", sub_structural_cost)
print("lighting_cost ", lighting_cost)
print("surface_finish_cost ", surface_finish_cost)
print("engineer_cost ", engineer_cost)
# print("envelop_cost ", envelop_cost)
# print("system_cost ", system_cost)
# print("subsidy ", subsidy)
@property
def city(self) -> City:
return self._city
def calculate_capital_cost(building):
print("calculate_capital_cost called")
for internal_zone in building.internal_zones:
print("volume of the building ", internal_zone.volume)
print("area of the building ", internal_zone.area)
# for thermal_zone in internal_zone.thermal_zones: # for thermal_zone in internal_zone.thermal_zones:
# for thermal_boundary in thermal_zone.thermal_boundaries: # for thermal_boundary in thermal_zone.thermal_boundaries:
# total_opaque_area = [] # total_opaque_area = []

View File

@ -6,6 +6,7 @@ Copyright © 2022 Project Author Pilar Monsalvete Alvarez de Uribarri pilar_mons
import math import math
from capital_cost import CapitalCost from capital_cost import CapitalCost
class LifeCycleCosts: class LifeCycleCosts:
# todo: this should be (city, costs_catalog) or similar # todo: this should be (city, costs_catalog) or similar
@ -25,6 +26,8 @@ class LifeCycleCosts:
self._concepts = concepts self._concepts = concepts
def calculate_capital_costs(self): def calculate_capital_costs(self):
total_capital_costs = self._capital_costs_at_year_0 total_capital_costs = self._capital_costs_at_year_0
for year in range(1, self._number_of_years + 1): for year in range(1, self._number_of_years + 1):
@ -55,5 +58,13 @@ class LifeCycleCosts:
total_maintenance_costs += concept.mantainance_costs * costs_increase total_maintenance_costs += concept.mantainance_costs * costs_increase
return total_maintenance_costs return total_maintenance_costs
def capital_cost(one_building): def capital_cost(one_building, content):
CapitalCost.calculate_capital_cost(one_building) # print(len(one_building.internal_zones))
building_volume = 0.0
building_area = 0.0
for internal_zone in one_building.internal_zones:
building_area += internal_zone.area
building_volume += internal_zone.volume
# print("area of the building ", building_area)
# print("volume of the building ", building_volume)
CapitalCost.calculate_capital_cost(building_area, building_volume, content)

11
main.py
View File

@ -9,6 +9,8 @@ from imports.geometry_factory import GeometryFactory
from capital_cost import CapitalCost from capital_cost import CapitalCost
from life_cycle_costs import LifeCycleCosts from life_cycle_costs import LifeCycleCosts
from imports.construction_factory import ConstructionFactory from imports.construction_factory import ConstructionFactory
from catalog_factories.costs_catalog_factory import CostCatalogFactory
gml_file = 'one_building_in_kelowna.gml' gml_file = 'one_building_in_kelowna.gml'
file = Path(gml_file).resolve() file = Path(gml_file).resolve()
@ -18,10 +20,15 @@ ConstructionFactory('nrel', city).enrich()
number_of_years = 40 number_of_years = 40
consumer_price_index = 0.1 consumer_price_index = 0.1
catalog = CostCatalogFactory('montreal_catalog').catalog
content = catalog.entries()
for building in city.buildings: for building in city.buildings:
print("for building in city.buildings:") LifeCycleCosts.capital_cost(building, content)
LifeCycleCosts.capital_cost(building) catalog = CostCatalogFactory('montreal_catalog').catalog
content = catalog.entries()
# print(len(content.costs))
# lcc = LifeCycleCosts(building, number_of_years, consumer_price_index, costs_catalog) # lcc = LifeCycleCosts(building, number_of_years, consumer_price_index, costs_catalog)
# total_capital_costs = lcc.calculate_capital_costs() # total_capital_costs = lcc.calculate_capital_costs()
# end_of_life_costs = lcc.calculate_end_of_life_costs() # end_of_life_costs = lcc.calculate_end_of_life_costs()