From f5e26a590e4907686315d98a30d6d235f8b85514 Mon Sep 17 00:00:00 2001 From: finozzifa <167071962+finozzifa@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:49:34 +0200 Subject: [PATCH] Output files with objective function value (#1033) * reformatting * release_notes.rst update * modifications logger.info * changes to configuration.rst --- doc/configuration.rst | 2 +- doc/release_notes.rst | 2 ++ scripts/solve_network.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index d6a1c6480..21f46d77f 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -227,7 +227,7 @@ Specifies the minimum voltage magnitude in the base network and the offshore sub ``load_options`` ============================= -Specifies the options to estimate future electricity demand (load). Different years might be considered for weather and the socio-economic pathway (GDP and population growth), to enhance modelling capabilities. +Specifies the options to estimate future electricity demand (load). Different years might be considered for weather and the socioeconomic pathway (GDP and population growth), to enhance modelling capabilities. .. literalinclude:: ../config.default.yaml :language: yaml diff --git a/doc/release_notes.rst b/doc/release_notes.rst index dce812acd..8e250fb02 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -44,6 +44,8 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t * Resolve pandas deprecation warning. `PR #1023 `__ +* Create files where the code outputs the value of the objective function. `PR #1033 `__ + PyPSA-Earth 0.3.0 ================= diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 5ed5c5260..f83b47478 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -576,3 +576,5 @@ def solve_network(n, config, opts="", **kwargs): ) n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards))) n.export_to_netcdf(snakemake.output[0]) + logger.info(f"Objective function: {n.objective}") + logger.info(f"Objective constant: {n.objective_constant}")