Skip to content

Addition and subtraction of time profiles#92

Merged
trulsf merged 3 commits intomainfrom
tf/add_profiles
Apr 13, 2026
Merged

Addition and subtraction of time profiles#92
trulsf merged 3 commits intomainfrom
tf/add_profiles

Conversation

@trulsf
Copy link
Copy Markdown
Member

@trulsf trulsf commented Mar 26, 2026

Initial attempt at better support for addition and subtraction of time profiles (see #91).

There is still some open questions to be discussed.

  • Should there be more explicit errors for addition of profiles not supported (e.g. ScenarioProfile + RepresentativeProfile) or should we make the effort to support all combinations?
  • Should arithmetic support also be extended to StrategicStochasticProfile?

There is also the question about changing the behavior of what to do when using too short profiles for a time structure. Should we return an error instead of repeating the last, as we do today? This will be a breaking change so I think we should consider it for a separate PR.

@trulsf trulsf requested review from JulStraus and hellemo March 26, 2026 08:27
Copy link
Copy Markdown
Collaborator

@JulStraus JulStraus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Should there be more explicit errors for addition of profiles not supported (e.g. ScenarioProfile + RepresentativeProfile) or should we make the effort to support all combinations?
  • Should arithmetic support also be extended to StrategicStochasticProfile?

Regarding your two points above, I would say that we should support all TimeProfiles, including StrategicStochasticProfile and ad also support for ScenarioProfile + RepresentativeProfile in practice, we can easily have a ScenarioProfile within a RepresentativeProfile. I am however a bit skeptical whether people do not anyhow run in errors if they want to try it out.

I do not really think that we have to be more explicit with respect to an error message in a first step. Currently, we do not advertise the potential of adding two individual profiles, so people working with it should have a good understanding of their profiles.

The only problem I see is if some of the sub profiles do not have the same length. In this case, we would need to track the specific index if we plan to provide a reasonable answer. That would however increase the overhead quite a bit, so I would refrain from it.

Regarding your last point: I would be in favor of removing it entirely. It can lead to a weird behavior, especially with OperationalProfile. But as you mention, that is for another PR as it would be breaking. We could introduce it into Milestone 1.

Copy link
Copy Markdown
Collaborator

@JulStraus JulStraus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

In the current stage, we still only support, e.g., StrategicProfile + OperationalProfile and StrategicProfile + FixedProfile but not StrategicProfile + ScenarioProfile or StrategicProfile+RepresentativeProfile.

Shall we adjust it? It definitely may result in some weird error messages for users that do not have consistent profiles, so I am a bit uncertain at the moment whether we should directly include it. What are your thoughts @hellemo?

@trulsf
Copy link
Copy Markdown
Member Author

trulsf commented Apr 9, 2026

I would rather leave the more complex combinations of combining profiles until we had some experience and/or usage of the new features. If there is a need they could be added at a later stage.

I have added an issue #93 to further discuss the behavior of profiles with too few values.

Copy link
Copy Markdown
Collaborator

@JulStraus JulStraus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it is beneficial to leave it to another PR.

@trulsf trulsf merged commit 1551e01 into main Apr 13, 2026
6 checks passed
@trulsf trulsf deleted the tf/add_profiles branch April 13, 2026 13:54
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.

2 participants