Skip to content

Commit

Permalink
Merge pull request #751 from openego/features/#734-clean-up-applpy
Browse files Browse the repository at this point in the history
Features/#734 clean up applpy
  • Loading branch information
ClaraBuettner authored Sep 3, 2024
2 parents 672684a + 22f8af6 commit 6a8f978
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 29 deletions.
30 changes: 1 addition & 29 deletions etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,21 +682,6 @@ def run_etrago(args, json_path):
# import network from database
etrago.build_network_from_db()

# drop generators without p_nom
etrago.network.mremove(
"Generator",
etrago.network.generators[
etrago.network.generators.p_nom==0].index
)

# Temporary drop DLR as it is currently not working with sclopf
if (etrago.args["method"]["type"] == "sclopf") & (
not etrago.network.lines_t.s_max_pu.empty):
print("Setting s_max_pu timeseries to 1")
etrago.network.lines_t.s_max_pu = pd.DataFrame(
index=etrago.network.snapshots,
)

# adjust network regarding eTraGo setting
etrago.adjust_network()

Expand All @@ -705,26 +690,14 @@ def run_etrago(args, json_path):

# spatial clustering
etrago.spatial_clustering()

etrago.spatial_clustering_gas()
etrago.network.links.loc[etrago.network.links.carrier=="CH4", "p_nom"] *= 100
etrago.network.generators_t.p_max_pu.where(etrago.network.generators_t.p_max_pu>1e-5, other=0., inplace=True)

# snapshot clustering
etrago.snapshot_clustering()

# skip snapshots
etrago.skip_snapshots()

# Temporary drop DLR as it is currently not working with sclopf
if etrago.args["method"]["type"] != "lopf":
etrago.network.lines_t.s_max_pu = pd.DataFrame(
index=etrago.network.snapshots,
columns=etrago.network.lines.index,
data=1.0,
)

etrago.network.lines.loc[etrago.network.lines.r == 0.0, "r"] = 10

# start linear optimal powerflow calculations
etrago.optimize()

Expand All @@ -735,7 +708,6 @@ def run_etrago(args, json_path):
etrago.pf_post_lopf()

# spatial disaggregation
# needs to be adjusted for new sectors
etrago.spatial_disaggregation()

# calculate central etrago results
Expand Down
14 changes: 14 additions & 0 deletions etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2974,6 +2974,20 @@ def manual_fixes_datamodel(etrago):
inplace=True,
)

# Temporary drop DLR as it is currently not working with sclopf
if (etrago.args["method"]["type"] == "sclopf") & (
not etrago.network.lines_t.s_max_pu.empty
):
print(
"""
Dynamic line rating is not implemented for the sclopf yet.
Setting s_max_pu timeseries to 1
"""
)
etrago.network.lines_t.s_max_pu = pd.DataFrame(
index=etrago.network.snapshots,
)


def export_to_shapefile(pypsa_network, shape_files_path=None, srid=4326):
"""
Expand Down

0 comments on commit 6a8f978

Please sign in to comment.