Nonconvex capex

Hello, dear oemof developers! Thank you very much for fast answers. I started to complicate my Investment-Modell. I found variable capex:

As I understood, I have to use “nonconvex” function, but I can’t complitely get, where should I put my variable capex. Normally I use capex in formula of epc:

capex_var_sole=pd.DataFrame({‘capex’:[2586, 2099, 1773, 1593]}, index=[10, 20, 35, 50])
n_wp=20
epc_wp = int(economics.annuity(capex=capex_var_sole, n=n_wp, wacc=0.05))

But this function is not working with variable capex.
And in examples epc is always constant, what is wrong in my case. So I want oemof to find the best Heatpump -Power for my energy district considering variable invest costs depends of this Power. Is it possible?

Hi @AngelinaDenisova,

in oemof.solph, investment optimisation is always linear. We do not have an interface for e.g. piece-wise linear cost like you tried it. However, you can work around the limitation using binary decisions: You could have one heat pump that costs 2586 €/kW and needs a power of at least 10 kW to be built, one for 2099 €/kW with a power of at least 20 kW to be build, one for 1773 €/kW that needs a minimum power of 35 kW and so on.

PS: It would be possible to implement piece-wise linear investment, but nobody demanded it.

@pschoen Would it be possible to include implementation of piece-wise linear investment on agenda?
I am interested to use it for my work on power-to-x systems.

This short publication might be relevant perhaps:

Most work on solph is done by people using the feature they are working on. This is because everybody is funded by their company or institute that is using solph for different projects. Unluckily, there is no dedicated (paid time) budget to do add things for third parties.

If you are interested, I could assist you. As a reference, the current Code for Investment objects is in oemof/solph/_options.py) and piecewise linear optimisation is used in solph/components/experimental/_piecewise_linear_transformer.py.

@pschoen Sure. I am not an expert on this but I would like to try and implement this. Can you suggest some starting steps?

Personally, I would start by specifying the goal: How would the API for piece-wise linear investment would look like? This can be done without in-depth knowledge of the code details but will still tell you what needs to be touched.