solved some issues on units in costs catalog

This commit is contained in:
Pilar Monsalvete 2023-07-13 15:53:20 -04:00
parent 639e5a952d
commit 6ab3ee3dc3
10 changed files with 47 additions and 33 deletions

View File

@ -102,7 +102,7 @@ class Archetype:
@property
def end_of_life_cost(self):
"""
Get end of life cost in given currency
Get end of life cost in given currency per m2
:return: float
"""
return self._end_of_life_cost
@ -125,7 +125,7 @@ class Archetype:
'function': self.function,
'capital cost': self.capital_cost.to_dictionary(),
'operational cost': self.operational_cost.to_dictionary(),
f'end of life cost [currency]': self.end_of_life_cost,
'end of life cost [currency/m2]': self.end_of_life_cost,
'income': self.income.to_dictionary()
}
}

View File

@ -43,10 +43,10 @@ class Fuel:
@property
def fixed_power(self) -> Union[None, float]:
"""
Get fixed operational costs depending on the peak power consumed in currency per month per kW
Get fixed operational costs depending on the peak power consumed in currency per month per W
:return: None or float
"""
return self._fixed_power
return self._fixed_power/1000
@property
def variable(self) -> Union[tuple[None, None], tuple[float, str]]:
@ -60,7 +60,7 @@ class Fuel:
"""Class content to dictionary"""
content = {'Fuel': {'fuel type': self.type,
'fixed operational costs [currency/month]': self.fixed_monthly,
'fixed operational costs depending on the peak power consumed [currency/month kW]': self.fixed_power,
'fixed operational costs depending on the peak power consumed [currency/month W]': self.fixed_power,
f'variable costs [{self.variable[1]}]': self.variable[0]
}
}

View File

@ -66,10 +66,10 @@ class Income:
def to_dictionary(self):
"""Class content to dictionary"""
content = {'Income': {'construction subsidy': self.construction_subsidy,
'hvac subsidy': self.hvac_subsidy,
'photovoltaic subsidy': self.photovoltaic_subsidy,
'electricity export': self.electricity_export,
content = {'Income': {'construction subsidy [%]': self.construction_subsidy,
'hvac subsidy [%]': self.hvac_subsidy,
'photovoltaic subsidy [%]': self.photovoltaic_subsidy,
'electricity export [currency/J]': self.electricity_export,
'reductions tax': self.reductions_tax
}
}

View File

@ -1,7 +1,7 @@
{
"archetypes": [
{
"function": "Residential",
"function": "Residential_building",
"period_of_construction": "1000_1980",
"climate_zone": "BWh",
"average_storey_height": 3,
@ -35,7 +35,7 @@
}
},
{
"function": "Dormitory",
"function": "Residential_building",
"period_of_construction": "2011_3000",
"climate_zone": "BWh",
"average_storey_height": 3,
@ -69,7 +69,7 @@
}
},
{
"function": "Hotel_employees",
"function": "Residential_building",
"period_of_construction": "1981_2010",
"climate_zone": "BWh",
"average_storey_height": 3,

View File

@ -96,7 +96,7 @@
<photovoltaic cost_unit="%">3.6</photovoltaic>
</subsidies>
<electricity_export cost_unit="currency/kWh">0.07</electricity_export>
<tax_reduction cost_unit="%">0.05</tax_reduction>
<tax_reduction cost_unit="%">5</tax_reduction>
</incomes>
</archetype>
<archetype function="non-residential" municipality="montreal" country="CA" lod="1">
@ -196,7 +196,7 @@
<photovoltaic cost_unit="%">3.6</photovoltaic>
</subsidies>
<electricity_export cost_unit="currency/kWh">0.05</electricity_export>
<tax_reduction cost_unit="%">0.05</tax_reduction>
<tax_reduction cost_unit="%">5</tax_reduction>
</incomes>
</archetype>
</archetypes>

View File

@ -14,9 +14,9 @@ class HubFunctionToEilatConstructionFunction:
"""
def __init__(self):
self._dictionary = {
cte.RESIDENTIAL: 'Residential',
cte.HOTEL: 'Hotel_employees',
cte.DORMITORY: 'Dormitory'
cte.RESIDENTIAL: 'Residential_building',
cte.HOTEL: 'Residential_building',
cte.DORMITORY: 'Residential_building'
}
@property

View File

@ -50,7 +50,9 @@ class ConstructionHelper:
_reference_city_to_nrcan_climate_zone = {
'Montreal': '6',
'Repentigny': '6',
'Levis': '7A'
'Levis': '7A',
'Kelowna': '5',
'Park Slope': '4'
}
_reference_city_to_israel_climate_zone = {

View File

@ -105,11 +105,15 @@ class TestExports(TestCase):
"""
export to IDF
"""
file = 'FZK_Haus_LoD_2.gml'
file = 'test.geojson'
file_path = (self._example_path / file).resolve()
city = GeometryFactory('citygml',
city = GeometryFactory('geojson',
path=file_path,
function_to_hub=Dictionaries().alkis_function_to_hub_function).city
height_field='citygml_me',
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
self.assertIsNotNone(city, 'city is none')
EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
ConstructionFactory('nrcan', city).enrich()

View File

@ -30,11 +30,16 @@ class TestResultsImport(TestCase):
:return: None
"""
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
self._gml_path = (self._example_path / 'FZK_Haus_LoD_2.gml').resolve()
self._output_path = (Path(__file__).parent / 'tests_outputs').resolve()
self._city = GeometryFactory('citygml',
self._gml_path,
function_to_hub=Dictionaries().alkis_function_to_hub_function).city
file = 'test.geojson'
file_path = (self._example_path / file).resolve()
self._city = GeometryFactory('geojson',
path=file_path,
height_field='citygml_me',
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
ConstructionFactory('nrcan', self._city).enrich()
UsageFactory('nrcan', self._city).enrich()

View File

@ -36,11 +36,15 @@ class TestSystemsFactory(TestCase):
:return: None
"""
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
self._gml_path = (self._example_path / 'FZK_Haus_LoD_2.gml').resolve()
self._output_path = (Path(__file__).parent / 'tests_outputs').resolve()
self._city = GeometryFactory('citygml',
self._gml_path,
function_to_hub=Dictionaries().alkis_function_to_hub_function).city
file = 'test.geojson'
file_path = (self._example_path / file).resolve()
self._city = GeometryFactory('geojson',
path=file_path,
height_field='citygml_me',
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
def test_montreal_custom_system_factory(self):
"""
@ -50,7 +54,7 @@ class TestSystemsFactory(TestCase):
building.energy_systems_archetype_name = 'system 1 gas'
EnergySystemsFactory('montreal_custom', self._city).enrich()
self.assertEqual(1, len(self._city.energy_systems_connection_table))
self.assertEqual(17, len(self._city.energy_systems_connection_table))
def test_montreal_custom_system_results(self):
"""
@ -76,9 +80,8 @@ class TestSystemsFactory(TestCase):
energy_systems_connection = self._city.energy_systems_connection_table
for building in self._city.buildings:
_building_energy_systems = []
energy_systems = energy_systems_connection['Energy System Type'].where(
energy_systems_connection['Building'] == building.name
)
energy_systems = energy_systems_connection['Energy System Type'][
energy_systems_connection['Building'] == building.name]
for energy_system in energy_systems:
_generic_building_energy_systems = self._city.generic_energy_systems[energy_system]
for _generic_building_energy_system in _generic_building_energy_systems: