diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4279b96a..03dffc2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: # Make docstrings PEP 257 compliant - repo: https://github.com/PyCQA/docformatter - rev: v1.6.1-rc1 + rev: v1.6.3 hooks: - id: docformatter args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] diff --git a/doc/configtables/solving.csv b/doc/configtables/solving.csv index d30029f4..cba28cbe 100644 --- a/doc/configtables/solving.csv +++ b/doc/configtables/solving.csv @@ -1,7 +1,7 @@ ,Unit,Values,Description options,,, -- formulation,--,"Any of {'angles', 'kirchhoff', 'cycles', 'ptdf'}","Specifies which variant of linearized power flow formulations to use in the optimisation problem. Recommended is 'kirchhoff'. Explained in `this article `_." --- load_shedding,bool,"{'true','false'}","Add generators with a prohibitively high marginal cost to simulate load shedding and avoid problem infeasibilities." +-- load_shedding,bool/float,"{'true','false', float}","Add generators with very high marginal cost to simulate load shedding and avoid problem infeasibilities. If load shedding is a float, it denotes the marginal cost in EUR/kWh." -- noisy_costs,bool,"{'true','false'}","Add random noise to marginal cost of generators by :math:`\mathcal{U}(0.009,0,011)` and capital cost of lines and links by :math:`\mathcal{U}(0.09,0,11)`." -- min_iterations,--,int,"Minimum number of solving iterations in between which resistance and reactence (``x/r``) are updated for branches according to ``s_nom_opt`` of the previous run." -- max_iterations,--,int,"Maximum number of solving iterations in between which resistance and reactence (``x/r``) are updated for branches according to ``s_nom_opt`` of the previous run." diff --git a/doc/release_notes.rst b/doc/release_notes.rst index f859646b..192d828c 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -15,7 +15,9 @@ Upcoming Release * Bugfix: Correct typo in the CPLEX solver configuration in ``config.default.yaml``. -* Renamed script file from PyPSA-EUR ``build_load_data`` to ``build_electricity_demand``. +* Renamed script file from PyPSA-EUR ``build_load_data`` to ``build_electricity_demand`` and ``retrieve_load_data`` to ``retrieve_electricity_demand``. + + PyPSA-Eur 0.8.0 (18th March 2023) ================================= diff --git a/doc/retrieve.rst b/doc/retrieve.rst index e4f47dec..cc93c3d9 100644 --- a/doc/retrieve.rst +++ b/doc/retrieve.rst @@ -80,8 +80,8 @@ This rule, as a substitute for :mod:`build_natura_raster`, downloads an already For details see :mod:`build_natura_raster`. -Rule ``retrieve_load_data`` -================================ +Rule ``retrieve_electricity_demand`` +==================================== This rule downloads hourly electric load data for each country from the `OPSD platform `_. diff --git a/doc/tutorial.rst b/doc/tutorial.rst index f396b82c..1b87cefe 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -156,7 +156,7 @@ This triggers a workflow of multiple preceding jobs that depend on each rule's i 20[label = "retrieve_cost_data", color = "0.30 0.6 0.85", style="rounded"]; 21[label = "build_powerplants", color = "0.16 0.6 0.85", style="rounded"]; 22[label = "build_electricity_demand", color = "0.00 0.6 0.85", style="rounded"]; - 23[label = "retrieve_load_data", color = "0.34 0.6 0.85", style="rounded,dashed"]; + 23[label = "retrieve_electricity_demand", color = "0.34 0.6 0.85", style="rounded,dashed"]; 1 -> 0 2 -> 1 20 -> 1 diff --git a/doc/tutorial_sector.rst b/doc/tutorial_sector.rst index 039271db..29971e3a 100644 --- a/doc/tutorial_sector.rst +++ b/doc/tutorial_sector.rst @@ -141,7 +141,7 @@ successfully. 19[label = "retrieve_cost_data", color = "0.50 0.6 0.85", style="rounded"]; 20[label = "build_powerplants", color = "0.49 0.6 0.85", style="rounded"]; 21[label = "build_electricity_demand", color = "0.39 0.6 0.85", style="rounded"]; - 22[label = "retrieve_load_data", color = "0.05 0.6 0.85", style="rounded"]; + 22[label = "retrieve_electricity_demand", color = "0.05 0.6 0.85", style="rounded"]; 23[label = "build_gas_input_locations", color = "0.45 0.6 0.85", style="rounded"]; 24[label = "prepare_network", color = "0.31 0.6 0.85", style="rounded"]; 25[label = "add_extra_components", color = "0.23 0.6 0.85", style="rounded"]; @@ -368,7 +368,7 @@ implemented in the workflow: 19[label = "retrieve_cost_data", color = "0.04 0.6 0.85", style="rounded"]; 20[label = "build_powerplants", color = "0.28 0.6 0.85", style="rounded"]; 21[label = "build_electricity_demand", color = "0.46 0.6 0.85", style="rounded"]; - 22[label = "retrieve_load_data", color = "0.44 0.6 0.85", style="rounded"]; + 22[label = "retrieve_electricity_demand", color = "0.44 0.6 0.85", style="rounded"]; 23[label = "build_energy_totals", color = "0.53 0.6 0.85", style="rounded"]; 24[label = "build_population_weighted_energy_totals", color = "0.03 0.6 0.85", style="rounded"]; 25[label = "build_clustered_population_layouts", color = "0.34 0.6 0.85", style="rounded"]; diff --git a/rules/retrieve.smk b/rules/retrieve.smk index 37deb44d..0a96406a 100644 --- a/rules/retrieve.smk +++ b/rules/retrieve.smk @@ -140,7 +140,7 @@ if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]: "../scripts/retrieve_gas_infrastructure_data.py" -rule retrieve_load_data: +rule retrieve_electricity_demand: input: HTTP.remote( "data.open-power-system-data.org/time_series/2019-06-05/time_series_60min_singleindex.csv", @@ -150,7 +150,7 @@ rule retrieve_load_data: output: "data/load_raw.csv", log: - LOGS + "retrieve_load_data.log", + LOGS + "retrieve_electricity_demand.log", resources: mem_mb=5000, retries: 2 diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py index ee90eef6..6dc3b5a4 100644 --- a/scripts/build_bus_regions.py +++ b/scripts/build_bus_regions.py @@ -56,9 +56,10 @@ logger = logging.getLogger(__name__) def voronoi_partition_pts(points, outline): """ - Compute the polygons of a voronoi partition of `points` within the - polygon `outline`. Taken from - https://github.com/FRESNA/vresutils/blob/master/vresutils/graph.py + Compute the polygons of a voronoi partition of `points` within the polygon + `outline`. Taken from + https://github.com/FRESNA/vresutils/blob/master/vresutils/graph.py. + Attributes ---------- points : Nx2 - ndarray[dtype=float] diff --git a/scripts/build_cop_profiles.py b/scripts/build_cop_profiles.py index 342bd7e0..5d36cd5b 100644 --- a/scripts/build_cop_profiles.py +++ b/scripts/build_cop_profiles.py @@ -10,8 +10,6 @@ The COP is a function of the temperature difference between source and sink. The quadratic regression used is based on Staffell et al. (2012) - - https://doi.org/10.1039/C2EE22653G. """ diff --git a/scripts/build_gas_network.py b/scripts/build_gas_network.py index f3021022..23f58caa 100644 --- a/scripts/build_gas_network.py +++ b/scripts/build_gas_network.py @@ -27,8 +27,6 @@ def diameter_to_capacity(pipe_diameter_mm): bar -> 21.7 GW CH4 pipe capacity (LHV) Based on p.15 of - - https://gasforclimate2050.eu/wp-content/uploads/2020/07/2020_European-Hydrogen-Backbone_Report.pdf """ # slopes definitions diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 2b8cbb13..fcdc4ed9 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -151,7 +151,8 @@ def prepare_network(n, solve_opts=None, config=None): ): df.where(df > solve_opts["clip_p_max_pu"], other=0.0, inplace=True) - if solve_opts.get("load_shedding"): + load_shedding = solve_opts.get("load_shedding") + if load_shedding: # intersect between macroeconomic and surveybased willingness to pay # http://journal.frontiersin.org/article/10.3389/fenrg.2015.00055/full # TODO: retrieve color and nice name from config