Skip to content

Commit

Permalink
Some formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias157 committed Sep 24, 2024
1 parent b5a2ed0 commit dec82d7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
52 changes: 24 additions & 28 deletions src/Modules/exo_electricity_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@
### ------------------------------- ###

import matplotlib.pyplot as plt
import pandas as pd
import textwrap
import numpy as np
import click
import pickle
from Submodules.utils import convert_names, transform_xrdata
import xarray as xr
from typing import Tuple
from pybalmorel import IncFile
from Submodules.municipal_template import DataContainer
from Submodules.utils import convert_coordname_elements
import matplotlib
try:
import cmcrameri
Expand Down Expand Up @@ -85,16 +78,18 @@ def main(conversion_file: str,
# 1.2 Make .inc-files
out_path = 'Output'
## 1.2.1 DE
DE = IncFile(name='DE',
prefix=textwrap.dedent("""* Data from Energinet Dataservice 2023
TABLE DE1(RRR,DEUSER,YYY) 'Annual electricity consumption (MWh)'
"""),
suffix=textwrap.dedent(""";
DE(YYY,RRR,DEUSER)=DE1(RRR,DEUSER,YYY);
DE('2050',RRR,DEUSER) = DE('2023', RRR, DEUSER);
DE1(RRR,DEUSER,YYY) = 0;
"""),
path=out_path
DE = IncFile(name='DE', path=out_path,
prefix='\n'.join([
"* Data from Energinet Dataservice 2023",
"TABLE DE1(RRR,DEUSER,YYY) 'Annual electricity consumption (MWh)'",
"",
]),
suffix='\n'.join([
";",
"DE(YYY,RRR,DEUSER)=DE1(RRR,DEUSER,YYY);",
"DE('2050',RRR,DEUSER) = DE('2023', RRR, DEUSER);",
"DE1(RRR,DEUSER,YYY) = 0;",
])
)
### Sum to annual electricity demands
DE.body = (
Expand All @@ -109,17 +104,18 @@ def main(conversion_file: str,
DE.save()

## 1.2.2 DE_VAR_T
DE_VAR_T = IncFile(name='DE_VAR_T',
prefix=textwrap.dedent("""
* Data from Energinet Dataservice 2023
TABLE DE_VAR_T1(DEUSER,SSS,TTT,RRR) "Variation in electricity demand"
"""),
suffix=textwrap.dedent("""
;
PARAMETER DE_VAR_T(RRR,DEUSER,SSS,TTT) "Variation in electricity demand";
DE_VAR_T(RRR,DEUSER,SSS,TTT) = DE_VAR_T1(DEUSER,SSS,TTT,RRR);
"""),
path=out_path)
DE_VAR_T = IncFile(name='DE_VAR_T', path=out_path,
prefix='\n'.join(["* Data from Energinet Dataservice 2023",
"TABLE DE_VAR_T1(DEUSER,SSS,TTT,RRR) 'Variation in electricity demand'",
"",
]),
suffix='\n'.join(["",
";",
"PARAMETER DE_VAR_T(RRR,DEUSER,SSS,TTT) 'Variation in electricity demand';",
"DE_VAR_T(RRR,DEUSER,SSS,TTT) = DE_VAR_T1(DEUSER,SSS,TTT,RRR); ",
"DE_VAR_T1(DEUSER,SSS,TTT,RRR) = 0;"
]),
)
DE_VAR_T.body = (
transform_xrdata(new_dataset,
'electricity_demand_mwh')
Expand Down
21 changes: 10 additions & 11 deletions src/Modules/exo_heat_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,17 @@ def main(show_difference: bool = False):
create_INDUSTRY_DH_VAR_T(el_new_dataset=el_new_dataset,
name='INDUSTRY_DH_VAR_T',
path=out_path,
prefix="""TABLE DH_VAR_T_IND(SSS,TTT,AAA,DHUSER)\n""",
suffix="""\n;\n* Collect series to other heat series, if there is a industry heat series
DH_VAR_T(AAA,DHUSER,SSS,TTT)$(SUM((S,T), DH_VAR_T_IND(S,T,AAA,DHUSER))) = DH_VAR_T_IND(SSS,TTT,AAA,DHUSER);
DH_VAR_T_IND(SSS,TTT,AAA,DHUSER)=0;
prefix="TABLE DH_VAR_T_IND(SSS,TTT,AAA,DHUSER)\n",
suffix='\n'.join(["",
";",
"* Collect series to other heat series, if there is a industry heat series",
"DH_VAR_T(AAA,DHUSER,SSS,TTT)$(SUM((S,T), DH_VAR_T_IND(S,T,AAA,DHUSER))) = DH_VAR_T_IND(SSS,TTT,AAA,DHUSER);",
"DH_VAR_T_IND(SSS,TTT,AAA,DHUSER)=0;",
"* Assume that other temperature processes follow the same pattern, if there is a profile",
"DH_VAR_T(AAA,'IND-PHM',SSS,TTT)$(SUM((S,T), DH_VAR_T(AAA,'IND-PHH',SSS,TTT))) = DH_VAR_T(AAA,'IND-PHH',SSS,TTT);",
"DH_VAR_T(AAA,'IND-PHL',SSS,TTT)$(SUM((S,T), DH_VAR_T(AAA,'IND-PHH',SSS,TTT))) = DH_VAR_T(AAA,'IND-PHH',SSS,TTT);",
]))

* Assume that other temperature processes follow the same pattern, if there is a profile
DH_VAR_T(AAA,'IND-PHM',SSS,TTT)$(SUM((S,T), DH_VAR_T(AAA,'IND-PHH',SSS,TTT))) = DH_VAR_T(AAA,'IND-PHH',SSS,TTT);
DH_VAR_T(AAA,'IND-PHL',SSS,TTT)$(SUM((S,T), DH_VAR_T(AAA,'IND-PHH',SSS,TTT))) = DH_VAR_T(AAA,'IND-PHH',SSS,TTT);
""")




if __name__ == '__main__':
main(show_difference=False)

0 comments on commit dec82d7

Please sign in to comment.