Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
512e6e2282 | |||
c4852ee9b7 | |||
97bc73e526 | |||
3d49fbcfdf | |||
e71afa4ff9 | |||
7baff0b846 | |||
4e8d09c067 | |||
97218deefb | |||
609f49ebc1 | |||
62ae152ba7 | |||
d8c0644709 | |||
47ff19a842 | |||
3a1aeca959 | |||
7548441c82 | |||
ea666afb02 | |||
41b9fe4049 | |||
a519b0e01c | |||
6f00da3c8d | |||
8cb2ad265d | |||
1052478ace | |||
8fa500d4c6 | |||
275d0e7cd9 | |||
685b2d2071 | |||
cdf3098334 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
.idea
|
||||
cerc_costs.egg-info
|
||||
dist
|
26
README.md
26
README.md
|
@ -1,6 +1,9 @@
|
|||
# costs
|
||||
# Cerc costs
|
||||
|
||||
This module processes the object-oriented generalization for the cost workflow
|
||||
Uses the cerc-hub as a base for cost calculation, it's intended to be used after executing the complete monthly energy
|
||||
balance workflow called building by building
|
||||
|
||||
This module processes the object-oriented generalization to be used the cost workflow
|
||||
|
||||
# installation
|
||||
|
||||
|
@ -8,4 +11,21 @@ This module processes the object-oriented generalization for the cost workflow
|
|||
|
||||
# usage
|
||||
|
||||
> TBD
|
||||
> from costs.cost import Cost
|
||||
>
|
||||
> Cost(building, retrofit_scenario=[scenario]>).life_cycle
|
||||
>
|
||||
|
||||
The available scenarios are defined in the constant class as an enum
|
||||
|
||||
> # constants
|
||||
> CURRENT_STATUS = 0
|
||||
>
|
||||
> SKIN_RETROFIT = 1
|
||||
>
|
||||
> SYSTEM_RETROFIT_AND_PV = 2
|
||||
>
|
||||
> SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV = 3
|
||||
>
|
||||
> RETROFITTING_SCENARIOS = [CURRENT_STATUS, SKIN_RETROFIT, SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV]
|
||||
>
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: cerc-costs
|
||||
Version: 0.1.0.0
|
||||
Summary: CERC costs contains the basic cost calculation per CERC-Hub building
|
||||
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
|
||||
CERC costs contains the basic cost calculation per CERC-Hub building
|
|
@ -1,20 +0,0 @@
|
|||
pyproject.toml
|
||||
requirements.txt
|
||||
setup.py
|
||||
cerc_costs.egg-info/PKG-INFO
|
||||
cerc_costs.egg-info/SOURCES.txt
|
||||
cerc_costs.egg-info/dependency_links.txt
|
||||
cerc_costs.egg-info/requires.txt
|
||||
cerc_costs.egg-info/top_level.txt
|
||||
costs/__init__.py
|
||||
costs/__main__.py
|
||||
costs/capital_costs.py
|
||||
costs/configuration.py
|
||||
costs/constants.py
|
||||
costs/cost.py
|
||||
costs/cost_base.py
|
||||
costs/end_of_life_costs.py
|
||||
costs/total_maintenance_costs.py
|
||||
costs/total_operational_costs.py
|
||||
costs/total_operational_incomes.py
|
||||
costs/version.py
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
numpy_financial
|
||||
cerc_hub
|
||||
pandas
|
||||
setuptools
|
|
@ -1 +0,0 @@
|
|||
costs
|
|
@ -1,4 +0,0 @@
|
|||
# Cerc costs
|
||||
|
||||
Uses the cerc-hub as a base for cost calculation, it's intended to be used after executing the complete monthly energy
|
||||
balance workflow called building by building
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Cost workflow initialization
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
from .capital_costs import CapitalCosts
|
||||
from .end_of_life_costs import EndOfLifeCosts
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Costs Workflow
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Copyright © 2023 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Capital costs module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import math
|
||||
|
||||
|
@ -35,9 +39,9 @@ class CapitalCosts(CostBase):
|
|||
dtype='float'
|
||||
)
|
||||
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = 0
|
||||
self._yearly_capital_costs.loc[0]['B2020_transparent'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'B2020_transparent'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = 0
|
||||
self._yearly_capital_costs.loc[0]['B10_superstructure'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'B10_superstructure'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = 0
|
||||
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = 0
|
||||
|
@ -77,8 +81,7 @@ class CapitalCosts(CostBase):
|
|||
capital_cost_other_hvac_ahu = 0
|
||||
capital_cost_lighting = 0
|
||||
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
if thermal_boundary.type == 'Ground':
|
||||
surface_ground += thermal_boundary.opaque_area
|
||||
|
@ -104,9 +107,9 @@ class CapitalCosts(CostBase):
|
|||
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
|
||||
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
|
||||
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = capital_cost_opaque * own_capital
|
||||
self._yearly_capital_costs.loc[0]['B2020_transparent'] = capital_cost_transparent * own_capital
|
||||
self._yearly_capital_costs.loc[0, 'B2020_transparent'] = capital_cost_transparent * own_capital
|
||||
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = capital_cost_roof * own_capital
|
||||
self._yearly_capital_costs.loc[0]['B10_superstructure'] = capital_cost_ground * own_capital
|
||||
self._yearly_capital_costs.loc[0, 'B10_superstructure'] = capital_cost_ground * own_capital
|
||||
|
||||
if self._configuration.retrofit_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
||||
chapter = self._capital_costs_chapter.chapter('D_services')
|
||||
|
@ -116,7 +119,7 @@ class CapitalCosts(CostBase):
|
|||
capital_cost_distribution_equipment = peak_cooling * chapter.item('D3040_distribution_systems').initial_investment[0]
|
||||
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
||||
capital_cost_lighting = self._total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
||||
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system'] = capital_cost_pv
|
||||
self._yearly_capital_costs.loc[0, 'D301010_photovoltaic_system'] = capital_cost_pv
|
||||
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = capital_cost_heating_equipment * own_capital
|
||||
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = capital_cost_cooling_equipment * own_capital
|
||||
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = capital_cost_distribution_equipment * own_capital
|
||||
|
@ -216,7 +219,7 @@ class CapitalCosts(CostBase):
|
|||
|
||||
if self._configuration.retrofit_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
||||
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
||||
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] += (
|
||||
self._yearly_capital_costs.loc[year, 'D301010_photovoltaic_system'] += (
|
||||
surface_pv * chapter.item('D301010_photovoltaic_system').reposition[0] * costs_increase
|
||||
)
|
||||
capital_cost_skin = capital_cost_opaque + capital_cost_ground + capital_cost_transparent + capital_cost_roof
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Configuration module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
from hub.catalog_factories.costs_catalog_factory import CostsCatalogFactory
|
||||
from hub.catalog_factories.catalog import Catalog
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Constants module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
|
||||
# constants
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
"""
|
||||
Cost module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import datetime
|
||||
|
||||
import pandas as pd
|
||||
import numpy_financial as npf
|
||||
from hub.city_model_structure.building import Building
|
||||
|
@ -58,13 +64,6 @@ class Cost:
|
|||
"""
|
||||
return self._building
|
||||
|
||||
@building.setter
|
||||
def building(self, value: Building):
|
||||
"""
|
||||
Set current building.
|
||||
"""
|
||||
self._building = value
|
||||
|
||||
def _npv_from_list(self, list_cashflow):
|
||||
return npf.npv(self._configuration.discount_rate, list_cashflow)
|
||||
|
||||
|
@ -80,7 +79,6 @@ class Cost:
|
|||
global_operational_costs = TotalOperationalCosts(self._building, self._configuration).calculate()
|
||||
global_maintenance_costs = TotalMaintenanceCosts(self._building, self._configuration).calculate()
|
||||
global_operational_incomes = TotalOperationalIncomes(self._building, self._configuration).calculate()
|
||||
|
||||
df_capital_costs_skin = (
|
||||
global_capital_costs['B2010_opaque_walls'] +
|
||||
global_capital_costs['B2020_transparent'] +
|
||||
|
@ -94,10 +92,9 @@ class Cost:
|
|||
global_capital_costs['D5020_lighting_and_branch_wiring'] +
|
||||
global_capital_costs['D301010_photovoltaic_system']
|
||||
)
|
||||
|
||||
df_end_of_life_costs = global_end_of_life_costs['End_of_life_costs']
|
||||
df_operational_costs = (
|
||||
global_operational_costs['Fixed_costs_electricity_peak'] +
|
||||
global_operational_costs['Fixed_costs_electricity_monthly'] +
|
||||
global_operational_costs['Fixed_costs_electricity_peak'] +
|
||||
global_operational_costs['Fixed_costs_electricity_monthly'] +
|
||||
global_operational_costs['Variable_costs_electricity'] +
|
||||
|
@ -131,15 +128,28 @@ class Cost:
|
|||
life_cycle_operational_costs,
|
||||
life_cycle_maintenance_costs,
|
||||
life_cycle_operational_incomes,
|
||||
life_cycle_capital_incomes
|
||||
life_cycle_capital_incomes,
|
||||
global_capital_costs,
|
||||
global_capital_incomes,
|
||||
global_end_of_life_costs,
|
||||
global_operational_costs,
|
||||
global_maintenance_costs,
|
||||
global_operational_incomes
|
||||
]
|
||||
|
||||
results.index = ['total_capital_costs_skin',
|
||||
results.index = [
|
||||
'total_capital_costs_skin',
|
||||
'total_capital_costs_systems',
|
||||
'end_of_life_costs',
|
||||
'total_operational_costs',
|
||||
'total_maintenance_costs',
|
||||
'operational_incomes',
|
||||
'capital_incomes']
|
||||
|
||||
'capital_incomes',
|
||||
'global_capital_costs',
|
||||
'global_capital_incomes',
|
||||
'global_end_of_life_costs',
|
||||
'global_operational_costs',
|
||||
'global_maintenance_costs',
|
||||
'global_operational_incomes'
|
||||
]
|
||||
return results
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Cost base module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
|
||||
from hub.city_model_structure.building import Building
|
||||
|
@ -15,8 +19,7 @@ class CostBase:
|
|||
self._building = building
|
||||
self._configuration = configuration
|
||||
self._total_floor_area = 0
|
||||
for internal_zone in building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
for thermal_zone in building.thermal_zones_from_internal_zones:
|
||||
self._total_floor_area += thermal_zone.total_floor_area
|
||||
self._archetype = None
|
||||
self._capital_costs_chapter = None
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
End of life costs module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import math
|
||||
import pandas as pd
|
||||
|
|
|
@ -1,52 +1,56 @@
|
|||
"""
|
||||
Peak load module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
|
||||
import hub.helpers.constants as cte
|
||||
|
||||
|
||||
class PeakLoad:
|
||||
"""
|
||||
Peak load class
|
||||
"""
|
||||
|
||||
def __init__(self, building):
|
||||
self._building = building
|
||||
|
||||
@property
|
||||
def electricity_peak_load(self):
|
||||
"""
|
||||
Get the electricity peak load in W
|
||||
"""
|
||||
array = [None] * 12
|
||||
heating = 0
|
||||
cooling = 0
|
||||
for system in self._building.energy_systems:
|
||||
for demand_type in system.demand_types:
|
||||
if demand_type == cte.HEATING:
|
||||
if cte.HEATING in system.demand_types:
|
||||
heating = 1
|
||||
if demand_type == cte.COOLING:
|
||||
if cte.COOLING in system.demand_types:
|
||||
cooling = 1
|
||||
if cte.MONTH in self._building.heating_peak_load.keys() and cte.MONTH in self._building.cooling_peak_load.keys():
|
||||
peak_lighting = 0
|
||||
peak_appliances = 0
|
||||
for thermal_zone in self._building.internal_zones[0].thermal_zones:
|
||||
lighting = thermal_zone.lighting
|
||||
for schedule in lighting.schedules:
|
||||
for value in schedule.values:
|
||||
if value * lighting.density * thermal_zone.total_floor_area > peak_lighting:
|
||||
peak_lighting = value * lighting.density * thermal_zone.total_floor_area
|
||||
appliances = thermal_zone.appliances
|
||||
for schedule in appliances.schedules:
|
||||
for value in schedule.values:
|
||||
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
||||
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
||||
|
||||
peak_lighting = self._building.lighting_peak_load[cte.YEAR][0]
|
||||
peak_appliances = self._building.appliances_peak_load[cte.YEAR][0]
|
||||
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
||||
conditioning_peak = []
|
||||
for i, value in enumerate(self._building.heating_peak_load[cte.MONTH]):
|
||||
if cooling * self._building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
||||
conditioning_peak.append(cooling * self._building.cooling_peak_load[cte.MONTH][i])
|
||||
conditioning_peak = max(self._building.heating_peak_load[cte.MONTH], self._building.cooling_peak_load[cte.MONTH])
|
||||
for i in range(len(conditioning_peak)):
|
||||
if cooling == 1 and heating == 1:
|
||||
conditioning_peak[i] = conditioning_peak[i]
|
||||
continue
|
||||
elif cooling == 0:
|
||||
conditioning_peak[i] = self._building.heating_peak_load[cte.MONTH][i] * heating
|
||||
else:
|
||||
conditioning_peak.append(heating * value)
|
||||
conditioning_peak[i] = self._building.cooling_peak_load[cte.MONTH][i] * cooling
|
||||
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
||||
|
||||
electricity_peak_load_results = pd.DataFrame(
|
||||
monthly_electricity_peak,
|
||||
columns=[f'{self._building.name} electricity peak load W']
|
||||
columns=[f'electricity peak load W']
|
||||
)
|
||||
else:
|
||||
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{self._building.name} electricity peak load W'])
|
||||
|
||||
electricity_peak_load_results = pd.DataFrame(array, columns=[f'electricity peak load W'])
|
||||
return electricity_peak_load_results
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Total maintenance costs module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import math
|
||||
import pandas as pd
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Total operational costs module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import math
|
||||
import pandas as pd
|
||||
|
@ -16,6 +20,7 @@ class TotalOperationalCosts(CostBase):
|
|||
"""
|
||||
End of life costs class
|
||||
"""
|
||||
|
||||
def __init__(self, building: Building, configuration: Configuration):
|
||||
super().__init__(building, configuration)
|
||||
self._yearly_operational_costs = pd.DataFrame(
|
||||
|
@ -30,7 +35,6 @@ class TotalOperationalCosts(CostBase):
|
|||
dtype='float'
|
||||
)
|
||||
|
||||
|
||||
def calculate(self) -> pd.DataFrame:
|
||||
"""
|
||||
Calculate total operational costs
|
||||
|
@ -45,19 +49,20 @@ class TotalOperationalCosts(CostBase):
|
|||
variable_gas_cost_year_0 = 0
|
||||
electricity_heating = 0
|
||||
domestic_hot_water_electricity = 0
|
||||
# todo: each fuel has different units that have to be processed
|
||||
if self._configuration.fuel_type == 1:
|
||||
fixed_gas_cost_year_0 = archetype.operational_cost.fuels[1].fixed_monthly * 12 * factor_residential
|
||||
variable_gas_cost_year_0 = (
|
||||
(building.heating_consumption[cte.YEAR][0] + building.domestic_hot_water_consumption[cte.YEAR][0]) / 1000 *
|
||||
archetype.operational_cost.fuels[1].variable[0]
|
||||
(building.heating_consumption[cte.YEAR][0] + building.domestic_hot_water_consumption[cte.YEAR][0])
|
||||
/ (1000 * cte.WATTS_HOUR_TO_JULES) * archetype.operational_cost.fuels[1].variable[0]
|
||||
)
|
||||
if self._configuration.fuel_type == 0:
|
||||
electricity_heating = building.heating_consumption[cte.YEAR][0] / 1000
|
||||
domestic_hot_water_electricity = building.domestic_hot_water_consumption[cte.YEAR][0] / 1000
|
||||
|
||||
electricity_cooling = building.cooling_consumption[cte.YEAR][0] / 1000
|
||||
electricity_lighting = building.lighting_electrical_demand[cte.YEAR]['insel meb'] / 1000
|
||||
electricity_plug_loads = building.appliances_electrical_demand[cte.YEAR]['insel meb'] / 1000
|
||||
electricity_lighting = building.lighting_electrical_demand[cte.YEAR][0] / 1000
|
||||
electricity_plug_loads = building.appliances_electrical_demand[cte.YEAR][0] / 1000
|
||||
electricity_distribution = 0
|
||||
total_electricity_consumption = (
|
||||
electricity_heating + electricity_cooling + electricity_lighting + domestic_hot_water_electricity +
|
||||
|
@ -67,8 +72,10 @@ class TotalOperationalCosts(CostBase):
|
|||
# todo: change when peak electricity demand is coded. Careful with factor residential
|
||||
peak_electricity_load = PeakLoad(building).electricity_peak_load
|
||||
peak_load_value = peak_electricity_load.max(axis=1)
|
||||
peak_electricity_demand = peak_load_value[1]/1000 # self._peak_electricity_demand adapted to kW
|
||||
variable_electricity_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
||||
peak_electricity_demand = peak_load_value[1] / 1000 # self._peak_electricity_demand adapted to kW
|
||||
variable_electricity_cost_year_0 = (
|
||||
total_electricity_consumption / cte.WATTS_HOUR_TO_JULES * archetype.operational_cost.fuels[0].variable[0]
|
||||
)
|
||||
peak_electricity_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
||||
monthly_electricity_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * factor_residential
|
||||
|
||||
|
@ -82,8 +89,12 @@ class TotalOperationalCosts(CostBase):
|
|||
self._yearly_operational_costs.at[year, 'Fixed_costs_electricity_monthly'] = (
|
||||
monthly_electricity_cost_year_0 * price_increase_peak_electricity
|
||||
)
|
||||
if not isinstance(variable_electricity_cost_year_0, pd.DataFrame):
|
||||
variable_costs_electricity = variable_electricity_cost_year_0 * price_increase_electricity
|
||||
else:
|
||||
variable_costs_electricity = float(variable_electricity_cost_year_0.iloc[0] * price_increase_electricity)
|
||||
self._yearly_operational_costs.at[year, 'Variable_costs_electricity'] = (
|
||||
float(variable_electricity_cost_year_0.iloc[0] * price_increase_electricity)
|
||||
variable_costs_electricity
|
||||
)
|
||||
self._yearly_operational_costs.at[year, 'Fixed_costs_gas'] = fixed_gas_cost_year_0 * price_increase_gas
|
||||
self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = (
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"""
|
||||
Total operational incomes module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
import math
|
||||
import pandas as pd
|
||||
|
@ -24,15 +28,16 @@ class TotalOperationalIncomes(CostBase):
|
|||
:return: pd.DataFrame
|
||||
"""
|
||||
building = self._building
|
||||
archetype = self._archetype
|
||||
if cte.YEAR not in building.onsite_electrical_production:
|
||||
onsite_electricity_production = 0
|
||||
else:
|
||||
onsite_electricity_production = building.onsite_electrical_production[cte.YEAR][0] / 1000
|
||||
onsite_electricity_production = building.onsite_electrical_production[cte.YEAR][0]
|
||||
|
||||
for year in range(1, self._configuration.number_of_years + 1):
|
||||
price_increase_electricity = math.pow(1 + self._configuration.electricity_price_index, year)
|
||||
# todo: check the adequate assignation of price. Pilar
|
||||
price_export = 0.075 # archetype.income.electricity_export
|
||||
price_export = archetype.income.electricity_export * cte.WATTS_HOUR_TO_JULES * 1000 # to account for unit change
|
||||
self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = (
|
||||
onsite_electricity_production * price_export * price_increase_electricity
|
||||
)
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
"""
|
||||
Cost version number
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
__version__ = '0.1.0.0'
|
||||
__version__ = '0.1.0.6'
|
||||
|
|
BIN
dist/cerc-costs-0.1.0.0.tar.gz
vendored
BIN
dist/cerc-costs-0.1.0.0.tar.gz
vendored
Binary file not shown.
BIN
dist/cerc_costs-0.1.0.0-py3-none-any.whl
vendored
BIN
dist/cerc_costs-0.1.0.0-py3-none-any.whl
vendored
Binary file not shown.
|
@ -1,121 +0,0 @@
|
|||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 2864,
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
-73.55628837310991,
|
||||
45.60732526295055
|
||||
],
|
||||
[
|
||||
-73.55628287285629,
|
||||
45.607324262904456
|
||||
],
|
||||
[
|
||||
-73.55609247288925,
|
||||
45.607288563416546
|
||||
],
|
||||
[
|
||||
-73.55607107262188,
|
||||
45.60734486277528
|
||||
],
|
||||
[
|
||||
-73.55612487276466,
|
||||
45.60735496306114
|
||||
],
|
||||
[
|
||||
-73.55609867281544,
|
||||
45.60742366317157
|
||||
],
|
||||
[
|
||||
-73.55624087271804,
|
||||
45.60745026331904
|
||||
],
|
||||
[
|
||||
-73.55628837310991,
|
||||
45.60732526295055
|
||||
]
|
||||
]
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"OBJECTID_12_13": 2864,
|
||||
"ID_UEV": "02033771",
|
||||
"CIVIQUE_DE": " 8212",
|
||||
"CIVIQUE_FI": " 8212",
|
||||
"NOM_RUE": "avenue Peterborough (ANJ)",
|
||||
"SUITE_DEBU": " ",
|
||||
"MUNICIPALI": "50",
|
||||
"ETAGE_HORS": 1,
|
||||
"NOMBRE_LOG": 1,
|
||||
"ANNEE_CONS": 1960,
|
||||
"CODE_UTILI": "1000",
|
||||
"LETTRE_DEB": " ",
|
||||
"LETTRE_FIN": " ",
|
||||
"LIBELLE_UT": "Logement",
|
||||
"CATEGORIE_": "R\u00c3\u00a9gulier",
|
||||
"MATRICULE8": "0051-49-2041-2-000-0000",
|
||||
"SUPERFICIE": 450,
|
||||
"SUPERFIC_1": 176,
|
||||
"NO_ARROND_": "REM09",
|
||||
"Shape_Leng": 0.000666191644361,
|
||||
"OBJECTID": 2864,
|
||||
"Join_Count": 1,
|
||||
"TARGET_FID": 2864,
|
||||
"feature_id": "bdd1f0fe-89de-46d2-80dc-87d3636df60a",
|
||||
"md_id": " ",
|
||||
"acqtech": 1360,
|
||||
"acqtech_en": "Lidar",
|
||||
"acqtech_fr": "Lidar",
|
||||
"provider": 461,
|
||||
"provideren": "Municipal",
|
||||
"providerfr": "Municipal",
|
||||
"datemin": "20151124",
|
||||
"datemax": "20151208",
|
||||
"haccmin": 2,
|
||||
"haccmax": 2,
|
||||
"vaccmin": 1,
|
||||
"vaccmax": 1,
|
||||
"heightmin": 1.17,
|
||||
"heightmax": 7.5,
|
||||
"elevmin": 45.48,
|
||||
"elevmax": 45.96,
|
||||
"bldgarea": 193.18,
|
||||
"comment": " ",
|
||||
"OBJECTID_1": 2864,
|
||||
"Shape_Le_1": 0.000666191644361,
|
||||
"Shape_Ar_1": 2.22753099997e-08,
|
||||
"OBJECTID_12": 2864,
|
||||
"Join_Count_1": 1,
|
||||
"TARGET_FID_1": 2863,
|
||||
"g_objectid": "897744",
|
||||
"g_co_mrc": "66023",
|
||||
"g_code_mun": "66023",
|
||||
"g_arrond": "REM09",
|
||||
"g_anrole": "2019",
|
||||
"g_usag_pre": "R\u00c3\u00a9sidentiel",
|
||||
"g_no_lot": "1113400",
|
||||
"g_nb_poly_": "1",
|
||||
"g_utilisat": "1000",
|
||||
"g_nb_logem": "1",
|
||||
"g_nb_locau": " ",
|
||||
"g_descript": "Unit\u00c3\u00a9 d'\u00c3\u00a9valuation",
|
||||
"g_id_provi": "66023005149204120000000",
|
||||
"g_sup_tota": "450.1",
|
||||
"g_geometry": "0.000958907",
|
||||
"g_geomet_1": "5.20226e-008",
|
||||
"g_dat_acqu": "2020-02-12 00:00:00.0000000",
|
||||
"g_dat_char": "2020-02-17 00:00:00.0000000",
|
||||
"Shape_Leng_1": 0.000666191644361,
|
||||
"Shape_Area_1": 2.22753099997e-08,
|
||||
"Shape_Length": 0.0006661919640545334,
|
||||
"Shape_Area": 2.22753099997e-08
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
import datetime
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
|
@ -18,9 +19,15 @@ from costs.cost import Cost
|
|||
from costs.constants import SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV, SYSTEM_RETROFIT_AND_PV
|
||||
|
||||
|
||||
class UnitTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
class Initialize:
|
||||
def __init__(self):
|
||||
self._city = None
|
||||
|
||||
@property
|
||||
def city(self):
|
||||
if self._city is None:
|
||||
start = datetime.datetime.now()
|
||||
print('init tests')
|
||||
city_file = (Path(__file__).parent / 'data/test.geojson').resolve()
|
||||
output_path = (Path(__file__).parent / 'output').resolve()
|
||||
city = GeometryFactory('geojson',
|
||||
|
@ -33,38 +40,46 @@ class UnitTests(unittest.TestCase):
|
|||
UsageFactory('nrcan', city).enrich()
|
||||
ExportsFactory('sra', city, output_path).export()
|
||||
sra_file = str((output_path / f'{city.name}_sra.xml').resolve())
|
||||
subprocess.run(['sra', sra_file])
|
||||
subprocess.run(['sra', sra_file], stdout=subprocess.DEVNULL)
|
||||
ResultFactory('sra', city, output_path).enrich()
|
||||
|
||||
print(f'sra completed {datetime.datetime.now() - start}')
|
||||
for building in city.buildings:
|
||||
building.energy_systems_archetype_name = 'system 1 gas pv'
|
||||
EnergySystemsFactory('montreal_custom', city).enrich()
|
||||
print(f'energy systems completed {datetime.datetime.now() - start}')
|
||||
EnergyBuildingsExportsFactory('insel_monthly_energy_balance', city, output_path).export()
|
||||
_insel_files = glob.glob(f'{output_path}/*.insel')
|
||||
for insel_file in _insel_files:
|
||||
subprocess.run(['insel', str(insel_file)], stdout=subprocess.DEVNULL)
|
||||
print(f'insel completed {datetime.datetime.now() - start}')
|
||||
ResultFactory('insel_monthly_energy_balance', city, output_path).enrich()
|
||||
self._city = city
|
||||
print(f'init completed {datetime.datetime.now() - start}')
|
||||
return self._city
|
||||
|
||||
|
||||
class UnitTests(unittest.TestCase):
|
||||
init = Initialize()
|
||||
|
||||
def test_current_status(self):
|
||||
for building in self._city.buildings:
|
||||
for building in self.init.city.buildings:
|
||||
result = Cost(building).life_cycle
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(0, result.values[0])
|
||||
|
||||
def test_scenario_1(self):
|
||||
for building in self._city.buildings:
|
||||
for building in self.init.city.buildings:
|
||||
result = Cost(building, retrofit_scenario=SKIN_RETROFIT).life_cycle
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
def test_scenario_2(self):
|
||||
for building in self._city.buildings:
|
||||
for building in self.init.city.buildings:
|
||||
result = Cost(building, retrofit_scenario=SYSTEM_RETROFIT_AND_PV).life_cycle
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(0, result.values[0])
|
||||
|
||||
def test_scenario_3(self):
|
||||
for building in self._city.buildings:
|
||||
for building in self.init.city.buildings:
|
||||
result = Cost(building, retrofit_scenario=SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV).life_cycle
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user