-
Notifications
You must be signed in to change notification settings - Fork 135
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
Feature/restucture flow #856
Conversation
Describe the change introduced by the NonConvexInvestFlow Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
It is a mix of the classes solph.flows.NonConvexFlow and solph.flows.InvestmentFlow Additional constraints will be added as well in a separate commit Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
- Required constraints to linearize the problem - Add an argument to the solph.flows.Flow to make it possible to combine nonconvex and investment options Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
Update MANIFEST.in as well One example refers to a hybrid minigrid system with a diesel genset being optimized using the solph.flows.NonConvexInvestFlow Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com> Co-authored-by: Patrik Schönfeldt <patrik.schoenfeldt@dlr.de>
Remove the syntax to highlight the class names in the error messages. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Explain what parts of the `NonConvexInvestFlow` are similar to the `NonConvexFlow` and `InvestmentFlow`, and what parts are new in the `NonConvexInvestFlow`. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Since the new parameter `invest_non_convex` exists in the `NonConvexInvestFlow`, there is no need for the `invest_status`. Moreover, usage of the `NonConvexInvestFlow` class indicates that the `invest` always exists. Therefore, `invest_status` can be removed and by removing it, the computation time would increase. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
The sets `NON_FIXED_INVESTFLOWS` and `FIXED_INVESTFLOWS` and their corresponding constraints are removed because they seem to be unnecessary in the `NonConvexInvestFlow` and removing them would increase the computation time. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Change the `min`, `max`, and `conversion_factors` values to numbers that can be cast from decimal to floating-point and back (e.g., 0.25, 0.5, ...) to increase the readability of the corresponding *.lp file. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Explicitly name authors in the "SPDX-FileCopyrightText". Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
In some parts, the name of the `NonConvexInvestFlow` was written incorrectly. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Modify the example file because it is not read from somewhere else. Co-Authored-By: Pierre Francois <4399407+Bachibouzouk@users.noreply.github.com>
Co-authored-by: sasa821 <83787088+sasa821@users.noreply.github.com>
Add nonconvex investment flow
Discussion with @p-snft , @joroeder , @sasa821 : there should not be InvestFlow, NonConvexFlow, NonConvexInvestFlow but just one Flow class and depending on the argument the user provides, the Flow can be nonconvex and/or with invest mode. @Bachibouzouk maybe the design pattern we want to apply here is similar to this one: https://refactoring.guru/design-patterns/strategy We should write pseudo code call with different usecase to be able to decide what should happen in each case and implement tests before refactoring |
Because NonConvex and Investment are no longer mutually exclusive, we may rethink the structure of Flow, NonConvexFlow and InvestmentFlow, because there is NonConvexInvestmentFlow. For the API, it might be more intuitive to have Invest and NonConvex as options. (In my memory we wanted to get rid of the options because they were confusing because they are exclusive.) |
To define a nonconvex and investment flow
Another alternative
To me it should be possible to not explicitly provide
A special case which falls back on convex investment flow case
|
Generally, I see that all the alternatives are possible. (There are more, but more on that later.) Especially, I agree that it should be possible to not explicitly provide I want to discuss some more open questions (Qn) using the following example: solph.flows.Flow(
nominal_value=<number>,
variable_costs=...,
min=[0 <= float <= max], # Should a minimum imply NonConvex? (Q1)
# Until now, setting a min without NonConvex means always on.
max=[min <= float], # Currently, max can be equal to min and can also exceed 1.
# Should it stay like that? (Q2)
fix=[min <= float <= max], # Should it be possible to have a series like [0, 0, .5, None, .2],
# where there is not fixed value for step 4? (Q3)
# If yes: Should it be possible to define min, max, and fix at the same time? (Q4)
) As I like the current solution for Q1 (minimum also excludes value of 0, always on when no NonConvex is set), I'd suggest to stick with that. However, the argument might be called e.g. PS: The arguments |
Thanks for opening this discussion. In general, I like the idea of having one single Flow class. solph.flows.Flow(
nominal_value=None,
variable_costs=...,
min=<number in (0,1)>,
max=<number in [min,1)>,
investment=solph.Investment(
ep_costs=...,
maximum=..., # need to have maximum provided here
)
) Also, I'd strongly suggest to split after |
It's mostly (obvious) typos. Co-authored-by: Pierre Francois <pierre-francois.duc@netplus.ch>
I'm not going to go into details with a code review and at the moment, unfortunately, my time for oemof development is very limited, but I had a quick look and really like the structural improvements, this PR brings along. I'm a bit worried about integrating #828, though, but I'll try to cut some time in October to resolve merge conflicts and copy & paste the changes brought along. ;-) |
Thanks for your feedback. Adding to these points, I also forgot to align the naming if the example with the new wording. Done. Remaining tasks are addressed in #863. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When going through the changes, I updated the links in docs. (which is also part of #863, and made some minor suggestion for improvement.
Do we need an __init__.py
in the examples. I think this is not necessary and we should remove the file.
Besides, I do not see anything against merging this PR.
:py:mod:`~oemof.solph.options` module. | ||
Note that the usage of this class is currently not compatible with the | ||
:py:class:`~oemof.solph.options.Investment` class. | ||
Solph also allows you to model components with respect to more technical details, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following paragraphs need to be revised as it describes an outdated state. I have tried to address this, and to link the right API documentation of the blocks (a short check would be nice). I think we at least should not merge code snippets with a wrong API.
Generally, I think it is really nice that there is something about the mathematical background.
Co-authored-by: Johannes Röder <45163075+joroeder@users.noreply.github.com>
As far as I see, there is no objection and one positive review.As some PRs already build on the changes presented here, I will now merge. Remaining clean-up (of the documentation and adjustments to the other flow classes) is addressed in #863. |
Notes: We need to either include #799 or this makes it obsolete.