Oemof Problem: Investment Decision

Hello community,

I’m struggling with the simulation of the following scenario in oemof and was wondering if any of you could help me with it.

I would like to make a decision, if the implementation of a technology is worthwhile. Regardless of the capacity required for supply, the capacity of the technology should be fixed. For example, the question could be: Is it worthwhile investing in a 10 kW gas heating system, at periodic costs of 100 €, or not?
If I use the following transformer for this question (ep_costs=10, minimum=0, maximum=10), the capacity is optimized (e.g. to 5.5 kW) and only for the optimized capacity costs are considered (55 €):

solph.Transformer(    
    label=’gas_heating’,    
    inputs={naturalgas_bus: solph.Flow(variable_costs=0.07)},  
    outputs={heat_bus: solph.Flow(investment=solph.Investment(ep_costs=10,
                                                              minimum=0,
                                                              maximum=10,
                                                              existing=0
                                                              ))}

If I use again the following transformer (ep_costs=10, minimum=10, maximum=10), the correct costs (100€) will be considered, but the capacity of 10 kW will be added in any case. So, there is no investment decision:

solph.Transformer(    
    label=’gas_heating’,    
    inputs={naturalgas_bus: solph.Flow(variable_costs=0.07)},  
    outputs={heat_bus: solph.Flow(investment=solph.Investment(ep_costs=10,
                                                               minimum=10,
                                                               maximum=10,
                                                               existing=0
                                                               ))}

Is there any possibility, to make an investment decision, so that there is only the possibility of full investment (10 kW) or no investment at all (0 kW)?

I would be very happy if someone could help me with this question. Many thanks for any help in advance!

Best regards,
Christian

My usual disclaimer of only being vaguely aware of how oemof actually works applies! You could introduce a binary variable to guarantee the selected capacity is either zero or nameplate. Or an integer variable to guarantee some multiple of that nameplate capacity. Or if you don’t want the computational overhead of creating a mixed‑integer problem, you might be able to creatively apply the big M method together with conventional constraints. Or failing that, run your model twice: first, to see what continuous capacities are selected, and then second to either explicitly include or exclude these facilities in a new scenario. This is, in effect, coupling a model with itself and can be automated! I once did this to “fake” shut‑down in an operational model using Perl for the data processing (because Python had not yet been invented back then). HTH, R.

Correction: Python was released in 1991 and the model coupling I mentioned was around 2002. So more accurate to say that Python was still to overtake Perl in terms of popularity.

Hello, Robbie,
thank you for your quick response. I understand the approaches you mentioned, I just don’t know how I can implement them in oemof. Running the model twice is unfortunately not a solution in my case, as I am investigating several independent investments in my model.

How can I introduce a binary variable for investment decisions in oemof?

I would be very grateful for further help!
Many greetings,
Christian

You first need to formulate the mathematical equations to yield the result you want. This is a standard procedure in mixed‑integer linear programming so just search the web for the details. Then you need to create or derive a new module or class (or whatever encapsulation oemof is using here) to embed these equations, marking the binary variable as binary as you feed this information to the solver interface. And you’re done. Hopefully someone who understands oemof will turn up and advise on implementation! HTH, R.

Thank you again for your help, Robbie! Yes, hopefully some oemof user turns up!

Best regards,
Christian

Hi Christian,

thanks for your question. As I understand it, the current oemof version v0.3.3 does not have the feature you have mind. However, there is an open pull request that aims to implement a binary variable for investment. Have a look and contact the developers that work on that feature if you want to learn more.

Best, Jann

@cklm If you still need this feature you should write a comment in the open pull request . If more people are interested in a feature, developer might be motivated to develop it faster.

Hi @jann.launer and @uwe.krien,
thank you very much for the hint for the pullrequest. I am happy that the feature will be available in the future! I will leave a comment in the pull request!

To comment as a site moderator, it is better to use @‑handles and not real names in postings. There are several advantages: clickability, notifications, and GDPR erasure. This last point means that if someone requests we erase their personal details under European data protection law, the forum software will replace all instances of that particular data subject’s handle with a unique machine‑generated version. We have already had one such request. I am about to edit the above post to reflect this preferred practice. Just letting people know :slight_smile: