pypsa-meets-earth / pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://pypsa-earth.readthedocs.io/en/latest/
230 stars 183 forks source link

Mismatch between length of bus0 and bus1 while adding SMR and other technologies in `prepare_sector_network.py` #1148

Open yerbol-akhmetov opened 3 days ago

yerbol-akhmetov commented 3 days ago

Checklist

Describe the Bug

Good day. The issue is related to addition of SMR into the network in prepare_sector_network.py script in h2_hc_conversions function. When adding SMR of SMR CC, the error of mismatch between bus1 and bus0. In particular, nodes are used for bus1 and spatial.gas.nodes are used for bus0. It causes error, as nodes consider only AC nodes, while spatial.gas.nodes considers both AC and DC nodes. So error is related to this piece of code:

            n.madd(
                "Link",
                spatial.nodes,
                suffix=" SMR CC",
                bus0=spatial.gas.nodes,
                bus1=nodes + " H2",
                bus2="co2 atmosphere",
                bus3=spatial.co2.nodes,
                p_nom_extendable=True,
                carrier="SMR CC",
                efficiency=costs.at["SMR CC", "efficiency"],
                efficiency2=costs.at["gas", "CO2 intensity"]
                * (1 - options["cc_fraction"]),
                efficiency3=costs.at["gas", "CO2 intensity"] * options["cc_fraction"],
                capital_cost=costs.at["SMR CC", "fixed"],
                lifetime=costs.at["SMR CC", "lifetime"],
            )

Error Message

image

The fix will be presented in this PR @hazemakhalek

hazemakhalek commented 1 day ago

Thanks for pointing this out. So far we only worked with force_AC turned on. A good permanent solution here will be great. It has to accommodate for the Force_AC case as well @yerbol-akhmetov