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
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Release Notes

## Unversioned
## Version 0.9.0 (2026-06-04)

* Renamed `Data` to `ExtensionData` and `constraints_data` to `constraints_ext_data` as introduced in [`EnergyModelsBase` v0.9.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.9.1).
This simplifies future maintainability.
* Made the parametric composite type `CO2Storage` to require an `Accumulating` `StorageBehavior`.
* Made the functions `previous_level` more restrictive on the `StorageBehavior` to allow for using other `Accumulating` behaviors.

Expand Down Expand Up @@ -117,7 +119,8 @@
### Switch to `TimeStruct`

* Switched the time structure representation to `TimeStruct`.
* `TimeStruct` is implemented with only the basis features that were available in `TimesStructures`. This implies that neither operational nor strategic uncertainty is included in the model.
* `TimeStruct` is implemented with only the basis features that were available in `TimesStructures`.
This implies that neither operational nor strategic uncertainty is included in the model.

## Version 0.2.0 (2023-05-30)

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsCO2"
uuid = "84b3f4d7-d799-4a5d-b06c-25c90dcfcad7"
authors = ["Sigmund Eggen Holm, Julian Straus"]
version = "0.8.0"
version = "0.9.0"

[deps]
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/how-to/incorporate_retrofit.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ The new type only has the following requirements:
1. Is has to be a subtype of [`NetworkNodeWithRetrofit`](@ref).
This implies that said node is a `NetworkNode`, although we are currently thinking about changing the overall structure.
2. The type **must** have either a field called `co2_proxy` or you have to add a method to the function [`EnergyModelsCO2.co2_proxy`](@ref) of `EnergyModelsCO2`.
3. CO₂ capture data has to be incorporated as one of the [`CaptureData`](@extref EnergyModelsBase.CaptureData) subtypes as described on *[Data functions](@extref EnergyModelsBase man-data_fun)*.
3. CO₂ capture data has to be incorporated as one of the [`CaptureData`](@extref EnergyModelsBase.CaptureData) subtypes as described on *[ExtensionData functions](@extref EnergyModelsBase man-data_fun)*.
4. If you have created a new method for [`EnergyModelsBase.create_node`](@extref EnergyModelsBase), you have to include in said method the following code lines

```julia
for data ∈ node_data(n)
constraints_data(m, n, 𝒯, 𝒫, modeltype, data)
constraints_ext_data(m, n, 𝒯, 𝒫, modeltype, data)
end
```

and the node **must** have either a field called `data` or you have to add a method to the function [`EnergyModelsBase.node_data`](@extref EnergyModelsBase) to be able to access the data.\
Alternatively, you can also manually extract the capture data and call directlty the functions [`constraints_data`](@extref EnergyModelsBase.constraints_data)
Alternatively, you can also manually extract the capture data and call directlty the functions [`constraints_ext_data`](@extref EnergyModelsBase.constraints_ext_data)
2 changes: 1 addition & 1 deletion docs/src/library/internals/methods-EMB.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ EnergyModelsBase.create_node
EnergyModelsBase.constraints_flow_out
EnergyModelsBase.constraints_level_aux
EnergyModelsBase.constraints_capacity
EnergyModelsBase.constraints_data
EnergyModelsBase.constraints_ext_data
```

## [Utility methods](@id int-methods_EMB-util)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/library/public.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CCSRetroFit
NetworkCCSRetrofit
```

## [Data types](@id lib-pub-data)
## [ExtensionData types](@id lib-pub-data)

### [`CaptureData` for `CCSRetrofit`](@id lib-pub-data-em_data)

Expand Down
10 changes: 5 additions & 5 deletions docs/src/nodes/retrofit.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The standard fields are given as:
The CO₂ proxy resource is automatically included in the `input` dictionary through providing additional methods to `EMB.inputs`.
Requires the incorporation of the CO₂ resource in the `output` dictionary, although the exact value is not relevant.
It is furthermore possible to specify additional reenergy required for capturing CO₂ using a conversion factor (*e.g.*, MWh/t CO₂).
- **`data::Vector{Data}`**:\
- **`data::Vector{ExtensionData}`**:\
An entry for providing additional data to the model.
The `data` vector must include [`CaptureData`](@extref EnergyModelsBase.CaptureData) for both [`RefNetworkNodeRetrofit`](@ref) and [`CCSRetroFit`](@ref).
It can include additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) is used.
Expand Down Expand Up @@ -185,12 +185,12 @@ These standard constraints are:
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and strategic periods.
It also takes into account potential operational scenarios and their probability as well as representative periods.

- `constraints_data`:\
- `constraints_ext_data`:\
This function is only called for specified data of the nodes, see above.
This function is extended with multiple methods for both `CCSRetroFit` and `RefNetworkNodeRetrofit`.
The individual methods are explained below.

The outlet flow constraint for a [`RefNetworkNodeRetrofit`](@ref) node is requires introducing new methods for the function `constraints_flow_out` as the outlet flow of the CO₂ proxy is calculated in the function `constraints_data` as outlined in *[Standard constraints](@ref nodes-CCS_retrofit-math-con-stand)*.
The outlet flow constraint for a [`RefNetworkNodeRetrofit`](@ref) node is requires introducing new methods for the function `constraints_flow_out` as the outlet flow of the CO₂ proxy is calculated in the function `constraints_ext_data` as outlined in *[Standard constraints](@ref nodes-CCS_retrofit-math-con-stand)*.
This constraint is given by:

```math
Expand All @@ -199,7 +199,7 @@ outputs(n, p) \times \texttt{cap\_use}[n, t]
\qquad \forall p \in outputs(n) \setminus \{co2\_proxy(n)\}
```

The introduction of the CO₂ capture unit as retrofit option requires introducing new methods for the function `constraints_data` for all [`CaptureData`](@extref EnergyModelsBase.CaptureData) as described on *[Data functions](@extref EnergyModelsBase man-data_fun-emissions)*.
The introduction of the CO₂ capture unit as retrofit option requires introducing new methods for the function `constraints_ext_data` for all [`CaptureData`](@extref EnergyModelsBase.CaptureData) as described on *[ExtensionData functions](@extref EnergyModelsBase man-data_fun-emissions)*.
In all methods, the process emissions of the other [`ResourceEmit`](@extref EnergyModelsBase.ResourceEmit)s, that is all emissions resources except for CO₂, are calculated as

```math
Expand Down Expand Up @@ -396,7 +396,7 @@ while the CO₂ outlet flow is given as:

##### [Constraints calculated in `create_node`](@id nodes-CCS_retrofit-math-con-add-node)

The inlet flow constraint for a [`CCSRetroFit`](@ref) node is calculated separately as the inlet flow of the CO₂ proxy is calculated in the function `constraints_data` as outlined in *[Standard constraints](@ref nodes-CCS_retrofit-math-con-stand)*.
The inlet flow constraint for a [`CCSRetroFit`](@ref) node is calculated separately as the inlet flow of the CO₂ proxy is calculated in the function `constraints_ext_data` as outlined in *[Standard constraints](@ref nodes-CCS_retrofit-math-con-stand)*.
This constraint is given by:

```math
Expand Down
4 changes: 2 additions & 2 deletions docs/src/nodes/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The standard fields are given as:
In the case of a CO₂ source, `output` should always include *CO₂*.
It is also possible to include other resources which are produced with a given correlation with CO₂.\
All values have to be non-negative.
- **`data::Vector{Data}`**:\
- **`data::Vector{ExtensionData}`**:\
An entry for providing additional data to the model.
In the current version, it is only relevant for additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) is used or for additional emission data through [`EmissionsProcess`](@extref EnergyModelsBase.EmissionsProcess).
The latter would correspond to uncaptured CO₂ that should be included in the analyses.
Expand Down Expand Up @@ -133,7 +133,7 @@ These standard constraints are:
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and strategic periods.
It also takes into account potential operational scenarios and their probability as well as representative periods.

- `constraints_data`:\
- `constraints_ext_data`:\
This function is only called for specified data of the CO₂ source, see above.

The function `constraints_flow_out` is extended with a new method for CO₂ source nodes to allow the inclusion of CO₂:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/nodes/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The standard fields are given as:
It is also possible to include other resources which are required with a given correlation to the stored CO₂.
One example would be *Power* in the case of electricity requirements for storing CO₂.\
All values have to be non-negative.
- **`data::Vector{Data}`**:\
- **`data::Vector{ExtensionData}`**:\
An entry for providing additional data to the model.
In the current version, it is only relevant for additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) is used.

Expand Down Expand Up @@ -161,7 +161,7 @@ These standard constraints are:
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and strategic periods.
It also takes into account potential operational scenarios and their probability as well as representative periods.

- `constraints_data`:\
- `constraints_ext_data`:\
This function is only called for specified data of the CO₂ storage node, see above.

!!! info "Implementation of OPEX"
Expand Down
4 changes: 2 additions & 2 deletions examples/ccs_retrofit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function generate_co2_retrofit_example_data()
# Line above: CO2_proxy does not have to be specified as we add a method to
# `EMB.outputs`
CO2_proxy, # Instance of the `CO2_proxy`
Data[CaptureEnergyEmissions(1.0)], # Capture data for the node.
ExtensionData[CaptureEnergyEmissions(1.0)], # Capture data for the node.
# All energy emissions are captured
),
CCSRetroFit(
Expand All @@ -92,7 +92,7 @@ function generate_co2_retrofit_example_data()
# Line above: CO2 is required as input for variable definition, but the
# value does not matter
CO2_proxy, # Instance of the `CO2_proxy`
Data[CaptureEnergyEmissions(0.9)], # Capture data for the node.
ExtensionData[CaptureEnergyEmissions(0.9)], # Capture data for the node.
# All energy emission from the energy to the `CCSRetroFit` are captured.
),
CO2Storage(
Expand Down
3 changes: 1 addition & 2 deletions src/constraint_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Function for creating the constraint on the outlet flow from `CO2Source`.
The standard `constraints_flow_out` function does not allow CO₂ as an outlet flow as the
CO₂ outlet flow is specified in the `constraints_data` function to implement CO₂ capture.
CO₂ outlet flow is specified in the `constraints_ext_data` function to implement CO₂ capture.
"""
function EMB.constraints_flow_out(m, n::CO2Source, 𝒯::TimeStructure, modeltype::EnergyModel)
# Declaration of the required subsets, excluding CO2, if specified
Expand Down Expand Up @@ -52,7 +52,6 @@ Function for creating the Δ constraint for the level of a reference storage nod
function EMB.constraints_level_aux(m, n::CO2Storage, 𝒯, 𝒫, modeltype::EnergyModel)
# Declaration of the required subsets
𝒯ᴵⁿᵛ = strategic_periods(𝒯)
p_stor = storage_resource(n)

# Constraint for the change in the level in a given operational period
@constraint(m, [t ∈ 𝒯],
Expand Down
18 changes: 9 additions & 9 deletions src/data_functions.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

"""
EMB.constraints_data(
EMB.constraints_ext_data(
m,
n::NetworkNodeWithRetrofit,
𝒯,
Expand All @@ -16,7 +16,7 @@ process when CO₂ capture is included as retrofit. It works similar to the appr
The functions are updated for a [`NetworkNodeWithRetrofit`](@ref)-node as the output is the
CO₂ proxy and not CO₂.
"""
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::NetworkNodeWithRetrofit,
𝒯,
Expand Down Expand Up @@ -51,7 +51,7 @@ function EMB.constraints_data(
# Constraint for the outlet of the CO2 proxy
@constraint(m, [t ∈ 𝒯], m[:flow_out][n, t, CO2_proxy] == CO2_tot[t] * co2_capture(data))
end
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::NetworkNodeWithRetrofit,
𝒯,
Expand Down Expand Up @@ -87,7 +87,7 @@ function EMB.constraints_data(
# Constraint for the outlet of the CO2 proxy
@constraint(m, [t ∈ 𝒯], m[:flow_out][n, t, CO2_proxy] == CO2_tot[t] * co2_capture(data))
end
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::NetworkNodeWithRetrofit,
𝒯,
Expand Down Expand Up @@ -125,7 +125,7 @@ function EMB.constraints_data(
end

"""
EMB.constraints_data(m, n::CCSRetroFit, 𝒯, 𝒫, modeltype::EnergyModel, data::EmissionsData)
EMB.constraints_ext_data(m, n::CCSRetroFit, 𝒯, 𝒫, modeltype::EnergyModel, data::EmissionsData)

Constraints functions for calculating both the emissions and amount of CO₂ captured in the
CO₂ capture unit.
Expand All @@ -143,7 +143,7 @@ There exist several configurations for incorporation of CO₂ capture:
The functions are updated for a `CCSRetroFit`-node as CO₂ emissions require a different
calculation due to the inclusion of the CO₂ proxy resource for the flue gas.
"""
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::CCSRetroFit,
𝒯,
Expand Down Expand Up @@ -195,7 +195,7 @@ function EMB.constraints_data(
)
)
end
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::CCSRetroFit,
𝒯,
Expand Down Expand Up @@ -246,7 +246,7 @@ function EMB.constraints_data(
)
)
end
function EMB.constraints_data(
function EMB.constraints_ext_data(
m,
n::CCSRetroFit,
𝒯,
Expand Down Expand Up @@ -296,7 +296,7 @@ function EMB.constraints_data(
)
)
end
function EMB.constraints_data(m, n::CCSRetroFit, 𝒯, 𝒫, modeltype::EnergyModel, data::CaptureFlueGas)
function EMB.constraints_ext_data(m, n::CCSRetroFit, 𝒯, 𝒫, modeltype::EnergyModel, data::CaptureFlueGas)

# Declaration of the required subsets.
CO2 = co2_instance(modeltype)
Expand Down
22 changes: 11 additions & 11 deletions src/datastructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ is that is allows for CO₂ as outlet.
- **`opex_var::TimeProfile`** is the variational operational costs per energy unit produced.
- **`opex_fixed::TimeProfile`** is the fixed operational costs.
- **`output::Dict{<:Resource, <:Real}`** are the generated `Resource`s with conversion value `Real`.
- **`data::Array{<:Data}`** is the additional data (e.g. for investments). The field `data`
- **`data::Array{<:ExtensionData}`** is the additional data (e.g. for investments). The field `data`
is conditional through usage of a constructor.
"""
struct CO2Source <: Source
Expand All @@ -28,7 +28,7 @@ struct CO2Source <: Source
opex_var::TimeProfile
opex_fixed::TimeProfile
output::Dict{<:Resource,<:Real}
data::Array{<:Data}
data::Array{<:ExtensionData}
end
function CO2Source(
id::Any,
Expand All @@ -37,7 +37,7 @@ function CO2Source(
opex_fixed::TimeProfile,
output::Dict{<:Resource,<:Real},
)
return CO2Source(id, cap, opex_var, opex_fixed, output, Data[])
return CO2Source(id, cap, opex_var, opex_fixed, output, ExtensionData[])
end

"""
Expand Down Expand Up @@ -68,7 +68,7 @@ is not a required input due to the utilization of an outer constructor.
fixed OPEX.
- **`stor_res::Resource`** is the stored `Resource`.
- **`input::Dict{<:Resource, <:Real}`** are the input `Resource`s with conversion value `Real`.
- **`data::Array{<:Data}`** is the additional data (e.g. for investments). The field `data`
- **`data::Array{<:ExtensionData}`** is the additional data (e.g. for investments). The field `data`
is conditional through usage of a constructor.
"""
struct CO2Storage{T<:Accumulating} <: Storage{T}
Expand All @@ -79,7 +79,7 @@ struct CO2Storage{T<:Accumulating} <: Storage{T}

stor_res::ResourceEmit
input::Dict{<:Resource,<:Real}
data::Array{<:Data}
data::Array{<:ExtensionData}
end
function CO2Storage{T}(
id,
Expand All @@ -94,7 +94,7 @@ function CO2Storage{T}(
level,
stor_res,
input,
Data[],
ExtensionData[],
)
end
function CO2Storage(
Expand All @@ -103,7 +103,7 @@ function CO2Storage(
level::EMB.UnionCapacity,
stor_res::Resource,
input::Dict{<:Resource,<:Real},
data=Data[],
data=ExtensionData[],
)
return CO2Storage{AccumulatingStrategic}(
id,
Expand Down Expand Up @@ -164,7 +164,7 @@ The `co2_proxy` does not have to be specified as `output` resource.
`co2_proxy` is required to be included to be available to have CO₂ capture applied properly.
- **`co2_proxy::Resource`** is the instance of the `Resource` used for calculating internally
the CO₂ flow from the `RefNetworkNodeRetrofit` to the `CCSRetroFit` node.
- **`data::Array{<:Data}`** is the additional data (e.g. for investments).
- **`data::Array{<:ExtensionData}`** is the additional data (e.g. for investments).
"""
struct RefNetworkNodeRetrofit <: NetworkNodeWithRetrofit
id::Any
Expand All @@ -174,7 +174,7 @@ struct RefNetworkNodeRetrofit <: NetworkNodeWithRetrofit
input::Dict{<:Resource,<:Real}
output::Dict{<:Resource,<:Real}
co2_proxy::Resource
data::Array{<:Data}
data::Array{<:ExtensionData}
end

"""
Expand Down Expand Up @@ -209,7 +209,7 @@ The `co2_proxy` does not have to be specified as `input` resource.
properly.
- **`co2_proxy::Resource`** is the instance of the `Resource` used for calculating internally
the CO₂ flow from the `RefNetworkNodeRetrofit` to the `CCSRetroFit` node.
- **`data::Array{<:Data}`** is the additional data (e.g. for investments).
- **`data::Array{<:ExtensionData}`** is the additional data (e.g. for investments).
"""
struct CCSRetroFit <: NetworkNode
id::Any
Expand All @@ -219,7 +219,7 @@ struct CCSRetroFit <: NetworkNode
input::Dict{<:Resource,<:Real}
output::Dict{<:Resource,<:Real}
co2_proxy::Resource
data::Array{<:Data}
data::Array{<:ExtensionData}
end

"""
Expand Down
6 changes: 3 additions & 3 deletions src/legacy_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
stor_res::ResourceCarrier,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array{<:Data},
data::Array{<:ExtensionData},
)

Legacy constructor for a `CO2Storage`.
Expand All @@ -26,7 +26,7 @@ function CO2Storage(
stor_res::Resource,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array{<:Data},
data::Array{<:ExtensionData},
)
@warn(
"The used implementation of a `CO2Storage` will be discontinued in the near future.\n" *
Expand Down Expand Up @@ -55,7 +55,7 @@ function CO2Storage(
opex_fixed::TimeProfile,
stor_res::Resource,
input::Dict{<:Resource,<:Real},
data::Array{<:Data},
data::Array{<:ExtensionData},
)
@warn(
"The used implementation of a `CO2Storage` will be discontinued in the near future.\n" *
Expand Down
Loading
Loading