Skip to content

Commit

Permalink
Merge pull request #1076 from davide-f/fix_csp
Browse files Browse the repository at this point in the history
* Bugfix for csp buses: add buses one for generator

* Add release note

* Drop csp from tutorial and default configs

* Add comment by Emmanuel: check csp in renewable_carriers
  • Loading branch information
davide-f authored Sep 16, 2024
1 parent 2e2fdc2 commit 09af96e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ electricity:
custom_powerplants: false # "false" use only powerplantmatching (ppm) data, "merge" combines ppm and custom powerplants, "replace" use only custom powerplants

conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
renewable_carriers: [solar, csp, onwind, offwind-ac, offwind-dc, hydro]
renewable_carriers: [solar, onwind, offwind-ac, offwind-dc, hydro]

estimate_renewable_capacities:
stats: "irena" # False, = greenfield expansion, 'irena' uses IRENA stats to add expansion limits
Expand Down
2 changes: 1 addition & 1 deletion config.tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ electricity:
custom_powerplants: false # "false" use only powerplantmatching (ppm) data, "merge" combines ppm and custom powerplants, "replace" use only custom powerplants

conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
renewable_carriers: [solar, csp, onwind, offwind-ac, offwind-dc, hydro]
renewable_carriers: [solar, onwind, offwind-ac, offwind-dc, hydro]

estimate_renewable_capacities:
stats: "irena" # False, = greenfield expansion, 'irena' uses IRENA stats to add expansion limits
Expand Down
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ 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 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1069>`__
* Fixed problematic float parsing (`_parse_float`) in `clean_osm_data.py` to make sure all OSM lines are correctly accounted for `PR #1089 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1089>`__

* Fix minor bug for advanced csp implementation `PR #1076 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1076>`__


PyPSA-Earth 0.4.0
=================
Expand Down
22 changes: 14 additions & 8 deletions scripts/add_extra_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,23 @@ def attach_stores(n, costs, config):
marginal_cost=costs.at["battery inverter", "marginal_cost"],
)

if ("csp" in config["renewable"].keys()) and (
if ("csp" in elec_opts["renewable_carriers"]) and (
config["renewable"]["csp"]["csp_model"] == "advanced"
):
# add buses for csp
n.madd("Bus", buses_i + " csp", carrier="csp", **bus_sub_dict)
# get CSP generators and their buses
csp_gens = n.generators.query("carrier == 'csp'")
buses_csp_gens = n.buses.loc[csp_gens.bus]

csp_buses_i = csp_gens.index
c_buses_i = csp_gens.bus.values

csp_buses_i = n.buses.index[n.buses.index.str.contains("csp")]
csp_bus_sub_dict = {k: buses_csp_gens[k].values for k in ["x", "y", "country"]}

# add buses for csp
n.madd("Bus", csp_buses_i, carrier="csp", **csp_bus_sub_dict)

# change bus of existing csp generators
old_csp_bus_vector = buses_i + " csp"
n.generators.loc[old_csp_bus_vector, "bus"] = csp_buses_i
n.generators.loc[csp_gens.index, "bus"] = csp_buses_i

# add stores for csp
n.madd(
Expand All @@ -213,7 +219,7 @@ def attach_stores(n, costs, config):
"Link",
csp_buses_i,
bus0=csp_buses_i,
bus1=buses_i,
bus1=c_buses_i,
carrier="csp",
efficiency=costs.at["csp-tower", "efficiency"],
capital_cost=costs.at["csp-tower", "capital_cost"],
Expand Down Expand Up @@ -268,7 +274,7 @@ def attach_hydrogen_pipelines(n, costs, config):
from _helpers import mock_snakemake

os.chdir(os.path.dirname(os.path.abspath(__file__)))
snakemake = mock_snakemake("add_extra_components", simpl="", clusters=10)
snakemake = mock_snakemake("add_extra_components", simpl="", clusters="20flex")
configure_logging(snakemake)

n = pypsa.Network(snakemake.input.network)
Expand Down

0 comments on commit 09af96e

Please sign in to comment.