You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Updated the PeriodDemandSink test set
* Reworked PeriodDemandSink based on PartitionDuration
* Allow for time profiles for period_duration
* Included legacy constructor for `PeriodDemandSink`
---------
Co-authored-by: Jon Vegard Venås <jon.venas@ife.no>
Copy file name to clipboardExpand all lines: NEWS.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,14 @@
1
1
# Release notes
2
2
3
+
## Unversioned
4
+
5
+
### Breaking changes
6
+
7
+
#### Rework of `PeriodDemandSink`
8
+
9
+
* Rewrote `PeriodDemandSink` with `PeriodPartition` (introduced in `TimeStruct` 0.9.12) to increase flexibility of node with respect to the time structure.
10
+
* Rewriting changed input arguments as well as behavior of the node.
11
+
3
12
## Version 0.3.0 (2026-04-16)
4
13
5
14
### Breaking changes
@@ -9,7 +18,7 @@
9
18
* Early retirement changes the model behavior.
10
19
* Model worked without adjustments except for compatibility updates.
11
20
* Breaking change still included to maintain the possibility to do bug fixes in version 0.1.x for existing models with `EnergyModelsBase` v0.9.x.
12
-
*UpdMoved from `Data` to `ExtensionData` in fields and tests.
21
+
*Moved from `Data` to `ExtensionData` in fields and tests.
13
22
* Improved `MinUpDownTimeNode`:
14
23
* Rewrote the function `constraints_capacity` based on core functionality.
15
24
* Updated the test set to identify all potential problems with the node.
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@
13
13
> The different node types are partly experimental.
14
14
> They have furthermore some limitations with respect to the chosen `TimeStructure` or whether they are able to handle investments.
15
15
> As a consequence, it is advised to read the documentation for each node to identify their usefulness.
16
-
> Is is planned to removesome nodes and rewrite the behaviour of other nodes to improve their flexibility.
16
+
> Is is planned to remove some nodes and rewrite the behaviour of other nodes to improve their flexibility.
17
17
>
18
-
> Version 0.2.8 is based on [`EnergyModelsBase` v0.8](https://energymodelsx.github.io/EnergyModelsBase.jl/v0.8/) while version 0.2.9 is adding support for [`EnergyModelsBase` v0.9](https://energymodelsx.github.io/EnergyModelsBase.jl/v0.9/).
18
+
> Among others, using `PeriodDemandSink` in combination with `EnergyModelsGUI` results in errors when trying to access field values with `PartitionProfile`.
19
19
20
20
## Usage
21
21
@@ -26,7 +26,7 @@ Please refer to the *[documentation](https://energymodelsx.github.io/EnergyModel
26
26
27
27
## Cite
28
28
29
-
If you find `EnergyModelsFlex` useful in your work, we kindly request that you cite the following [publication](https://doi.org/10.69997/sct.119164):
29
+
If you find `EnergyModelsFlex` useful in your work, we kindly request that you cite the following *[publication](https://doi.org/10.69997/sct.119164)*:
# [Update your model to the latest versions](@id how_to-update)
2
+
3
+
`EnergyModelsFlex` is still in a pre-release version.
4
+
Hence, there are frequently breaking changes occuring, although we plan to keep backwards compatibility.
5
+
This document is designed to provide users with information regarding how they have to adjust their nodes to keep compatibility to the latest changes.
6
+
7
+
## [Adjustments from 0.3.0](@id how_to-update-03)
8
+
9
+
The introduction of `PartitionProfile` in *[`TimeStruct` v0.9.12](https://github.com/sintefore/TimeStruct.jl/releases/tag/v0.9.12)* allowed a rewrite of `PeriodDemandSink`:
10
+
11
+
```julia
12
+
# The previous nodal description for a `PeriodDemandSink` was given by:
Copy file name to clipboardExpand all lines: docs/src/nodes/sink/perioddemand.md
+48-31Lines changed: 48 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,12 @@ This node can, *e.g.*, be combined with [`MinUpDownTimeNode`](@ref), to allow pr
10
10
11
11
!!! warning "TimeStructure for node"
12
12
This node is designed for **uniform or repetitive duration of operational periods**.
13
-
Irregular durations may cause misalignment of shifted loads, especially if the field `period_length` does not align with the chosen [`SimpleTimes`](@extref TimeStruct.SimpleTimes) structure representing the operational periods.
13
+
Irregular durations may cause misalignment of shifted loads, especially if the field `period_duration` does not align with the chosen [`SimpleTimes`](@extref TimeStruct.SimpleTimes) structure representing the operational periods.
14
+
15
+
!!! warning "`PeriodDemandSink` and `EnergyModelsGUI`"
16
+
Some of the fields of this node cannot be represented in `EnergyModelsGUI`.
17
+
The reason for that limitation is that `EnergyModelsGUI` does not yet support partitions of `TimePeriod`s.
18
+
`EnergyModelsGUI` can still be utilized for all other fields.
14
19
15
20
## [Introduced type and its fields](@id nodes-perioddemandsink-fields)
16
21
@@ -33,12 +38,11 @@ The standard fields are given as:
33
38
-**`penalty::Dict{Symbol,<:TimeProfile}`**:\
34
39
The penalty dictionary is used for providing penalties for soft constraints to allow for both over and under delivering the demand.\
35
40
It must include the fields `:surplus` and `:deficit`.
36
-
In addition, it is crucial that the sum of both values is larger than 0 to avoid an unconstrained model.
41
+
In addition, it is crucial that the sum of both values in each demand period is larger than 0 to avoid an unconstrained model.
37
42
38
43
!!! warning "Chosen values"
39
-
The current implementation does not represent the proper cost due to the summation.
40
-
Instead, you must consider the duration of an operational period and the field `period_length` when providing a value.
41
-
In this case, the value should be multiplied by ``1/period\_length(n) \times duration(t)``.
44
+
The implementation is relative to the chosen `period_duration` (see below).
45
+
If the period duration is ``24``, then the cost is for the unsatisfied demand within the ``24`` demand period, multiplied with the probability and the repetitons within a strategic period.
42
46
43
47
-**`input::Dict{<:Resource,<:Real}`**:\
44
48
The field `input` includes [`Resource`](@extref EnergyModelsBase.Resource)s with their corresponding conversion factors as dictionaries.\
@@ -60,18 +64,27 @@ The standard fields are given as:
60
64
61
65
[`AbstractPeriodDemandSink`](@ref EnergyModelsFlex.AbstractPeriodDemandSink)s require additional fields to specify both the periods and their respective demands:
62
66
63
-
-**`period_length::Int`**:\
64
-
Defines how many operational periods are included in a single demand period.\
65
-
For instance, if the duration of the operational periods is 1 hour and `period_length = 24`, then each demand period spans one day.
66
-
The demand of this node (for a given day, see below) must then be filled on a daily basis, without any restrictions on *when* during the day the demand must be filled.
67
+
-**`period_duration::TimeProfile`**:\
68
+
Defines the total duration of a single demand period.\
69
+
For instance, if the duration of 1 of the operational time structure is 1 hour and `period_duration = FixedProfile(24)`, then each demand period spans one day.
70
+
The demand of this node (for a given day, see below) must then be filled on a daily basis, without any restrictions on *when* during the day the demand must be filled given the available capacity.\
71
+
Due to a constructor, it can either be specified as number (the same duration in all demand periods), as a vector (varying duration of each demand period), or as a time profile (*e.g.*, varying period durations due to varying operational time structures).
72
+
It cannot be specified as `OperationalProfile`.
73
+
74
+
-**`period_demand::TimeProfile`**:\
75
+
The total demand to be met during each demand period.
76
+
The length of this time profile should match the number of periods (*e.g.*, days) in the time structure.
77
+
If the time structure represents one year with hourly resolution and the demand periods correspond to a day, this time profile must then have 365 elements.
67
78
68
-
-**`period_demand::Vector{<:Real}`**:\
69
-
The total demand to be met during each demand period. The length of this vector should match the number of periods (*e.g.*, days) in the time structure. If the time structure represents on year with hourly resolution, this vector must then have 365 elements.
79
+
It is best to utilize the [`PartitionProfile`](@extref TimeStruct.PartitionProfile) type if the demand is varying.
80
+
If it is constant, you can also utilize [`StrategicProfile`][@extref TimeStruct.StrategicProfile], [`RepresentativeProfile`][@extref TimeStruct.RepresentativeProfile], or [`ScenarioProfile`][@extref TimeStruct.ScenarioProfile], depending on your chosen time structure.
81
+
It cannot be specified as `OperationalProfile`.
70
82
71
83
!!! warning "Time consistency"
72
-
Ensure that the `period_demand` vector length aligns with the total time horizon divided by `period_length`. Mismatches can lead to indexing errors or inconsistent demand enforcement.
84
+
Ensure that the `period_demand` time profile length aligns with the operational time horizon duration divided by `period_duration`
85
+
Mismatches can lead to indexing errors or inconsistent demand enforcement.
73
86
74
-
These fields are at the 2ⁿᵈ and 3ʳᵈ position below the field `id` as shown in [`PeriodDemandSink`](@ref).
87
+
These fields are at the 3ʳᵈ and 4ᵗʰ position below the field `cap` as shown in [`PeriodDemandSink`](@ref).
[`AbstractPeriodDemandSink`](@ref EnergyModelsFlex.AbstractPeriodDemandSink) nodes declare in addition several variables through dispatching on the method [`EnergyModelsBase.variables_element()`](@ref) for including constraints for deficits and surplus for individual resources as well as what the fraction satisfied by each resource.
108
-
These variables are for a [`AbstractPeriodDemandSink`](@ref EnergyModelsFlex.AbstractPeriodDemandSink) node ``n`` in demand periods ``i``:
121
+
These variables are for a [`AbstractPeriodDemandSink`](@ref EnergyModelsFlex.AbstractPeriodDemandSink) node ``n`` in demand periods ``t_pd``:
109
122
110
-
-``\texttt{demand\_sink\_surplus}[n, i]``:\
111
-
Surplus of energy delivered beyond the required `period_demand`in demand period `i`.
112
-
-``\texttt{demand\_sink\_deficit}[n, i]``:\
113
-
Deficit of energy delivered relative to the `period_demand`in period `i`.
123
+
-``\texttt{demand\_sink\_surplus}[n, t_pd]``:\
124
+
Surplus of energy delivered beyond the required `period_demand`of demand period `t_pd`.
125
+
-``\texttt{demand\_sink\_deficit}[n, t_pd]``:\
126
+
Deficit of energy delivered relative to the `period_demand`of demand period `t_pd`.
where ``i_t`` is the period index such that ``t \in P_{i_t}``.
184
-
185
-
!!! tip "The function `scale_op_sp`"
186
-
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and investment periods.
187
-
It also takes into account potential operational scenarios and their probability as well as representative periods.
202
+
!!! note "`scale_op_sp` and `duration`"
203
+
The function [`scale_op_sp(t_inv, t)`](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and investment periods including the `duration` of each operational period.
204
+
It hence must be divided by the `duration` of the first operational period to avoid including the duration of the operational period.
0 commit comments