oemof / oemof-solph

A model generator for energy system modelling and optimisation (LP/MILP).
https://oemof.org
MIT License
283 stars 124 forks source link

First time step of storage_content sequence is missing #1030

Open SabineHaas opened 7 months ago

SabineHaas commented 7 months ago

Describe the bug The storage_content sequence of an investment optimization problem is missing the first time step.

Energy system consists of: el_bus, load, el-storage, excess, shortage

To Reproduce invest_storage.txt

Screenshots Results of the storage, check sequence of storage_content:

{'scalars': variable_name
init_content       0.0
invest          1500.0
total           1500.0
Name: 2020-01-01 00:00:00, dtype: float64, 'sequences': variable_name        storage_content
2020-01-01 00:00:00            250.0
2020-01-01 01:00:00            125.0
2020-01-01 02:00:00              0.0
2020-01-01 03:00:00              NaN}

Expected behavior

2020-01-01 00:00:00            0.0
2020-01-01 01:00:00          250.0
2020-01-01 02:00:00          125.0
2020-01-01 03:00:00            0.0}

Desktop (please complete the following information):

This might be interesting for you, @nailend

jokochems commented 7 months ago

Thanks for bringing that up, @SabineHaas. I also noticed that in the course of development, but must have forgotten to open a dedicated issue or it has just not been high enough on my priority list. The inconsistencies seem to have been introduced a while ago when the better distinction between time intervals (TIMESTEPS) and discrete time points (TIMEPOINTS) was introduced.

@nailend and @SabineHaas It only holds for "standard", i.e. single period investment models, as I decided to alter the implementation for the multi-period case (and obviously, I also decided on introducing new bugs in the course of that 🙃).

p-snft commented 6 months ago

@jokochems: You are right. This looks like it was not updated when we introduced the new indexing. In the result you see what I would have expected with the old (solph v0.4) behaviour. I'll have a closer look.