From 99332e8f59e473177cbefaf5be1bd429fe89c466 Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 8 Sep 2024 19:57:42 +0500 Subject: [PATCH 1/9] add functionality to update investment and other cost parameters in config --- scripts/add_electricity.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 0911588f7..e5c8c1545 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -147,6 +147,15 @@ def load_costs(tech_costs, config, elec_config, Nyears=1): costs = costs.value.unstack().fillna(config["fill_values"]) + for attr in ("investment", "lifetime", "FOM", "VOM", "efficiency", "fuel"): + overwrites = config.get(attr) + if overwrites is not None: + overwrites = pd.Series(overwrites) + costs.loc[overwrites.index, attr] = overwrites + logger.info( + f"Overwriting {attr} of {overwrites.index} to {overwrites.values}" + ) + costs["capital_cost"] = ( ( calculate_annuity(costs["lifetime"], costs["discount rate"]) @@ -207,6 +216,9 @@ def costs_for_storage(store, link1, link2=None, max_hours=1.0): if overwrites is not None: overwrites = pd.Series(overwrites) costs.loc[overwrites.index, attr] = overwrites + logger.info( + f"Overwriting {attr} of {overwrites.index} to {overwrites.values}" + ) return costs From 3e9108459e648e528da95dc4d5802add1d6f9d62 Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 15 Sep 2024 18:27:57 +0500 Subject: [PATCH 2/9] add costs modification parameters into configs for visualization --- config.default.yaml | 12 ++++++++++++ config.tutorial.yaml | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/config.default.yaml b/config.default.yaml index 42cac019e..a1fafb99e 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -362,6 +362,18 @@ costs: battery inverter: 0. emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. + # investment: + # CCGT: 830000 # 830'000 EUR/MW (830.0 EUR/kW) + # FOM: + # CCGT: 3.35 # 3.35 %/year + # VOM: + # CCGT: 4.2 # 4.2 EUR/MWh + # fuel: + # gas: 10.1 # EUR/MWh_th + # lifetime: + # CCGT: 25.0 # 25.0 years + # efficiency: + # CCGT: 0.58 # 0.58 per unit monte_carlo: diff --git a/config.tutorial.yaml b/config.tutorial.yaml index 0b966a798..0d83df39c 100644 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -358,6 +358,18 @@ costs: battery inverter: 0. emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. + # investment: + # CCGT: 830000 # 830'000 EUR/MW (830.0 EUR/kW) + # FOM: + # CCGT: 3.35 # 3.35 %/year + # VOM: + # CCGT: 4.2 # 4.2 EUR/MWh + # fuel: + # gas: 10.1 # EUR/MWh_th + # lifetime: + # CCGT: 25.0 # 25.0 years + # efficiency: + # CCGT: 0.58 # 0.58 per unit monte_carlo: From 160c925fd1014b98398e15c9b1b0ffe993736012 Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 15 Sep 2024 18:41:16 +0500 Subject: [PATCH 3/9] adjust configs --- config.default.yaml | 24 ++++++++++++------------ config.tutorial.yaml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index a1fafb99e..b0ed37330 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -362,18 +362,18 @@ costs: battery inverter: 0. emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. - # investment: - # CCGT: 830000 # 830'000 EUR/MW (830.0 EUR/kW) - # FOM: - # CCGT: 3.35 # 3.35 %/year - # VOM: - # CCGT: 4.2 # 4.2 EUR/MWh - # fuel: - # gas: 10.1 # EUR/MWh_th - # lifetime: - # CCGT: 25.0 # 25.0 years - # efficiency: - # CCGT: 0.58 # 0.58 per unit + # investment: # EUR/MW + # CCGT: 830000 + # FOM: # %/year + # CCGT: 3.35 + # VOM: # EUR/MWh + # CCGT: 4.2 + # fuel: # EUR/MWh + # gas: 10.1 + # lifetime: # years + # CCGT: 25.0 + # efficiency: # per unit + # CCGT: 0.58 monte_carlo: diff --git a/config.tutorial.yaml b/config.tutorial.yaml index 0d83df39c..be837695a 100644 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -358,18 +358,18 @@ costs: battery inverter: 0. emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. - # investment: - # CCGT: 830000 # 830'000 EUR/MW (830.0 EUR/kW) - # FOM: - # CCGT: 3.35 # 3.35 %/year - # VOM: - # CCGT: 4.2 # 4.2 EUR/MWh - # fuel: - # gas: 10.1 # EUR/MWh_th - # lifetime: - # CCGT: 25.0 # 25.0 years - # efficiency: - # CCGT: 0.58 # 0.58 per unit + # investment: # EUR/MW + # CCGT: 830000 + # FOM: # %/year + # CCGT: 3.35 + # VOM: # EUR/MWh + # CCGT: 4.2 + # fuel: # EUR/MWh + # gas: 10.1 + # lifetime: # years + # CCGT: 25.0 + # efficiency: # per unit + # CCGT: 0.58 monte_carlo: From 88bb596615fd12323ed2a47e55f59a47ea3dad5b Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 15 Sep 2024 20:13:32 +0500 Subject: [PATCH 4/9] update configtable in documentation --- doc/configtables/costs.csv | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/configtables/costs.csv b/doc/configtables/costs.csv index 809f51325..0c1369f88 100644 --- a/doc/configtables/costs.csv +++ b/doc/configtables/costs.csv @@ -7,3 +7,9 @@ fill_values,--,float,"Default values if not specified for a technology in ``reso marginal_cost,EUR/MWh,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, assumptions about their marginal operating costs are set to the corresponding value. Optional; overwrites cost assumptions from ``resources/costs.csv``." emission_prices,,,"Specify exogenous prices for emission types listed in ``network.carriers`` to marginal costs." -- co2,EUR/t,float,"Exogenous price of carbon-dioxide added to the marginal costs of fossil-fuelled generators according to their carbon intensity. Added through the keyword ``Ep`` in the ``{opts}`` wildcard only in the rule :mod:`prepare_network``." +investment,EUR/MW,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, provided values overwrites cost assumptions from ``resources/costs.csv``." +FOM,%/year,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, provided values overwrites Fixed Operations & Maintenance (FOM) assumptions from ``resources/costs.csv``." +VOM,EUR/MWh,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, provided values overwrites Variable Operations & Maintenance (VOM) assumptions from ``resources/costs.csv``." +fuel,EUR/MWh,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technology, provided values overwrites fuel price assumptions from ``resources/costs.csv``." +lifetime,years,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technology, provided values overwrites technology lifetime assumptions from ``resources/costs.csv``." +efficiency,--,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technology, provided values overwrites efficiency assumptions from ``resources/costs.csv``." From 0a7df0ae16ba6e3aa0e44a99f449dffb4560b95f Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 15 Sep 2024 20:25:18 +0500 Subject: [PATCH 5/9] add release notes --- doc/release_notes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 1c7e14771..7d3f26fd4 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -20,6 +20,7 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t * Remove unused `countries_codes` argument from `load_GDP` function in `build_shapes.py` script, which was not being called as intended with positional arguments `PR #1069 `__ * Fixed problematic float parsing (`_parse_float`) in `clean_osm_data.py` to make sure all OSM lines are correctly accounted for `PR #1089 `__ +* Add functionality to modify the cost assumptions using config files `PR #1097 `__ PyPSA-Earth 0.4.0 From d270a7080c9179c1df838f3d3237a45dda33f2cf Mon Sep 17 00:00:00 2001 From: yerbol-akhmetov Date: Sun, 15 Sep 2024 20:48:05 +0500 Subject: [PATCH 6/9] adjust end line for costs configuration --- doc/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index 1bfb3d30c..412c57a1c 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -425,7 +425,7 @@ Specifies the cost assumptions of the technologies considered. Cost information .. literalinclude:: ../config.default.yaml :language: yaml :start-after: Costs Configuration - :end-at: co2: + :end-at: CCGT: 0.58 .. csv-table:: :header-rows: 1 From 0cd659eaedaff9069d9463932e84160e1890b70d Mon Sep 17 00:00:00 2001 From: cpschau Date: Tue, 17 Sep 2024 14:31:53 +0200 Subject: [PATCH 7/9] fix ppm processing bug --- scripts/build_powerplants.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/build_powerplants.py b/scripts/build_powerplants.py index 71b701c1b..350c46fff 100644 --- a/scripts/build_powerplants.py +++ b/scripts/build_powerplants.py @@ -285,10 +285,8 @@ def replace_natural_gas_technology(df: pd.DataFrame): unique_tech_with_ng = df.loc[fueltype, "Technology"].unique() unknown_techs = np.setdiff1d(unique_tech_with_ng, ["CCGT", "OCGT"]) if len(unknown_techs) > 0: - df.Technology.where( - fueltype, - df["Technology"].map({t: "CCGT" for t in unknown_techs}), - inplace=True, + df.loc[fueltype, "Technology"] = df.loc[fueltype, "Technology"].replace( + {t: "CCGT" for t in unknown_techs} ) df["Fueltype"] = np.where(fueltype, df["Technology"], df["Fueltype"]) return df From 21174258cc568443709ffe886933a010b4c7e1bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:49:23 +0200 Subject: [PATCH 8/9] docs(contributor): contrib-readme-action has updated readme (#1101) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- README.md | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index bf2c6a7ae..f80424831 100644 --- a/README.md +++ b/README.md @@ -170,13 +170,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Fabian Hofmann - - - hazemful -
- Null -
- fneum @@ -204,15 +197,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Justus Ilemobayo
- - + mnm-matin
Mnm-matin
- + + martacki @@ -247,15 +240,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Koen Van Greevenbroek
- - + hazemakhalek
Hazem
- + + energyLS @@ -290,15 +283,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Emmanuel Bolarinwa
- - + Tomkourou
Thomas Kouroughli
- + + GridGrapher @@ -333,15 +326,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Ekaterina-Vo
- - + finozzifa
Finozzifa
- + + cpschau @@ -376,15 +369,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Carlos Fernandez
- - + stephenjlee
Stephen J Lee
- + + rsparks3 @@ -419,15 +412,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
Siddharth Krishna
- - + pitmonticone
Pietro Monticone
- + + Netotse @@ -462,15 +455,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
HanaElattar
- - + EmreYorat
EmreYorat
- + + AndreCNF From 82a47891bb459264239672d2ec83dca83db4f1f8 Mon Sep 17 00:00:00 2001 From: cpschau Date: Wed, 18 Sep 2024 13:15:52 +0200 Subject: [PATCH 9/9] add release_note --- doc/release_notes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 3d0537917..95c7572fd 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -22,6 +22,7 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t * Fixed problematic float parsing (`_parse_float`) in `clean_osm_data.py` to make sure all OSM lines are correctly accounted for `PR #1089 `__ * Fix minor bug for advanced csp implementation `PR #1076 `__ +* Fix minor bug in `build_powerplants.py` where the gas technology assignment incorrectly introduced NaN values for all powerplant technologies. `PR #1102 `__ PyPSA-Earth 0.4.0