Skip to content

Different TSAM versions lead to different aggregated time series #103

@phil-fzj

Description

@phil-fzj

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest commit on the master branch

  • I have confirmed this bug exists on the lastest commit on the dev branch.

  • I have confirmed this bug exists for a specific version the software.

Issue Description

When aggregating the time series data from the fine model defined in this test:
https://github.com/FZJ-IEK3-VSA/FINE/blob/b9bce326cd77ff64e97747da7eac480bf11791d2/test/conftest.py#L368

we find different results depending on the tsam version used (e.g. 2.3.9 and 2.3.2)

E.g. The output for the aggregated time series of the component ("Existing run-of-river plants") differs:
esM.getComponent("Existing run-of-river plants").aggregatedOperationRateFix[0].mean()

Env1 (pandas 2.2.3, python 3.13, tsam 2.3.9):
cluster_0    0.544570
cluster_1    0.563770
cluster_2    0.530722
cluster_3    0.538196
cluster_4    0.519660
cluster_5    0.000000
cluster_6    0.000000
cluster_7    0.545162
Env3 (pandas 2.2.3, python: 3.13.0, tsam 2.3.7)
cluster_0    0.544570
cluster_1    0.563770
cluster_2    0.530722
cluster_3    0.538196
cluster_4    0.519660
cluster_5    0.000000
cluster_6    0.000000
cluster_7    0.545162
dtype: float64

differ from this:

Env2 (pandas 1.5.3, python 3.10, tsam  2.3.2):
cluster_0    0.544570
cluster_1    0.566054
cluster_2    0.530722
cluster_3    0.538196
cluster_4    0.519660
cluster_5    0.000000
cluster_6    0.000000
cluster_7    0.545162

E.g. compare the values for cluster_1.
It does not differ much but enough to result in a different optimization result for fine.

For refenence also refer to FZJ-IEK3-VSA/FINE#475.

The following tsam settings are passed from fine to TSAM:

esM.aggregateTemporally(
        numberOfTypicalPeriods=3,
        segmentation=False,
        sortValues=True,
        representationMethod=None,
        rescaleClusterPeriods=True,
    )

Reproducible Example

Use the code from this test:
https://github.com/FZJ-IEK3-VSA/FINE/blob/b9bce326cd77ff64e97747da7eac480bf11791d2/test/conftest.py#L368

Expected Behavior

Time series should be the same after aggregation when using different tsam versions.

pip list -v

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions