oemof / oemof-thermal

Thermal energy components for the Open Energy Modeling Framework (oemof).
https://oemof.org
MIT License
27 stars 12 forks source link

NonConvex in Stratified Thermal Storage #181

Open FrancisMe1 opened 2 years ago

FrancisMe1 commented 2 years ago

Good afternoon to everybody,

I'm working with the Stratified Thermal Storage component and I'm having some troubles. I would like to implement an economy of scale for the component, in order to account for different costs at different sizes. How can I do it? The NonConvex options doesn't work for me, maybe I'm setting something wrong. The other option is to give different sizes in input with associated different costs, however I don't know how to set constraints on the minimum size for the choice (so for example I would like to tell Oemof to choose size A if the nominal storage capacity is between 0 and 1 and B if it is between 1 and 2.). Can someone help me?

Thank you!

Francesca

p-snft commented 2 years ago

As a quick solution in terms of implementation, you could use that the underlying problem is actually convex. So, you start investment optimisation at an arbitrary size with the associated linearised specific cost (e.g. in € per additional m³). Then iterate with the resulting optimal sizes and corresponding linearised costs and you are done. If a bigger storage is worth the investment without economy of scale, it will for sure be when specific prices are adjusted.

The second way was already mentioned by you: You could have a GenericInvestmentStorageBlock with binary constraints so that the linearised specific costs really match. (A better way to do this would be piecewise linear investment. This feature would have to be implemented, though. I guess mocking this using NonConvex investments will result in a longer runtime then the iterative approach.)

FrancisMe1 commented 2 years ago

Thank you for your answer! Could you please give me an example on how to implement the linearised specific costs in the generic investment? and what do you mean when you say that I have to iterate the resulting optimal size and corresponding linearized cost? I don't know how to tell Oemof to choose one of the options I give in input...

p-snft commented 2 years ago

Assume that the price is

so the specific cost (slope) is

Now, you guess a size, i.e. 3 m³ and start optimisation with 2/3 €/m³. When the optimiser finds an optimal size of 5 m³, use 0.4 €/m³, and so on. At some point, the change between two runs should become small enough so that you can decide to stop.

FrancisMe1 commented 2 years ago

thank you!