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

Investment limit AttributeError if storage investment only #1076

Open
kbrcke opened this issue Jun 5, 2024 · 1 comment
Open

Investment limit AttributeError if storage investment only #1076

kbrcke opened this issue Jun 5, 2024 · 1 comment
Labels

Comments

@kbrcke
Copy link

kbrcke commented Jun 5, 2024

Hi,

I have an energy system built with oemof solph that comprises amongst other things an three energy storages implemented like this:

_storage = GenericStorage(
            label="STORAGE"+str(i),
            inputs={stor_bus: Flow()},
            outputs={stor_bus: Flow()},
            balanced=True,
            investment=Investment(ep_costs=10)
        )_
 

es.add(storage)

I want the three energy storages to share an investment limit and implemented this using solph.constraints like this:

model = Model(es)
solph.constraints.investment_limit(model, limit=100)

When solving the system, i get the following error message:
AttributeError: 'InvestmentFlowBlock' object has no attribute 'investment_costs'

This only occurs when no flow in the system has an investment assigned to it.
My current workaround is to assign at least one investment into flows but with ep_costs = 0. However, I guess this is a solph bug, I wanted to report here.

Cheers, Karo

@p-snft p-snft added the bug label Jun 5, 2024
@p-snft
Copy link
Member

p-snft commented Jun 5, 2024

Yes, this is a bug. The constraint just assumes that every Investment{Type}Block has investment_costs if it exists. However, this is not the case. My suggested solution would be to follow that assumption and create the variable during initialisation of the InvestmentFlowBlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants