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

View File

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

View File

@ -26,15 +26,9 @@ class CostHelper:
}
_chapters_in_lod1 = {
'B10_superstructure': cte.SUPERSTRUCTURE,
'B20_envelope': cte.ENVELOPE,
'B30_roofing': cte.ROOFING,
'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
'B_shell': cte.SUPERSTRUCTURE,
'D_services': cte.ENVELOPE,
'Z_allowances_overhead_profit': cte.ALLOWANCES_OVERHEAD_PROFIT
}
@property

View File

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

View File

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

View File

@ -171,12 +171,6 @@ CURRENCY_PER_CBM_PER_HOUR = 'currency/(m3/h)'
PERCENTAGE = '%'
# Costs chapters
SUPERSTRUCTURE = 'B10_superstructure'
ENVELOPE = 'B20_envelope'
ROOFING = 'B30_roofing'
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'
SUPERSTRUCTURE = 'B_shell'
ENVELOPE = 'D_services'
ALLOWANCES_OVERHEAD_PROFIT = 'Z_allowances_overhead_profit'