Skip to content

Commit

Permalink
Loaded electricity profile from industry as IND-PHH profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias157 committed Sep 23, 2024
1 parent 11a34af commit 3dddcc0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
27 changes: 22 additions & 5 deletions src/Modules/exo_heat_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -211,22 +211,39 @@ 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'])
.drop_vars('polygons')
)

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)
Expand Down Expand Up @@ -280,4 +297,4 @@ def main(show_difference: bool = False):


if __name__ == '__main__':
main()
main(show_difference=False)
8 changes: 3 additions & 5 deletions src/snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3dddcc0

Please sign in to comment.