Skip to content

Improvement of CapacityCostLink#13

Merged
JulStraus merged 4 commits into
mainfrom
enhance/CapacityCostLink
Jul 1, 2026
Merged

Improvement of CapacityCostLink#13
JulStraus merged 4 commits into
mainfrom
enhance/CapacityCostLink

Conversation

@JulStraus

Copy link
Copy Markdown
Member

The existing version of CapacityCostLink was not really flexible with respect to the chosen time structure and potentially error prone with respect to the chosen durations. As a consequence, its application required carefulness regarding the parameter choices.

TimeStruct v0.9.12 introduced partitions of periods which allowed to simplify the overall structure. This PR adapts now the CapacityCostLink to the new format.

Important

This PR is breaking as we change the meaning of the fields of CapacityCostLink. I still decided not to increase the version number yet as a new subtype of AbstractPeriodDemandSink will be included for the next major release.

* Constraints implementation adjusted
* Test adjusted based on requirements
* Checks not yet adjusted
* Documentation not yet adjusted
@JulStraus JulStraus requested a review from tillho June 30, 2026 09:34
@JulStraus JulStraus added the enhancement New feature or request label Jun 30, 2026

@tillho tillho left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

I feel like the update-models section is the part most people will read when getting an error after updating. So I tried to add some context that makes it easier to understand what has changed.

Comment thread docs/src/how-to/update-models.md Outdated
# old behavior, corresponding to 2 periods
cap_period_duration = 2

# new behavior, corresponding to periods whocse duration sums to at least 4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

whocse -> whose

I think it might make more sense to change the numbers so they describe the same thing?
before = 2, after = 10
or
before = 5, after = 4

and add a sentence like:
"Both cases create two periods with a duration of 10, but instead of specifying the number of periods, we now define the duration of each period"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I agree. It makes significantly more sense to have both examples the same.

Comment thread docs/src/how-to/update-models.md Outdated

```julia
# time structure
ts = Twolevel(2, 1, SimpleTimes(10, 2); op_per_strat=8760.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TwoLevel

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

Comment thread docs/src/how-to/update-models.md Outdated
# old behavior, corresponding to 5 periods a 1752 duration based on `op_per_strat`
cap_period_duration = [1752, 1752, 1752, 1752, 1752]

# new behavior, corresponding to 5 periods a 4 duration based on `SimpleTimes`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Might be nice to add a comment like this, since the jump from 1752 to 4 looks arbitrary at first glance:
"# With the scaling factor 8760 / (10 * 2) = 438, each new value of 4 corresponds to the same 1752 as before (4 * 438 = 1752), i.e. the same 5 chunks of 2 time steps each."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Included although I slightly rephrased it.

@JulStraus JulStraus left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I implemented all changes and will merge once the CI passed.

Comment thread docs/src/how-to/update-models.md Outdated
# old behavior, corresponding to 2 periods
cap_period_duration = 2

# new behavior, corresponding to periods whocse duration sums to at least 4

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I agree. It makes significantly more sense to have both examples the same.

Comment thread docs/src/how-to/update-models.md Outdated

```julia
# time structure
ts = Twolevel(2, 1, SimpleTimes(10, 2); op_per_strat=8760.0)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

Comment thread docs/src/how-to/update-models.md Outdated
# old behavior, corresponding to 5 periods a 1752 duration based on `op_per_strat`
cap_period_duration = [1752, 1752, 1752, 1752, 1752]

# new behavior, corresponding to 5 periods a 4 duration based on `SimpleTimes`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Included although I slightly rephrased it.

@JulStraus JulStraus merged commit 18a8d2c into main Jul 1, 2026
5 checks passed
@JulStraus JulStraus deleted the enhance/CapacityCostLink branch July 1, 2026 07:21
JulStraus referenced this pull request Jul 6, 2026
* New sink based on `PeriodDemandSink`
* Demand now specified per strategic period
* Individual penalties for demand periods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants