Changed hardcoded electricity peak and hardcoded electricity income. Incorporated new function to calculate peak electricity loads in operational costs
This commit is contained in:
parent
3c8e291942
commit
ebd5241ff0
@ -2,7 +2,7 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="hub" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PyDocumentationSettings">
|
<component name="PyDocumentationSettings">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="costs_workflow" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="hub" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
@ -11,6 +11,48 @@ from costs.configuration import Configuration
|
|||||||
from costs.cost_base import CostBase
|
from costs.cost_base import CostBase
|
||||||
|
|
||||||
|
|
||||||
|
def Peak_load(building):
|
||||||
|
array = [None] * 12
|
||||||
|
heating = 0
|
||||||
|
cooling = 0
|
||||||
|
for system in building.energy_systems:
|
||||||
|
for demand_type in system.demand_types:
|
||||||
|
if demand_type == cte.HEATING:
|
||||||
|
heating = 1
|
||||||
|
if demand_type == cte.COOLING:
|
||||||
|
cooling = 1
|
||||||
|
if cte.MONTH in building.heating_peak_load.keys() and cte.MONTH in building.cooling_peak_load.keys():
|
||||||
|
peak_lighting = 0
|
||||||
|
peak_appliances = 0
|
||||||
|
for thermal_zone in 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
|
||||||
|
|
||||||
|
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
||||||
|
conditioning_peak = []
|
||||||
|
for i, value in enumerate(building.heating_peak_load[cte.MONTH]):
|
||||||
|
if cooling * building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
||||||
|
conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][i])
|
||||||
|
else:
|
||||||
|
conditioning_peak.append(heating * value)
|
||||||
|
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
||||||
|
|
||||||
|
electricity_peak_load_results = pd.DataFrame(monthly_electricity_peak
|
||||||
|
, columns=[f'{building.name} electricity peak load W'])
|
||||||
|
else:
|
||||||
|
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W'])
|
||||||
|
|
||||||
|
return electricity_peak_load_results
|
||||||
|
|
||||||
|
|
||||||
class TotalOperationalCosts(CostBase):
|
class TotalOperationalCosts(CostBase):
|
||||||
"""
|
"""
|
||||||
End of life costs class
|
End of life costs class
|
||||||
@ -29,6 +71,7 @@ class TotalOperationalCosts(CostBase):
|
|||||||
dtype='float'
|
dtype='float'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def calculate(self) -> pd.DataFrame:
|
def calculate(self) -> pd.DataFrame:
|
||||||
"""
|
"""
|
||||||
Calculate total operational costs
|
Calculate total operational costs
|
||||||
@ -63,7 +106,9 @@ class TotalOperationalCosts(CostBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# todo: change when peak electricity demand is coded. Careful with factor residential
|
# todo: change when peak electricity demand is coded. Careful with factor residential
|
||||||
peak_electricity_demand = 100 # self._peak_electricity_demand
|
peak_electricity_load = Peak_load(building)
|
||||||
|
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]
|
variable_electricity_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
||||||
peak_electricity_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
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
|
monthly_electricity_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * factor_residential
|
||||||
|
@ -20,8 +20,8 @@ from costs.constants import SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND
|
|||||||
|
|
||||||
class UnitTests(unittest.TestCase):
|
class UnitTests(unittest.TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
city_file = Path("./tests/data/test.geojson").resolve()
|
city_file = Path("./data/test.geojson").resolve()
|
||||||
output_path = Path('./tests/output/').resolve()
|
output_path = Path('./output/').resolve()
|
||||||
city = GeometryFactory('geojson',
|
city = GeometryFactory('geojson',
|
||||||
city_file,
|
city_file,
|
||||||
height_field='citygml_me',
|
height_field='citygml_me',
|
||||||
@ -32,7 +32,7 @@ class UnitTests(unittest.TestCase):
|
|||||||
UsageFactory('nrcan', city).enrich()
|
UsageFactory('nrcan', city).enrich()
|
||||||
ExportsFactory('sra', city, output_path).export()
|
ExportsFactory('sra', city, output_path).export()
|
||||||
sra_file = str((output_path / f'{city.name}_sra.xml').resolve())
|
sra_file = str((output_path / f'{city.name}_sra.xml').resolve())
|
||||||
subprocess.run(['/usr/local/bin/sra', sra_file])
|
subprocess.run(['sra', sra_file])
|
||||||
ResultFactory('sra', city, output_path).enrich()
|
ResultFactory('sra', city, output_path).enrich()
|
||||||
|
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
|
Loading…
Reference in New Issue
Block a user