Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Breaking change required as early retirement is now allowed.
* Changed the function call arguments for [`add_investment_constraints`](https://github.com/EnergyModelsX/EnergyModelsInvestments.jl/blob/0c84eb4fabdf6f3c188812a3555b40f2681e916b/src/model.jl#L1).
* Adjustment can change model behavior and results.
* Removed legacy constructors for `TransInvData` (you can see how to update existing models in *[the documentation of `EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/how-to/update-models/#how_to-update-05-inv_data)).
* Removed legacy constructors for `GeoAvailability`, `PipeSimple`, and `PipeLinepackSimple` (you can see how to update existing models in *[the documentation of `EnergyModelsGeography`](https://energymodelsx.github.io/EnergyModelsGeography.jl/stable/how-to/update-models/#how_to-update-09))

## Version 0.11.6 (2026-04-15)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/how-to/extend-resource-functionality.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct PotentialLossMode{T <: PotentialPower} <: TransmissionMode
opex_var::TimeProfile
opex_fixed::TimeProfile
directions::Int
data::Vector{Data}
data::Vector{<:ExtensionData}
loss_factor::Float64
end
```
Expand Down
21 changes: 16 additions & 5 deletions docs/src/how-to/update-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Furthermore, we reworked the design for inclusion of emission and OPEX variables
It is now necessary to provide a new method to the function [`EnergyModelsBase.has_emissions`](@ref) if you plan to include [`TransmissionMode`](@ref)s with emissions instead of a separate function declared within `EnergyModelsGeography`.
In addition, the function `emission` was renamed to [`emissions`](@ref EnergyModelsGeography.emissions) and, if not called with a `TimePeriod` as input argument, returns a `TimeProfile` instead of a Real.

## [Adjustments from 0.9.x](@id how_to-update-09)
## [Adjustments from 0.9.x to 0.11.x](@id how_to-update-09)

### [Key changes for transmission mode descriptions](@id how_to-update-09-mode)

Expand Down Expand Up @@ -68,9 +68,12 @@ We consider it to be more consistent with the framework philosophy to remove tha
The translations below describe the keyword constructor.
You only have to remove the entry to the field of directions.

!!! note "Timeline for constructors"
The legacy constructors for calls of the composite types of version 0.9 will be included at least until version 0.11.
However, it is recommended to update your model as soon as possible to the latest version.
!!! warning "Removal of constructors"
The legacy constructors for calls of the composite types of version 0.9 where removed in version 0.12.
This implies that you must adjust existing models to the lastest version if you have not done this yet.

`Data` was furthermore replaced with `ExtensionData` in [`EnergyModelsBase` v0.9.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.9.1).
This means that you must also replace the field information to `Vector{<:ExtensionData}` and a potential vector that is added to `ExtensionData[]`.

### [`PipeSimple`](@ref)

Expand Down Expand Up @@ -140,7 +143,7 @@ PipeLinepackSimple(
)
```

## [Adjustments from 0.7.x](@id how_to-update-07)
## [Adjustments from 0.7.x to 0.11.x](@id how_to-update-07)

### [`GeoAvailability`](@ref)

Expand All @@ -156,4 +159,12 @@ GeoAvailability(

# This translates to the following new version
GeoAvailability(id, collect(keys(input)), collect(keys(output)))

# or alternatively
GeoAvailability(id, collect(keys(input)))
```

!!! warning "Removal of constructor"
The legacy constructor for calls of the composite types of version 0.7 was removed in version 0.12.

This implies that you must adjust existing models to the lastest version if you have not done this yet.
9 changes: 4 additions & 5 deletions docs/src/library/public/emi_extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Transmission mode investments utilize the same investment data type ([`SingleInv

### [Legacy constructors](@id lib-pub-emi_ext-inv_data-leg)

We provide a legacy constructor, `TransInvData`, that uses the same input as in version 0.5.x.
If you want to adjust your model to the latest changes, please refer to the section *[Update your model to the latest version of EnergyModelsInvestments](@extref EnergyModelsInvestments how_to-update-05)*.
We provided a legacy constructor, `TransInvData`, that uses the same input as in version 0.5.x.
This legacy constructor was removed starting in version 0.12.

```@docs
TransInvData
```
This implies you must adjust your model if you still utilize the for version.
The adjustment is explained in the section *[Update your model to the latest version of EnergyModelsInvestments](@extref EnergyModelsInvestments how_to-update-05)*.
86 changes: 0 additions & 86 deletions ext/EMIExt/legacy_constructor.jl
Original file line number Diff line number Diff line change
@@ -1,86 +0,0 @@

"""
TransInvData(;
capex_trans::TimeProfile,
trans_max_inst::TimeProfile,
trans_max_add::TimeProfile,
trans_min_add::TimeProfile,
inv_mode::Investment = ContinuousInvestment(),
trans_start::Union{Real, Nothing} = nothing,
trans_increment::TimeProfile = FixedProfile(0),
capex_trans_offset::TimeProfile = FixedProfile(0),
)

Legacy constructor for a `TransInvData`.

The new storage descriptions allows now for a reduction in functions which is used
to make `EnergModelsInvestments` less dependent on `EnergyModelsBase`.

The core changes to the existing structure is the move of the required parameters to the
type Investment (_e.g._, the minimum and maximum added capacity is only required
for investment mdodes that require these parameters) as well as moving the `lifetime` to the
type [`LifetimeMode`], when required.

See the _[documentation](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/how-to/update-models)_
for further information regarding how you can translate your existing model to the new model.
"""
function EMG.TransInvData(;
capex_trans::TimeProfile,
trans_max_inst::TimeProfile,
trans_max_add::TimeProfile,
trans_min_add::TimeProfile,
inv_mode::Investment = ContinuousInvestment(),
trans_start::Union{Real, Nothing} = nothing,
trans_increment::TimeProfile = FixedProfile(0),
capex_trans_offset::TimeProfile = FixedProfile(0),
)
# Create the new investment mode structures
if isa(inv_mode, BinaryInvestment)
@error(
"BinaryInvestment() cannot use the constructor as it is not possible to " *
"deduce the capacity for the investment. You have to instead use the new " *
"types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/how-to/update-models)"
)
return
elseif isa(inv_mode, FixedInvestment)
@error(
"FixedInvestment() cannot use the constructor as it is not possible to " *
"deduce the capacity for the investment. You have to instead use the new " *
"types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/how-to/update-models)"
)
return
elseif isa(inv_mode, DiscreteInvestment)
tmp_inv_mode = DiscreteInvestment(trans_increment)
elseif isa(inv_mode, ContinuousInvestment)
tmp_inv_mode = ContinuousInvestment(trans_min_add, trans_max_add)
elseif isa(inv_mode, SemiContinuousInvestment)
tmp_inv_mode = SemiContinuousInvestment(trans_min_add, trans_max_add)
elseif isa(inv_mode, SemiContinuousOffsetInvestment)
tmp_inv_mode = SemiContinuousOffsetInvestment(trans_min_add, trans_max_add, capex_trans_offset)
end

@warn(
"The used implementation of a `TransInvData` will be discontinued in the near " *
"future. See the documentation for the new implementation using the type " *
"`SingleInvData` in the section on _How to update your model to the latest versions_.\n" *
"The core change is that we allow the individual parameters are moved to the " *
"field `inv_mode` and we allow now for `life_mode`.\n",
maxlog = 1,
)

# Create the new generalized investment data
if isnothing(trans_start)
return SingleInvData(
capex_trans,
trans_max_inst,
tmp_inv_mode,
)
else
return SingleInvData(
capex_trans,
trans_max_inst,
trans_start,
tmp_inv_mode,
)
end
end
3 changes: 0 additions & 3 deletions src/EnergyModelsGeography.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export Transmission, TransmissionMode
export RefStatic, RefDynamic
export PipeMode, PipeSimple, PipeLinepackSimple

# Export the legacy constructor for transmission investment data
export TransInvData

# Export utility functions
export getnodesinarea, nodes_in_area

Expand Down
211 changes: 0 additions & 211 deletions src/legacy_constructors.jl
Original file line number Diff line number Diff line change
@@ -1,211 +0,0 @@
"""
Legacy constructor for a `GeoAvailability`. This version will be discontinued
in the near future and replaced with the application of Arrays instead of Dictionaries.
"""
function GeoAvailability(
id,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
)

@warn("This implementation of a `GeoAvailability` will be discontinued in \
the near future. See the documentation for the new implementation not requiring using \
a dictionary. It is recommended to update the existing version to the new version.")

return GeoAvailability(id, collect(keys(input)), collect(keys(output)))
end

"""
PipeSimple(
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
directions::Int = 1
data::Vector{ExtensionData} = ExtensionData[]
)

Legacy constructor for a `PipeSimple`.
This version will be discontinued in the near future and replaced with the new version that
is no longer using the field directions.

See the *[documentation](https://energymodelsx.github.io/EnergyModelsBase.jl/stable/how-to/update-models)*
for further information regarding how you can translate your existing model to the new model.
"""
function PipeSimple(
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
directions::Int,
data::Vector{ExtensionData},
)
@warn(
"The used implementation of a `PipeSimple` will be discontinued in the near future. " *
"See the documentation for the new implementation in which we no longer utilize " *
"the keyword constructor.\n" *
"The only change required is to remove the keywords or alternatively the value for " *
"directions.",
maxlog = 1
)

tmp = PipeSimple(
id,
inlet,
outlet,
consuming,
consumption_rate,
trans_cap,
trans_loss,
opex_var,
opex_fixed,
data,
)
return tmp
end
function PipeSimple(;
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
directions::Int = 1,
data::Vector{ExtensionData} = ExtensionData[],
)
@warn(
"The used implementation of a `PipeSimple` will be discontinued in the near future. " *
"See the documentation for the new implementation in which we no longer utilize " *
"the keyword constructor.\n" *
"The only change required is to remove the keywords or alternatively the value for " *
"directions.",
maxlog = 1
)

tmp = PipeSimple(
id,
inlet,
outlet,
consuming,
consumption_rate,
trans_cap,
trans_loss,
opex_var,
opex_fixed,
data,
)
return tmp
end

"""
PipeLinepackSimple(
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
energy_share::Float64,
directions::Int = 1
data::Vector{ExtensionData} = ExtensionData[]
)

Legacy constructor for a `PipeLinepackSimple`.
This version will be discontinued in the near future and replaced with the new version that
is no longer using the field directions.

See the *[documentation](https://energymodelsx.github.io/EnergyModelsBase.jl/stable/how-to/update-models)*
for further information regarding how you can translate your existing model to the new model.
"""
function PipeLinepackSimple(
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
energy_share::Float64,
directions::Int,
data::Vector{ExtensionData},
)
@warn(
"The used implementation of a `PipeLinepackSimple` will be discontinued in the near future. " *
"See the documentation for the new implementation in which we no longer utilize " *
"the keyword constructor.\n" *
"The only change required is to remove the keywords or alternatively the value for " *
"directions.",
maxlog = 1
)

tmp = PipeLinepackSimple(
id,
inlet,
outlet,
consuming,
consumption_rate,
trans_cap,
trans_loss,
opex_var,
opex_fixed,
energy_share,
data,
)
return tmp
end
function PipeLinepackSimple(;
id::String,
inlet::EMB.Resource,
outlet::EMB.Resource,
consuming::EMB.Resource,
consumption_rate::TimeProfile,
trans_cap::TimeProfile,
trans_loss::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
energy_share::Float64,
directions::Int = 1,
data::Vector{ExtensionData} = ExtensionData[],
)
@warn(
"The used implementation of a `PipeLinepackSimple` will be discontinued in the near future. " *
"See the documentation for the new implementation in which we no longer utilize " *
"the keyword constructor.\n" *
"The only change required is to remove the keywords or alternatively the value for " *
"directions.",
maxlog = 1
)

tmp = PipeLinepackSimple(
id,
inlet,
outlet,
consuming,
consumption_rate,
trans_cap,
trans_loss,
opex_var,
opex_fixed,
energy_share,
data,
)
return tmp
end
Loading
Loading