Skip to content

Commit

Permalink
refactor: streamline if-else condition
Browse files Browse the repository at this point in the history
  • Loading branch information
energyLS committed Nov 21, 2024
1 parent 0c4987b commit 0d67965
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions scripts/add_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,7 @@ def add_export(n, hydrogen_buses_ports, export_profile):
elif snakemake.params.store == False:
pass

if snakemake.params.export_endogenous == False:
# add load
n.add(
"Load",
"H2 export load",
bus="H2 export bus",
carrier="H2",
p_set=export_profile,
)
elif snakemake.params.export_endogenous == True:
if snakemake.params.export_endogenous:
# add endogenous export by implementing a negative generation
n.add(
"Generator",
Expand All @@ -151,8 +142,13 @@ def add_export(n, hydrogen_buses_ports, export_profile):
)

else:
logger.error(
f"Value {snakemake.params.export_endogenous} for ['export']['export_endogenous'] is not valid"
# add exogenous export by implementing a load
n.add(
"Load",
"H2 export load",
bus="H2 export bus",
carrier="H2",
p_set=export_profile,
)

return
Expand Down

0 comments on commit 0d67965

Please sign in to comment.