013b705ee4
* Cluster first: build renewable profiles and add all assets after clustering * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * correction: pass landfall_lengths through functions * assign landfall_lenghts correctly * remove parameter add_land_use_constraint * fix network_dict * calculate distance to shoreline, remove underwater_fraction * adjust simplification parameter to exclude Crete from offshore wind connections * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove unused geth2015 hydro capacities * removing remaining traces of {simpl} wildcard * add release notes and update workflow graphics * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: lisazeyen <lisa.zeyen@web.de>
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
"""
|
|
Solves linear optimal dispatch in hourly resolution using the capacities of
|
|
previous capacity expansion in rule :mod:`solve_network`.
|
|
"""
|
|
|
|
|
|
import logging
|
|
|
|
import numpy as np
|
|
import pypsa
|
|
from _helpers import (
|
|
configure_logging,
|
|
set_scenario_config,
|
|
update_config_from_wildcards,
|
|
)
|
|
from solve_network import prepare_network, solve_network
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if "snakemake" not in globals():
|
|
from _helpers import mock_snakemake
|
|
|
|
snakemake = mock_snakemake(
|
|
"solve_operations_network",
|
|
configfiles="test/config.electricity.yaml",
|
|
opts="",
|
|
clusters="5",
|
|
ll="v1.5",
|
|
sector_opts="",
|
|
planning_horizons="",
|
|
)
|
|
|
|
configure_logging(snakemake)
|
|
set_scenario_config(snakemake)
|
|
update_config_from_wildcards(snakemake.config, snakemake.wildcards)
|
|
|
|
solve_opts = snakemake.params.options
|
|
|
|
np.random.seed(solve_opts.get("seed", 123))
|
|
|
|
n = pypsa.Network(snakemake.input.network)
|
|
|
|
n.optimize.fix_optimal_capacities()
|
|
n = prepare_network(n, solve_opts, config=snakemake.config)
|
|
n = solve_network(
|
|
n,
|
|
config=snakemake.config,
|
|
params=snakemake.params,
|
|
solving=snakemake.params.solving,
|
|
log_fn=snakemake.log.solver,
|
|
)
|
|
|
|
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))
|
|
n.export_to_netcdf(snakemake.output[0])
|