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

Storage component minimum investment bug #559

Closed
oakca opened this issue Jan 28, 2019 · 2 comments
Closed

Storage component minimum investment bug #559

oakca opened this issue Jan 28, 2019 · 2 comments
Assignees
Labels

Comments

@oakca
Copy link
Member

oakca commented Jan 28, 2019

I am using the solph.components.GenericStorage() with the following inputs:

# create storage
for st in self.storage.keys():
    storage['storage_'+st+'_'+self.name] = solph.components.GenericStorage(
                        label='storage_'+st+'_'+self.name,
                        inputs={bus['b_Elec'+'_'+self.name]: solph.Flow(
                            variable_costs=self.storage[st][4]*self.weight)},
                        outputs={bus['b_Elec'+'_'+self.name]: solph.Flow(
                            variable_costs=self.storage[st][4]*self.weight)},
                        investment=solph.Investment(
                            ep_costs=self.storage[st][0],
                            maximum=self.storage[st][1],
                            existing=self.storage[st][2],
                            minimum=self.storage[st][3]),
                        initial_capacity=self.storage[st][5],
                        inflow_conversion_factor=self.storage[st][6],
                        outflow_conversion_factor=self.storage[st][7],
                        capacity_loss=self.storage[st][8])

Here is an output of the self.storage[st][1] and self.storage[st][3]:

>self.storage[st][1]
1500000000000000
>self.storage[st][3]
1000

When I created the model, I checked the bounds of the storage variables, I was expecting to set the minimum invest level at 1000, but following is created:

   0 <= GenericInvestmentStorageBlock_invest(storage_Elec_Mid) <= 1500000000000000
   0 <= GenericInvestmentStorageBlock_invest(storage_Elec_North) <= 1500000000000000
   0 <= GenericInvestmentStorageBlock_invest(storage_Elec_South) <= 1500000000000000

I checked the source code and above mentioned bounds are created because of https://github.com/oemof/oemof/blob/dev/oemof/solph/components.py [ln. 497-502]:

def _storage_investvar_bound_rule(block, n):
    """Rule definition to bound the invested storage capacity `invest`.
    """
    return 0, n.investment.maximum
self.invest = Var(self.INVESTSTORAGES, within=NonNegativeReals,
                          bounds=_storage_investvar_bound_rule)

It looks like minimum bound is set to 0 for some purpose, but it makes the minimum investment option impossible. Is it a bug? or intentional?

@uvchik uvchik self-assigned this Jan 30, 2019
@uvchik uvchik added the bug label Jan 30, 2019
@uvchik
Copy link
Member

uvchik commented Jan 30, 2019

I have to say that it is a very strange attribute, but you are right it seems to be a bug.

I will have a look and let you know.

@uvchik uvchik mentioned this issue Jan 30, 2019
@uvchik
Copy link
Member

uvchik commented Jan 30, 2019

It is not an urgent bug, so I will not make a hotfix release. But you can patch it yourself:

- return 0, n.investment.maximum
+ return n.investment.minimum, n.investment.maximum

You can also pick commit 498c408.

uvchik added a commit that referenced this issue Jan 30, 2019
@uvchik uvchik closed this as completed in 498c408 Jan 30, 2019
uvchik added a commit that referenced this issue Jan 30, 2019
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