Getting investment, optimisation results

Hello everybody,

I can’t get results from my oemof-model for a long time. And I can’t find solution in Forum.
I made a System with PV:

        outputs={e_bus: solph.Flow(fix=pv_el, nominal_value=None, investment=solph.Investment(ep_costs=epc_pv))})

I wanted “solph” to find optimal nominal value. How can I get the nominal value, that solph found?
And second question, how can I get the investment?

My result looks so:

[337 rows x 1 columns]}, ("< 'pv'>", "< 'electricity'>"): {'scalars': variable_name
invest    1158.2005
Name: 2020-01-01 00:00:00, dtype: float64, 'sequences': variable_name        flow
2020-01-01 00:00:00   0.0
2020-01-01 01:00:00   0.0
2020-01-01 02:00:00   0.0
2020-01-01 03:00:00   0.0
2020-01-01 04:00:00   0.0
...                   ...
2020-01-14 20:00:00   0.0
2020-01-14 21:00:00   0.0
2020-01-14 22:00:00   0.0
2020-01-14 23:00:00   0.0
2020-01-15 00:00:00   0.0

But i need ONLY a variable “invest_pv=1158.2005” to play with it as well as with “nominal_value_pv= x”. Can I get both of them somehow?

Hi Angelina!

You are almost there! The value named investin the results is actually the nominal value (that has been invested into). Thus, you can get it by accessing the entries of the result you printed as a whole:

pv_size = results[("pv", "electricity")]["scalars"]["invest"]

To get the costs of that investment, you will have to manually multiply it with the costs you’ve already given.

pv_investment_costs = pv_size * epc_pv

Thank you very much! It helped a lot. But I also have a heat pump:

    inputs={e_bus: solph.Flow()},
    outputs={w_bus: solph.Flow(nominal_value=None, variable_costs=0)},
    conversion_factors={w_bus: 3},

and such a result:

{("< 'ASHP'>", "< 'heat'>"): {'scalars': Series([], Name: 2020-01-01 00:00:00, dtype: float64), 'sequences': variable_name         flow
2020-01-01 00:00:00  100.0
2020-01-01 01:00:00  117.0
2020-01-01 02:00:00  134.0
2020-01-01 03:00:00  150.0
2020-01-01 04:00:00  164.0
...                    ...
2020-01-14 20:00:00   26.0
2020-01-14 21:00:00   41.0
2020-01-14 22:00:00   59.0
2020-01-14 23:00:00   79.0
2020-01-15 00:00:00  100.0

So in this case there are no “invest”. But actualy solph found optimal size. How can I get it here?

I just used wp_size=WPWbus.max() instead of invest.
But anyway. In my system there are: pv+storage+heat pump. I can also buy and sell directly to grid. So now i try to unterstand how much money every equipment need, and how much should I pay for energy during my considered period.

Solph gave me such a result:

Optimal - objective value 79571.313

But now I try to get it manualy to understend if I get the point of solph. I made a formula myself with your help:


it’s like: PV inverst costs + Storage invest costs + Heat Pump invest costs + Energy that I bought from grid - Energy that I sell to grid. So I was waiting to get the same result as solph gave me: objective value=79571.313

but I got this:


What did I do wrong?

Hi Angelina,

in fact, your heat pump has unlimited size, as you did not set a nominal value and the investment object is given to the Transformer and not to the Flow. (We know, user feedback on improperly set parameters needs to improved urgently. We have this on our agenda.) For a proper investment optimisation, it should be:

    inputs={e_bus: solph.Flow()},
    outputs={w_bus: solph.Flow(
    conversion_factors={w_bus: 3},

When you do so, there should be a scalar for the invested capacity.

PS: That your manual computation results in a higher number than the optimiser just might be because of this.

Yes! Thank you very much! Now everything works!

Text and images licensed under CC BY 4.0Data licensed under CC0 1.0Code licensed under MITSite terms of serviceOpenmod mailing listOpenmod wiki. Openmod YouTube.