From 3dddcc039fa07c8099e8f6d8762bd085facd0654 Mon Sep 17 00:00:00 2001 From: Mathias157 Date: Mon, 23 Sep 2024 17:37:53 +0200 Subject: [PATCH] Loaded electricity profile from industry as IND-PHH profile --- src/Modules/exo_heat_demand.py | 27 ++++++++++++++++++++++----- src/snakefile | 8 +++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/Modules/exo_heat_demand.py b/src/Modules/exo_heat_demand.py index cf16bbc..d5ffb9a 100644 --- a/src/Modules/exo_heat_demand.py +++ b/src/Modules/exo_heat_demand.py @@ -195,7 +195,7 @@ def create_INDIVUSERS_DH(incfile, new_dataset: xr.Dataset): ## 2.3.2 INDUSTRY_DH_VAR_T.inc @create_incfile def create_INDUSTRY_DH_VAR_T(incfile): - incfile.body = """* Assume that heat demand profile of industry correlates exactly to electricity demand profile + incfile.body = f"""* Assume that heat demand profile of industry correlates exactly to electricity demand profile DH_VAR_T(AAA,'IND-PHH',SSS,TTT)$(SUM((S,T), DE_VAR_T(RRR,'PII',SSS,TTT))) = DE_VAR_T(RRR,'PII',SSS,TTT); DH_VAR_T(AAA,'IND-PHM',SSS,TTT)$(SUM((S,T), DE_VAR_T(RRR,'PII',SSS,TTT))) = DE_VAR_T(RRR,'PII',SSS,TTT); DH_VAR_T(AAA,'IND-PHL',SSS,TTT)$(SUM((S,T), DE_VAR_T(RRR,'PII',SSS,TTT))) = DE_VAR_T(RRR,'PII',SSS,TTT); @@ -211,9 +211,11 @@ def main(show_difference: bool = False): # 3.1 Format Dataset conversion_file = 'Modules/Submodules/exo_heat_dem_conversion_dictionaries.pkl' + + ## 3.1.1 Heat Demand dataset, new_dataset = convert_names(conversion_file, dataset, 'heat_demand_mwh') - ## Drop dimensions + ### Drop dimensions new_dataset = ( new_dataset .drop_dims(['lat', 'lon']) @@ -221,12 +223,27 @@ def main(show_difference: bool = False): ) if show_difference: + print('###\nHeat Dataset\n###') print('Before: \n', dataset, '\n\n') print('After: \n', new_dataset, '\n\n') + + ## 3.1.2 Electricity Profile for Industry + eldem = ( + xr.load_dataset('Data/Timeseries/energinet_eldem.nc') + .sel(user='industry') + .assign_coords(user='industry_phh') + .rename({'week' : 'S', 'hour' : 'T'}) + ) + eldataset, el_new_dataset = convert_names(conversion_file, eldem, 'electricity_demand_mwh', convert_seasons_and_terms=True) + + if show_difference: + print('###\nElectricity Dataset\n###') + print('Before: \n', eldataset, '\n\n') + print('After: \n', el_new_dataset, '\n\n') + - out_path = 'Output' - # 3.2 Create .inc files + out_path = 'Output' ## 3.2.1 DH.inc create_DH(new_dataset=new_dataset, name='DH', path=out_path, prefix="""* Data from Varmeplan 2021 (AAU) @@ -280,4 +297,4 @@ def main(show_difference: bool = False): if __name__ == '__main__': - main() \ No newline at end of file + main(show_difference=False) \ No newline at end of file diff --git a/src/snakefile b/src/snakefile index abeaafe..b3bfd59 100644 --- a/src/snakefile +++ b/src/snakefile @@ -18,11 +18,9 @@ rule create_conversion_dictionaries: output: [f"{submod_path}exo_elec_dem_conversion_dictionaries.pkl", f"{submod_path}exo_heat_dem_conversion_dictionaries.pkl"] - shell: - f""" - python {submod_path}create_conversion_dictionaries.py - """ - + script: + f"{submod_path}create_conversion_dictionaries.py" + rule get_grid_from_Balmorel: output: f"{data_path}Power Grid/municipal_connectivity.nc"