PyPSA / pypsa-usa

PyPSA-USA: An Open-Source Energy System Optimization Model for the United States
https://pypsa-usa.readthedocs.io
MIT License
35 stars 14 forks source link

Operational Reserves mis-identifies any generators with p_max_pu as renewable according to old implementation. #331

Open ktehranchi opened 1 month ago

ktehranchi commented 1 month ago

Checklist

Issue exisits on what branch

Develop

The Issue

The old implementation of operational reserves mis-identifies any generators with p_max_pu as a renewable. In connection to #316, I need to find a better way to designate which resources can commit to reserves.

https://github.com/ktehranchi/pypsa-usa/blob/d3fc737cf50d48c20b65304f06960a5b01f04f10/workflow/scripts/solve_network.py#L760-L772

Steps To Reproduce

No response

Expected Behavior

No response

Error Message

No response

Anything else?

No response

ktehranchi commented 1 month ago
    # Share of extendable renewable capacities
    ext_i = n.generators.query("p_nom_extendable").index
    vres_i = n.generators_t.p_max_pu.columns
    if not ext_i.empty and not vres_i.empty:
        capacity_factor = n.generators_t.p_max_pu[vres_i.intersection(ext_i)]
        p_nom_vres = (
            n.model["Generator-p_nom"]
            .loc[vres_i.intersection(ext_i)]
            .rename({"Generator-ext": "Generator"})
        )
        lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * capacity_factor)).sum(
            "Generator",
        )