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

Features/solph existing investment #489

Merged
merged 23 commits into from May 16, 2018

Conversation

Projects
None yet
3 participants
@simnh
Copy link
Member

simnh commented May 14, 2018

Description

Allows to set existing capacity for Investment objects

Has been asked here:
https://forum.openmod-initiative.org/t/transformer-investment-mode-while-considering-for-existing-capacity/821

Related issues
#480

Other comments and questions

We need to agree on the naming and the location. One could argue, that the better place would be the nominal value of the flow objects. But I think using it in the investment object is also fine. But feel free to adapt accordingly.
I just added the adaption inside the constraints, because it was quite easy for me atm...

API

solph.Investment(ep_costs=[float], minimum=[float], maximum=[float], existing=[float])

TODO'S

  • Agree on location
  • Agree on naming
  • Fix one test
  • Write new test
  • Add information to What's new and documentation

@simnh simnh added this to the v0.2.2 milestone May 14, 2018

@simnh simnh self-assigned this May 14, 2018

@simnh simnh requested review from gnn , uvchik , ckaldemeyer , henhuy and oemof/oemof-solph May 14, 2018

@uvchik
Copy link
Member

uvchik left a comment

Thank you @simnh for this new feature.

I think the investment object is a good place for this feature and existing sounds clear for me.

I could write a test and repair the failing test.

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

I added the API to make it easier for @gplssm.

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

I added some test but I do not really understand the behaviour. If I add one 1MW to an existing investment wind turbine the investment decreases by 5MW.

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

Commit 1ee2218 fixes a really odd behaviour. I should not be necessary to set the registry to None.

...but it works now :-)

@simnh

This comment has been minimized.

Copy link
Member Author

simnh commented May 15, 2018

Nice!

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

Can I help somehow without digging too deep into oemof? Maybe I could to have one hour this evening...

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

Can I help somehow without digging too deep into oemof? Maybe I could to have one hour this evening...

You could have a look a this script-test. It might be too big. Maybe you can shorten it and try out if it behaves like it should behave if existing > 0.

If I add one 1MW existing capacity to an investment wind turbine the investment of the wind turbine decreases by 5MW and the investment of the pv plant also decreases by some MW. For me this does not make sense but maybe I just do not understand it. It might be easier to check if we remove some components.

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

Can I help somehow without digging too deep into oemof? Maybe I could to have one hour this evening...

You could have a look a this script-test. It might be too big. Maybe you can shorten it and try out if it behaves like it should behave if existing > 0.

If I add one 1MW existing capacity to an investment wind turbine the investment of the wind turbine decreases by 5MW and the investment of the pv plant also decreases by some MW. For me this does not make sense but maybe I just do not understand it. It might be easier to check if we remove some components.

I can try to reduce to less technologies being involved. I'll do it this evening....

@@ -367,7 +367,8 @@ def _investflow_fixed_rule(block, i, o, t):
"""Rule definition of constraint to fix flow variable
of investment flow to (normed) actual value
"""
return (m.flow[i, o, t] == (self.invest[i, o] *
return (m.flow[i, o, t] == (m.flows[i, o].investment.existing +

This comment has been minimized.

@simnh

simnh May 15, 2018

Author Member

missing brackets

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

Thanks @simnh. I will have a look and let you, @gplssm know if it is still necessary.

@simnh

This comment has been minimized.

Copy link
Member Author

simnh commented May 15, 2018

I think some brackets have been messed up..could you check again?

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

Everything seems to work now. Adding an existing capacity of 100 to the investment wind turbine decreases the invest variable by 100. This does not have to be like this in larger models but indicates that everything works fine now :-)

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

We could add the new option to the documentation.

http://oemof.readthedocs.io/en/latest/oemof_solph.html?highlight=investment#using-the-investment-mode

Just a sentence. Could you do that @gplssm. I think the code works fine now but you might want to check this anyway.

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

Thanks, man! 👍

We could add the new option to the documentation.

http://oemof.readthedocs.io/en/latest/oemof_solph.html?highlight=investment#using-the-investment-mode

I'll extend the docs and leave the test script as it is. As you said, I will use this new functionality extensively. So, I'll test it along its application...

@simnh

This comment has been minimized.

Copy link
Member Author

simnh commented May 15, 2018

Just out of curiosity: What is the application you are building and for what purpose?

BTW: oemof support is always this fast: less-than-24h-new-feature guarantee (only for premium users)

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

I added this branch to readthedocs. Now it is easier to check out your changes. You have to commit and push your changes to start the build process:

http://readthedocs.org/projects/oemof/builds/

The results can be found here:

http://oemof.readthedocs.io/en/features-solph-existing-investment/oemof_solph.html#using-the-investment-mode

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

Just out of curiosity: What is the application you are building and for what purpose?

I'm creating an OS implementation of the model I used for my PhD.

BTW: oemof support is always this fast: less-than-24h-new-feature guarantee (only for premium users)

I highly appreciate this support! It's nice to be a premium user 😄

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 15, 2018

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

I polished the "What's new" section and added a small part about the existing capacity in the investment mode in the documentation. I have just some quick questions @simnh / @uvchik

  • do you think it's worth to mention the changed tests in "what's new"?
  • "If existing capacity is considered for a component with investment mode enabled,
    the ep_costs apply to both, the newly built capacity and existing capacity." is this true?
  • "All parameters that usually refer to the nominal_value/capacity will
    now refer to the investment variables and existing capacity." is this true?
@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 15, 2018

I don't have the access rights to push to this branch. Is it complicated granting them or shall I create a separate PR?

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented May 16, 2018

do you think it's worth to mention the changed tests in "what's new"?

No, I don't.

"If existing capacity is considered for a component with investment mode enabled,
the ep_costs apply to both, the newly built capacity and existing capacity." is this true?

No, the ep_costs apply to the newly build capacity but not to the existing capacity. This is the main point of this feature, otherwise you could have used the minimum attribute for the existing capacity. In that case the ep_costs will apply to the existing and the newly build capacity.

"All parameters that usually refer to the nominal_value/capacity will
now refer to the investment variables and existing capacity." is this true?

Yes, all parameters that 'normally' refer to the nominal_value will now refer to investment_var + existing. If you want to set the simultaneity of power plants within a region you could use the max attribute (e.g. max=0.9). The flow_var will get an upper bound like this:
flow_var <= (invest_var + existing) * max , without investment it would be:
flow_var <= nominal_value * max

@gplssm

This comment has been minimized.

Copy link
Contributor

gplssm commented May 16, 2018

Thanks for answering. I'll update the docs accordingly...

gplssm and others added some commits May 16, 2018

@uvchik

uvchik approved these changes May 16, 2018

Copy link
Member

uvchik left a comment

Thank you @simnh for the feature and @gplssm for the documentation.

@uvchik uvchik requested review from gplssm and removed request for gnn , ckaldemeyer and henhuy May 16, 2018

@gplssm

gplssm approved these changes May 16, 2018

Copy link
Contributor

gplssm left a comment

Thanks for the feature!

@simnh simnh merged commit 165c517 into dev May 16, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@simnh simnh deleted the features/solph-existing-investment branch May 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment