costs_workflow/costs/total_operational_incomes.py

42 lines
1.5 KiB
Python
Raw Normal View History

2023-07-14 15:37:12 -04:00
"""
Total operational incomes module
"""
import math
import pandas as pd
from hub.city_model_structure.building import Building
import hub.helpers.constants as cte
2023-07-17 14:35:12 -04:00
from costs.configuration import Configuration
2023-07-14 16:39:47 -04:00
from costs.cost_base import CostBase
2023-07-14 15:37:12 -04:00
2023-07-14 16:39:47 -04:00
class TotalOperationalIncomes(CostBase):
2023-07-14 15:37:12 -04:00
"""
Total operational incomes class
"""
def __init__(self, building: Building, configuration: Configuration):
2023-07-14 16:39:47 -04:00
super().__init__(building, configuration)
self._yearly_operational_incomes = pd.DataFrame(index=self._rng, columns=['Incomes electricity'], dtype='float')
2023-07-14 15:37:12 -04:00
def calculate(self) -> pd.DataFrame:
"""
Calculate total operational incomes
:return: pd.DataFrame
"""
building = self._building
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
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
self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = (
onsite_electricity_production * price_export * price_increase_electricity
)
self._yearly_operational_incomes.fillna(0, inplace=True)
return self._yearly_operational_incomes