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:

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?

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.

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.

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.