I’m currently working with oemof.solph Converters that have multiple outputs (typical example: CHP with electricity and heat output plus investment mode), and I’d like to double-check my understanding of how investment on multi-output components is handled.
From another Q&A (answer by Patrick Schönfeld here Investment mode in case of multiple inputs/outputs of oemof-solph component - Q&A - Open Energy Modelling Initiative) I took away that:
-
It should be sufficient to put an Investment only on one output flow of the Converter; it doesn’t matter on which one.
-
The other outputs are then implicitly linked via conversion_factors and the Converter’s relation constraints.
I tested three variants:
-
Investment only on output 1 (electricity).
-
Investment only on output 2 (heat).
-
Investment on both outputs.
Cases (1) and (3) give identical capacities and flows.
Case (2) gives slightly different optimal capacities, although the component and ratios are the same. The energy flow going tino the CHP (input) and both outputs are slightly reduced.
Questions
-
Is it officially correct that a single Investment on any one output of a multi-output Converter fully defines the investable capacity of the unit, and all other outputs are derived via conversion_factors?
-
Why can results differ when I move the single Investment from output 1 to output 2? Is this expected, or is there a structural difference in how the investment is treated on different outputs?
-
If I place Investment on both outputs of the same Converter, do I then get two independent capacity variables (only indirectly linked via the flow relation), or is one of them redundant due to the constraint structure?
Hi @Franzi041,
I think, you understand everything correctly: For a Converter it should not matter which Flow you limit, as they are linked by the conversion_factors. (I’d call the link explicit.) So:
- You can put investments to any combination of of the
Flows, no matter whether they are used for input or output. Yo need to make sure, though, that the total costs are scaled accordingly.
- If your result is not very sensitive to the size (if the size does not really matter), even small rounding differences can result in significantly different sizes.
- Both investments cause costs depending on the numbers you give. But as their capacities are linked by the conversion factor, the capacity will be determined by it. (It does not make sense to have it bigger if the other size limits the throughput of the
Converter.)
Maybe, this is best explained in an example:
from oemof import solph
es = solph.EnergySystem(timeindex=[0, 1, 2])
b_gas = solph.Bus("gas")
b_el = solph.Bus("elec")
b_heat = solph.Bus("heat")
es.add(b_gas, b_el, b_heat)
heat_sink = solph.components.Sink("heat_sink", inputs={b_heat: solph.Flow()})
el_demand = solph.components.Sink(
"demand_el",
inputs={b_el: solph.Flow(nominal_capacity=1, fix=[4, 8])},
)
gas_source = solph.components.Source(
"gas_source",
outputs={b_gas: solph.Flow(variable_costs=0.5)},
)
es.add(heat_sink, el_demand, gas_source)
flow_g = solph.Flow(nominal_capacity=solph.Investment(ep_costs=1)))
flow_e = solph.Flow()
flow_h = solph.Flow()
chp = solph.components.Converter(
label='chp',
inputs={b_gas: flow_g},
outputs={b_el: flow_e, b_heat: flow_h},
conversion_factors={b_gas: 1, b_heat: 0.5, b_el: 0.25}
)
es.add(chp)
model = solph.Model(es)
results = model.solve()
print(results["objective"])
Without investment, the total costs are:
56 = OPEX + CAPEX
OPEX = 24 = (4 + 8)/0.25 × 0.5 (demand / conversion_factor × variable_costs)
CAPEX = 32 = 8 / 0.25 × 1 (peak demand / conversion_factor × ep_costs)
If you want to put the investment elsewhere, these are the equivalent options:
flow_e= Flow(nominal_capacity=Investment(ep_costs=4)): total costs 56.0
flow_h= Flow(nominal_capacity=Investment(ep_costs=2)): total costs 56.0
flow_e= Flow(nominal_capacity=Investment(ep_costs=2))
flow_h= Flow(nominal_capacity=Investment(ep_costs=1)): total costs 56.0
(In my example, the conversion factors are chosen so that calculating equivalent costs for the other Flows is easy. It might be harder in your case.
Good morning,
Thank you for the quick answer!
In my case the deviation came from exactly the point you mentioned about scaling the costs.
I moved the investment from the primary to the secondary output without adjusting ep_costs for the different efficiencies. In my model, the secondary output has a higher efficiency (efficiency2), but I kept the same ep_costs instead of scaling them by the ratio of efficiencies (e.g. ep_costs_out2 = ep_costs_out1 * η_out1 / η_out2).
This means that “investment on output 2” effectively represented a different cost per unit of physical capacity than “investment on output 1”, so the optimiser saw the technology as more expensive in that formulation and ended up with slightly lower optimal capacity and flows. After accounting for this scaling, the behaviour is consistent with your explanation.