PyPSA/pypsa-eur

Negative electricity demand when temporal resolution is 24h

cerealice opened this issue · 1 comments

Checklist

  • I am using the current master branch or the latest release. Please indicate. v 0.11.0
  • I am running on an up-to-date pypsa-eur environment. Update via conda env update -f envs/environment.yaml.

Describe the Bug

Running the config file for a clustering temporal resolution of more than 1h for the electricity sector, in "scripts/prepare_sector_network.py" I believe there is a bug at lines 3202-3206
factor = (
1
- industrial_demand.loc[loads_i, "current electricity"].sum()
/ n.loads_t.p_set[loads_i].sum().sum()
)

In this case the numerator is an annual value while the denominator is not. I would fix it with some code like this:
Line 2562: timestep = n.snapshot_weightings.iloc[0,0]
Then the previous lines would be:
factor = (
1
- industrial_demand.loc[loads_i, "current electricity"].sum()
/ (n.loads_t.p_set[loads_i].sum().sum()*timestep)
)

Let me know :)