0df54bc370
commit a2b82195b872bae11a9e247c53756ca3ae512362 Author: Fabian Neumann <fabian.neumann@outlook.de> Date: Fri Aug 30 16:13:36 2024 +0200 minor adjustments commit 4f9eb04fec4534abbef10fedd4d9b5c34f064670 Merge: 7b525a51bf2d82a3
Author: Fabian Neumann <fabian.neumann@outlook.de> Date: Fri Aug 30 16:08:58 2024 +0200 Merge branch 'master' into master commit 7b525a515a36a4ebb248280546583ac843f6b277 Merge: d9033374a357ba11
Author: danielelerede-oet <daniele.lerede@openenergytransition.org> Date: Mon Aug 26 13:21:06 2024 +0200 Merge branch 'master' into master commit d9033374e4bf0bb70df0828743b9aab69c0cbb27 Author: danielelerede-oet <daniele.lerede@openenergytransition.org> Date: Mon Aug 26 10:34:27 2024 +0200 Update scripts/solve_network.py Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de> commit 98e6c5b0f152ca7e064b3c80be26f50040628388 Author: danielelerede-oet <daniele.lerede@openenergytransition.org> Date: Mon Aug 26 10:34:21 2024 +0200 Update scripts/solve_network.py Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de> commit be19a2ba2401a2815c09e74d2add24461b3fe2aa Author: danielelerede-oet <daniele.lerede@openenergytransition.org> Date: Mon Aug 26 10:34:15 2024 +0200 Update scripts/solve_operations_network.py Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de> commit 8093eaa399cfea62d1ef93ec4ed5ed46bf5dcc6d Author: danielelerede-oet <daniele.lerede@openenergytransition.org> Date: Mon Aug 26 10:34:08 2024 +0200 Update scripts/solve_network.py Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de> commit 746d1761accbe44d3a851430b94844fe3ab43d72 Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed Aug 21 15:29:12 2024 +0000 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci commit f46fdee7f7ceeb9040ee73123fa4a3bd1aa14a56 Author: Daniele Lerede <daniele.lerede@openenergytransition.org> Date: Wed Aug 21 17:11:32 2024 +0200 fix solve_operations_network
62 lines
1.6 KiB
Python
62 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",
|
|
simpl="",
|
|
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])
|