Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvestmentFlowBlock does not add ep_cost & offset to objective if Investment object is NonConvex #1179

Open
jfreissmann opened this issue Mar 14, 2025 · 0 comments

Comments

@jfreissmann
Copy link

Short description:
While probing the Investment object for the Issue #1172 and PR #1173, it seems like another issue came to the attention of @maltefritz and me: When e.g. a Converter has a solph.Investment as the nominal_capacity with ep_cost, offset and nonconvex set, while the Flow itself is not set to be NonConvex (e.g. when the min parameter should be enforced), the ep_cost and offset are not added to the objective function. See below for an example of a Converter producing the error:

hp_expensive = solph.components.Converter(
    'heat pump expensive',
    inputs={b_el: solph.Flow()},
    outputs={
        b_th: solph.Flow(
            nominal_capacity=solph.Investment(
                ep_costs=100,
                offset=2000,
                maximum=1,
                minimum=0,
                nonconvex=solph.NonConvex()
            ),
            variable_costs=1
        )
    },
    conversion_factors={b_el: [3]}
)

To Reproduce:
You can find a full example in the gist below:

https://gist.github.com/jfreissmann/a7165f9af517a1a8518a70e809a20186

The objective function produces from the energy system model above looks like this:

min
objective:
+50 InvestmentFlowBlock_invest(heat_pump_cheap_heat_bus_0)
+1 flow(heat_pump_expensive_heat_bus_0)
+1 flow(heat_pump_cheap_heat_bus_0)

It does not include the ep_cost or the offset of the hp_expensive Converter. Therefore, the solution of the optimization is to build the hp_expensive Converter for free and only pay its variable_cost to cover the heat demand. This also can be observed via the 'sequences' of the 'heat bus' node. The 'scalars' do not even exist.

Setup:

  • OS: Windows 11
  • Python 3.11
  • oemof.solph dev branch latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant