Skip to content

Commit

Permalink
Keep links with small installed capacities in disaggreagted network
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Oct 30, 2023
1 parent e62365b commit eeecd5d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions etrago/tools/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,21 @@ def dispatch_disaggregation(self):
logger.info("Time for LOPF [min]: {}".format(round(z, 2)))


def import_gen_from_links(network):
def import_gen_from_links(network, drop_small_capacities=True):
"""
create gas generators from links in order to not lose them when
dropping non-electric carriers
"""
# Discard all generators < 1kW
discard_gen = network.links[network.links["p_nom"] <= 0.001].index
network.links.drop(discard_gen, inplace=True)
for df in network.links_t:
if not network.links_t[df].empty:
network.links_t[df].drop(
columns=discard_gen.values, inplace=True, errors="ignore"
)

if drop_small_capacities:
# Discard all generators < 1kW
discard_gen = network.links[network.links["p_nom"] <= 0.001].index
network.links.drop(discard_gen, inplace=True)
for df in network.links_t:
if not network.links_t[df].empty:
network.links_t[df].drop(
columns=discard_gen.values, inplace=True, errors="ignore"
)

gas_to_add = network.links[
network.links.carrier.isin(
Expand Down Expand Up @@ -769,8 +771,10 @@ def drop_foreign_components(network):
# generators modeled as links are imported to the generators table
import_gen_from_links(network)

if args["disaggregation"]:
import_gen_from_links(etrago.disaggregated_network)
if args["spatial_disaggregation"]:
import_gen_from_links(
etrago.disaggregated_network, drop_small_capacities=False
)

# For the PF, set the P to be the optimised P
network.generators_t.p_set = network.generators_t.p_set.reindex(
Expand Down

0 comments on commit eeecd5d

Please sign in to comment.