Skip to content

Revision/simplify indexes #1158

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

Draft
wants to merge 39 commits into
base: dev
Choose a base branch
from
Draft

Revision/simplify indexes #1158

wants to merge 39 commits into from

Conversation

p-snft
Copy link
Member

@p-snft p-snft commented Feb 24, 2025

Simplify indexes in the TSAM compatible version (esp. removing the current multi-period investment).

  • If we have time dependent capacities with investments, it would be reasonable to also have them without. The "INVESTMENT_PERIOD" becomes a "CAPACITY_PERIOD" to reflect that.

p-snft added 21 commits January 29, 2025 22:08
This is an attempt to remove redundancies from the c'tor signature.
Systems with storage do not build at the moment.
Results cannot be processed.
Optimisation using aggregated time should now work using the
tsam.TimeSeriesAggregation object as the time index.

To be adjusted (not working):
* GenericStorage
* result processing
* ...
The new name reflects what it is. (The name "invest" was often read if
it were the investment costs.)
It doesn't make sense to adjust everything (esp. result processing)
for the deletion of the old multi-period feature just to have to adjust
it again when introducing the new one. Thus, there is a placeholder (one
period hard-coded).
At the moment, it is single period.
First asigning processed results to a variable before accessing
the relevant information allows to see the results while debugging.
In the multi-period model, it will not really be an added capacity,
so the old name might just stay as well.
@p-snft p-snft mentioned this pull request Feb 28, 2025
6 tasks
@p-snft p-snft mentioned this pull request Mar 10, 2025
8 tasks
Base automatically changed from feature/integrate_tsam to dev March 10, 2025 11:26
* :math:`Y_{invest}(p)`

Binary variable for the status of the investment, if
:attr:`nonconvex` is `True`.
"""
m = self.parent_block()

def _investvar_bound_rule(block, i, o, p):
def _investvar_bound_rule(_, i, o, p):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
* :math:`Y_{invest}(p)`

Binary variable for the status of the investment, if
:attr:`nonconvex` is `True`.
"""
m = self.parent_block()

def _investvar_bound_rule(block, i, o, p):
def _investvar_bound_rule(_, i, o, p):

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _investvar_bound_rule is not used.
p-snft added 2 commits March 10, 2025 12:55
Processing expects the key "scalars" to be set.
There is no reason we have to break the API here.
Optimises but results processing does not work, yet.
(It's also unclear if results are correct.)
energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas)

storage = None
if True:

Check warning

Code scanning / CodeQL

Constant in conditional expression or statement Warning

Testing a constant will always give the same result.

def _inter_storage_balance_rule(block, n, i):
"""
Rule definition for the storage balance of every storage n and
every timestep.
"""
ii = 0
for p in m.PERIODS:
ii += len(m.es.tsa_parameters[p]["order"])
for p in m.CAPACITY_PERIODS:

Check failure

Code scanning / CodeQL

Suspicious unused loop iteration variable Error

For loop variable 'p' is not used in the loop body.
p-snft added 5 commits April 1, 2025 17:35
These are no unit tests but integration test following the structure
of example scripts. Collecting the examples using pytest fails,
so they need to go.
The info was redundant, so the need to give it should be removed.
Casting collections.Counter to a list will lead to the keys being
stored instead of the values. This eventually results in wrong
tsam_weights (0 for single period).
Period/step is easier to stistinguish than inter/intra.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant