-
Notifications
You must be signed in to change notification settings - Fork 132
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
Integrate TSAM mode in oemof.solph #980
base: dev
Are you sure you want to change the base?
Conversation
Hello @henhuy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-07-11 12:07:17 UTC |
examples/storage_investment/v5_invest_optimize_all_technologies_using_mp_and_tsam.py
Fixed
Show fixed
Hide fixed
You can already check storage equations if you want to help! oemof-solph/src/oemof/solph/processing.py Line 487 in 7684cde
Other things which are very welcome, are:
|
I finished the implementation of weighted cost before I was on vacation. I will add that soon to the PR. |
Nice! Could you create an extra branch for this and do a PR to my branch or show me your branch so that I can review? |
I would like to add an further todo. TSAM targets on the use of longterm storage. Right now, if tsam parameters are added to the energysystem each storage will have an inter and intra SOC. For short-term storages which are used on an daily base, f.e. batteries, that is not necessary and it would slow down the optimization. Therfore I think a state_variable should be added to the generic_storage. On basis of this variable it should be decided to add an inter and intra SOC or not. Then it would be possible to optimize a long term storage and a short term storage with best possible performance. |
Linked to issue: #987 it would be handy to rename The idea would be:
Variable cost would be: In total the idea is more intuitive for the user and easier to use than calculating the objective_weighting in a pre_processing, which includes time increment, period occurence and individual preferences. What are your opinions? |
7684cde
to
e72cf9a
Compare
...ples/storage_investment/v5_invest_optimize_all_technologies_but_storage_using_mp_and_tsam.py
Fixed
Show fixed
Hide fixed
9b1ce21
to
ea573dd
Compare
Things that might need changes/fixes:
|
energysystem = solph.EnergySystem( | ||
timeindex=tindex, | ||
timeincrement=[1] * len(tindex), | ||
periods=[tindex], |
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.
this is not needed and should be None, as you dont use multi-period, do you?
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.
No, it's the opposite indeed: Currently, TSAM-mode is only available in multi-period mode! But for those examples, I only use a single period to make things easier to test...
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.
I still wonder if multi-period should/could be activated ALWAYS, and an "old" default oemof.solph simulation simply uses only a single period... but this is another issue.
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.
its basically translated into pyomo like this but a lot of extra constrains and variables are not necessary (e.g. for decommissioning etc)
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.
I also found out, that the definition of ep_costs differ between those versions: single-period uses "annuities" and multi-period "total capacity costs" and calculates the annuities over the lifetime of the component
tests/test_scripts/test_solph/test_tsam/test_storage_tsam_integration.py
Outdated
Show resolved
Hide resolved
40b9537
to
2471522
Compare
…_per_period in case of segmentation
y_n \le E(t) / E_n | ||
""" | ||
for p, k, g in m.TIMEINDEX_TYPICAL_CLUSTER: | ||
t = m.get_timestep_from_tsam_timestep(p, k, g) |
Check notice
Code scanning / CodeQL
Unused local variable Note
\hat{y}_n \ge (E(t) - E_n) / E_{max} | ||
""" | ||
for p, k, g in m.TIMEINDEX_TYPICAL_CLUSTER: | ||
t = m.get_timestep_from_tsam_timestep(p, k, g) |
Check notice
Code scanning / CodeQL
Unused local variable Note
@MaxHiDLR could you explain your latest commits? |
@henhuy We definitely can start to do PR to simplify the understanding of the changing history. In the close future I will change the naming of the tsam "soc" to "storage content", to be more consistent with oemof wording. |
Good that you found this - I did not see an error? Or was it silently not working? |
Silently not working, since the storage_level doesn't get used in the usual operation of the storage. Therefore it might be good to add a test for this scenario as well. |
I'd like to talk about time indexing in a more general way. Of course, we should harmonize multi-period optimization and time series aggregation, but there is more. For example, there are different markets working of different time grids. So, if you offer you capacity, you have to do it for a full time slot. A generic multi-level time grid would also simplify modeling these kinds of things. Would you have time for a video call in the near future? |
Closes #973
This PR wants to integrate timeseries aggregation into
oemof.solph
. Thereby, newly integrated multi-period mode foroemof.solph
can be used as well.The idea is, to run TSAM with all needed timeseries before setting up the energysystem and use outcome of aggregation to set up the energysystem. The energysystem components are build with regarding aggregated timeseries. Additionally, a
tsa_parameters
parameter is given to the energysystem, which is used to set up component equations and constraints to ensure TSAM-related component behaviour.Following equations/constraints have to be adapted/are replaced in order to work correctly in TSAM mode:
Model
component needs six additional indexes in order to set up storage equations (see below)GenericStorageBlock
andGenericInvestmentStorageBlock
have to be adapted:How does the API look?
In storage investment example v5 I set up an ES with aggregated timeseries and related TSA parameters for the energysystem.
The newly introduced parameter
tsa_parameters
should be set up as follows:tsa_parameters
and needed key-value pairs below:TODOS:
GenericStorageBlock
GenericInvestmentStorageBlock