remove connection_costs as snakemake output from simplify_network

This commit is contained in:
martacki 2024-04-16 15:41:01 +02:00
parent a835f505c8
commit feb564506a
2 changed files with 2 additions and 11 deletions

View File

@ -487,7 +487,6 @@ rule simplify_network:
regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"), regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"),
regions_offshore=resources("regions_offshore_elec_s{simpl}.geojson"), regions_offshore=resources("regions_offshore_elec_s{simpl}.geojson"),
busmap=resources("busmap_elec_s{simpl}.csv"), busmap=resources("busmap_elec_s{simpl}.csv"),
connection_costs=resources("connection_costs_s{simpl}.csv"),
log: log:
logs("simplify_network/elec_s{simpl}.log"), logs("simplify_network/elec_s{simpl}.log"),
benchmark: benchmark:

View File

@ -207,7 +207,7 @@ def _compute_connection_costs_to_bus(
return connection_costs_to_bus return connection_costs_to_bus
def _adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus, output): def _adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus):
connection_costs = {} connection_costs = {}
for tech in connection_costs_to_bus: for tech in connection_costs_to_bus:
tech_b = n.generators.carrier == tech tech_b = n.generators.carrier == tech
@ -228,14 +228,12 @@ def _adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus, out
) )
) )
connection_costs[tech] = costs connection_costs[tech] = costs
pd.DataFrame(connection_costs).to_csv(output.connection_costs)
def _aggregate_and_move_components( def _aggregate_and_move_components(
n, n,
busmap, busmap,
connection_costs_to_bus, connection_costs_to_bus,
output,
aggregate_one_ports={"Load", "StorageUnit"}, aggregate_one_ports={"Load", "StorageUnit"},
aggregation_strategies=dict(), aggregation_strategies=dict(),
exclude_carriers=None, exclude_carriers=None,
@ -248,7 +246,7 @@ def _aggregate_and_move_components(
if not df.empty: if not df.empty:
import_series_from_dataframe(n, df, c, attr) import_series_from_dataframe(n, df, c, attr)
_adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus, output) _adjust_capital_costs_using_connection_costs(n, connection_costs_to_bus)
generator_strategies = aggregation_strategies["generators"] generator_strategies = aggregation_strategies["generators"]
@ -281,7 +279,6 @@ def simplify_links(
length_factor, length_factor,
p_max_pu, p_max_pu,
exclude_carriers, exclude_carriers,
output,
aggregation_strategies=dict(), aggregation_strategies=dict(),
): ):
## Complex multi-node links are folded into end-points ## Complex multi-node links are folded into end-points
@ -406,7 +403,6 @@ def simplify_links(
n, n,
busmap, busmap,
connection_costs_to_bus, connection_costs_to_bus,
output,
aggregation_strategies=aggregation_strategies, aggregation_strategies=aggregation_strategies,
exclude_carriers=exclude_carriers, exclude_carriers=exclude_carriers,
) )
@ -419,7 +415,6 @@ def remove_stubs(
renewable_carriers, renewable_carriers,
length_factor, length_factor,
simplify_network, simplify_network,
output,
aggregation_strategies=dict(), aggregation_strategies=dict(),
): ):
logger.info("Removing stubs") logger.info("Removing stubs")
@ -436,7 +431,6 @@ def remove_stubs(
n, n,
busmap, busmap,
connection_costs_to_bus, connection_costs_to_bus,
output,
aggregation_strategies=aggregation_strategies, aggregation_strategies=aggregation_strategies,
exclude_carriers=simplify_network["exclude_carriers"], exclude_carriers=simplify_network["exclude_carriers"],
) )
@ -556,7 +550,6 @@ if __name__ == "__main__":
params.length_factor, params.length_factor,
params.p_max_pu, params.p_max_pu,
params.simplify_network["exclude_carriers"], params.simplify_network["exclude_carriers"],
snakemake.output,
params.aggregation_strategies, params.aggregation_strategies,
) )
@ -569,7 +562,6 @@ if __name__ == "__main__":
params.renewable_carriers, params.renewable_carriers,
params.length_factor, params.length_factor,
params.simplify_network, params.simplify_network,
snakemake.output,
aggregation_strategies=params.aggregation_strategies, aggregation_strategies=params.aggregation_strategies,
) )
busmaps.append(stub_map) busmaps.append(stub_map)