some refactoring to keep our naming agreement

This commit is contained in:
Pilar 2023-03-17 10:10:30 -04:00
parent d672eee762
commit 1b90974b77
6 changed files with 27 additions and 39 deletions

View File

@ -36,9 +36,9 @@ class MontrealCustomCatalog(Catalog):
_lifetime = float(entry[item_type]['lifetime_equipment']['#text']) _lifetime = float(entry[item_type]['lifetime_equipment']['#text'])
_item_description = ItemDescription(item_type, _item_description = ItemDescription(item_type,
initial_investment=_investment, initial_investment=_investment,
initial_investment_units=_investment_unit, initial_investment_unit=_investment_unit,
reposition=_reposition, reposition=_reposition,
reposition_units=_reposition_unit, reposition_unit=_reposition_unit,
lifetime=_lifetime) lifetime=_lifetime)
return _item_description return _item_description
@ -48,7 +48,7 @@ class MontrealCustomCatalog(Catalog):
_refurbishment_unit = entry[item_type]['refurbishment_cost']['@cost_unit'] _refurbishment_unit = entry[item_type]['refurbishment_cost']['@cost_unit']
_item_description = ItemDescription(item_type, _item_description = ItemDescription(item_type,
refurbishment=_refurbishment, refurbishment=_refurbishment,
refurbishment_units=_refurbishment_unit) refurbishment_unit=_refurbishment_unit)
return _item_description return _item_description
def _get_capital_costs(self, entry): def _get_capital_costs(self, entry):
@ -140,7 +140,7 @@ class MontrealCustomCatalog(Catalog):
hvac_subsidy=hvac, hvac_subsidy=hvac,
photovoltaic_subsidy=photovoltaic_system, photovoltaic_subsidy=photovoltaic_system,
electricity_export=electricity_exports, electricity_export=electricity_exports,
reductions_taxes=reduction_tax) reductions_tax=reduction_tax)
_catalog_archetypes.append(Archetype(lod, _catalog_archetypes.append(Archetype(lod,
function, function,
municipality, municipality,

View File

@ -10,10 +10,10 @@ from hub.catalog_factories.data_models.cost.item_description import ItemDescript
class Chapter: class Chapter:
def __init__(self, chapter_type, items_list): def __init__(self, chapter_type, items):
self._chapter_type = chapter_type self._chapter_type = chapter_type
self._items_list = items_list self._items = items
@property @property
def chapter_type(self): def chapter_type(self):
@ -24,9 +24,9 @@ class Chapter:
return self._chapter_type return self._chapter_type
@property @property
def items_list(self) -> List[ItemDescription]: def items(self) -> List[ItemDescription]:
""" """
Get list of items contained in the chapter Get list of items contained in the chapter
:return: [str] :return: [str]
""" """
return self._items_list return self._items

View File

@ -26,15 +26,9 @@ class CostHelper:
} }
_chapters_in_lod1 = { _chapters_in_lod1 = {
'B10_superstructure': cte.SUPERSTRUCTURE, 'B_shell': cte.SUPERSTRUCTURE,
'B20_envelope': cte.ENVELOPE, 'D_services': cte.ENVELOPE,
'B30_roofing': cte.ROOFING, 'Z_allowances_overhead_profit': cte.ALLOWANCES_OVERHEAD_PROFIT
'D3010_energy_supply': cte.ENERGY_SUPPLY,
'D3020_heat_generating_systems': cte.HEAT_GENERATION,
'D3030_cooling_generation_systems': cte.COOL_GENERATION,
'D3040_distribution_systems': cte.DISTRIBUTION,
'D3080_other_hvac_ahu': cte.OTHER_SYSTEMS,
'D5020lighting_and_branch_wiring': cte.LIGHTING_AND_WIRING
} }
@property @property

View File

@ -13,13 +13,13 @@ class Income:
hvac_subsidy=None, hvac_subsidy=None,
photovoltaic_subsidy=None, photovoltaic_subsidy=None,
electricity_export=None, electricity_export=None,
reductions_taxes=None): reductions_tax=None):
self._construction_subsidy = construction_subsidy self._construction_subsidy = construction_subsidy
self._hvac_subsidy = hvac_subsidy self._hvac_subsidy = hvac_subsidy
self._photovoltaic_subsidy = photovoltaic_subsidy self._photovoltaic_subsidy = photovoltaic_subsidy
self._electricity_export = electricity_export self._electricity_export = electricity_export
self._reductions_taxes = reductions_taxes self._reductions_tax = reductions_tax
@property @property
def construction_subsidy(self) -> Union[None, float]: def construction_subsidy(self) -> Union[None, float]:
@ -54,9 +54,9 @@ class Income:
return self._construction_subsidy return self._construction_subsidy
@property @property
def reductions_taxes(self) -> Union[None, float]: def reductions_tax(self) -> Union[None, float]:
""" """
Get reduction in taxes in percentage (-) Get reduction in taxes in percentage (-)
:return: None or float :return: None or float
""" """
return self._reductions_taxes return self._reductions_tax

View File

@ -11,20 +11,20 @@ from typing import Union
class ItemDescription: class ItemDescription:
def __init__(self, item_type, def __init__(self, item_type,
initial_investment=None, initial_investment=None,
initial_investment_units=None, initial_investment_unit=None,
refurbishment=None, refurbishment=None,
refurbishment_units=None, refurbishment_unit=None,
reposition=None, reposition=None,
reposition_units=None, reposition_unit=None,
lifetime=None): lifetime=None):
self._item_type = item_type self._item_type = item_type
self._initial_investment = initial_investment self._initial_investment = initial_investment
self._initial_investment_units = initial_investment_units self._initial_investment_unit = initial_investment_unit
self._refurbishment = refurbishment self._refurbishment = refurbishment
self._refurbishment_units = refurbishment_units self._refurbishment_unit = refurbishment_unit
self._reposition = reposition self._reposition = reposition
self._reposition_units = reposition_units self._reposition_unit = reposition_unit
self._lifetime = lifetime self._lifetime = lifetime
@property @property
@ -41,7 +41,7 @@ class ItemDescription:
Get initial investment of the specific item in given units Get initial investment of the specific item in given units
:return: None, None or float, str :return: None, None or float, str
""" """
return self._initial_investment, self._initial_investment_units return self._initial_investment, self._initial_investment_unit
@property @property
def refurbishment(self) -> Union[(None, None), (float, str)]: def refurbishment(self) -> Union[(None, None), (float, str)]:
@ -49,7 +49,7 @@ class ItemDescription:
Get refurbishment costs of the specific item in given units Get refurbishment costs of the specific item in given units
:return: None, None or float, str :return: None, None or float, str
""" """
return self._refurbishment, self._refurbishment_units return self._refurbishment, self._refurbishment_unit
@property @property
def reposition(self) -> Union[(None, None), (float, str)]: def reposition(self) -> Union[(None, None), (float, str)]:
@ -57,7 +57,7 @@ class ItemDescription:
Get reposition costs of the specific item in given units Get reposition costs of the specific item in given units
:return: None, None or float, str :return: None, None or float, str
""" """
return self._reposition, self._reposition_units return self._reposition, self._reposition_unit
@property @property
def lifetime(self) -> Union[None, float]: def lifetime(self) -> Union[None, float]:

View File

@ -171,12 +171,6 @@ CURRENCY_PER_CBM_PER_HOUR = 'currency/(m3/h)'
PERCENTAGE = '%' PERCENTAGE = '%'
# Costs chapters # Costs chapters
SUPERSTRUCTURE = 'B10_superstructure' SUPERSTRUCTURE = 'B_shell'
ENVELOPE = 'B20_envelope' ENVELOPE = 'D_services'
ROOFING = 'B30_roofing' ALLOWANCES_OVERHEAD_PROFIT = 'Z_allowances_overhead_profit'
ENERGY_SUPPLY = 'D3010_energy_supply'
HEAT_GENERATION = 'D3020_heat_generating_systems'
COOL_GENERATION = 'D3030_cooling_generation_systems'
DISTRIBUTION = 'D3040_distribution_systems'
OTHER_SYSTEMS = 'D3080_other_hvac_ahu'
LIGHTING_AND_WIRING = 'D5020lighting_and_branch_wiring'