pypsa-eur/scripts/build_cop_profiles/run.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
2.0 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2024-07-25 13:10:45 +00:00
# SPDX-FileCopyrightText: : 2020-2024 The PyPSA-Eur Authors
#
# SPDX-License-Identifier: MIT
2024-07-24 13:03:44 +00:00
import numpy as np
import xarray as xr
from _helpers import set_scenario_config
2024-07-24 13:03:44 +00:00
from CentralHeatingCopApproximator import CentralHeatingCopApproximator
from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
if __name__ == "__main__":
if "snakemake" not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake(
"build_cop_profiles",
simpl="",
clusters=48,
)
set_scenario_config(snakemake)
for source_type in ["air", "soil"]:
# source inlet temperature (air/soil) is based on weather data
source_inlet_temperature_celsius = xr.open_dataarray(
snakemake.input[f"temp_{source_type}_total"]
)
2024-07-24 13:03:44 +00:00
# Approximate COP for decentral (individual) heating
cop_individual_heating = DecentralHeatingCopApproximator(
forward_temperature_celsius=snakemake.params.heat_pump_sink_T_decentral_heating,
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
source_type=source_type,
2024-07-24 13:03:44 +00:00
).approximate_cop()
cop_individual_heating.to_netcdf(
snakemake.output[f"cop_{source_type}_decentral_heating"]
)
2024-07-24 13:03:44 +00:00
# Approximate COP for central (district) heating
cop_central_heating = CentralHeatingCopApproximator(
forward_temperature_celsius=snakemake.params.forward_temperature_central_heating,
return_temperature_celsius=snakemake.params.return_temperature_central_heating,
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
source_outlet_temperature_celsius=source_inlet_temperature_celsius
- snakemake.params.heat_source_cooling_central_heating,
2024-07-24 13:03:44 +00:00
).approximate_cop()
cop_central_heating.to_netcdf(
snakemake.output[f"cop_{source_type}_central_heating"]
)