Skip to content

Commit fa8bbd6

Browse files
authored
Minor updates (#75)
1 parent 6d4ff5c commit fa8bbd6

10 files changed

Lines changed: 50 additions & 25 deletions

File tree

src/checks.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ a [`Sink`](@ref) node.
857857
- The values of the dictionary `input` are required to be non-negative.
858858
- The dictionary `penalty` is required to have the keys `:deficit` and `:surplus`.
859859
- The sum of the values `:deficit` and `:surplus` in the dictionary `penalty` has to be
860-
non-negative to avoid an infeasible model.
860+
non-negative to avoid an infeasible model.
861861
"""
862862
function check_node_default(n::Sink, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)
863863
@assert_or_log(
@@ -870,11 +870,10 @@ function check_node_default(n::Sink, 𝒯, modeltype::EnergyModel, check_timepro
870870
)
871871
@assert_or_log(
872872
:surplus keys(n.penalty) && :deficit keys(n.penalty),
873-
"The entries :surplus and :deficit are required in the field `penalty`"
873+
"The entries `:surplus` and `:deficit` are required in the field `penalty`."
874874
)
875875

876876
if :surplus keys(n.penalty) && :deficit keys(n.penalty)
877-
# The if-condition was checked above.
878877
@assert_or_log(
879878
all(surplus_penalty(n, t) + deficit_penalty(n, t) 0 for t 𝒯),
880879
"An inconsistent combination of `:surplus` and `:deficit` leads to an infeasible model."

src/constraint_functions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,9 @@ end
176176
function constraints_flow_out(m, n::Storage, 𝒯::TimeStructure, modeltype::EnergyModel)
177177
# Declaration of the required subsets
178178
p_stor = storage_resource(n)
179-
𝒫ᵒᵘᵗ = res_not(outputs(n), co2_instance(modeltype))
180179

181180
# Constraint for the individual output stream connections
182-
@constraint(m, [t 𝒯, p 𝒫ᵒᵘᵗ],
181+
@constraint(m, [t 𝒯],
183182
m[:stor_discharge_use][n, t] == m[:flow_out][n, t, p_stor]
184183
)
185184
end

src/structures/data.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Data = ExtensionData
1111
struct EmptyData <: ExtensionData end
1212

1313
"""
14-
EmissionsData{T<:Union{TimeProfile,Float64}} <: ExtensionData
14+
abstract type EmissionsData{T<:Union{TimeProfile,Float64}} <: ExtensionData
1515
1616
Abstract type for `EmissionsData` can be used to dispatch on different types of
1717
capture configurations.
@@ -35,9 +35,17 @@ In general, the different types require the following input:
3535
"""
3636
abstract type EmissionsData{T<:Union{TimeProfile,Float64}} <: ExtensionData end
3737
"""
38-
CaptureData{T} <: EmissionsData{T}
38+
abstract type CaptureData{T} <: EmissionsData{T}
3939
4040
Supertype for all `EmissionsData` that include CO₂ capture.
41+
42+
# Types
43+
- **[`CaptureProcessEnergyEmissions`](@ref)**: Capture both the process emissions and the
44+
energy usage related emissions.
45+
- **[`CaptureProcessEmissions`](@ref)**: Capture the process emissions, but not the
46+
energy usage related emissions.
47+
- **[`CaptureEnergyEmissions`](@ref)**: Capture the energy usage related emissions, but not
48+
the process emissions. Does not require `emissions` as input.
4149
"""
4250
abstract type CaptureData{T} <: EmissionsData{T} end
4351

@@ -172,14 +180,14 @@ process_emissions(data::EmissionsEnergy{T}, p::ResourceEmit, t) where {T} =
172180
the function `process_emissions`.")
173181

174182
"""
175-
InvestmentData <: ExtensionData
183+
abstract type InvestmentData <: ExtensionData
176184
177185
Abstract type for the extra data for investing in technologies.
178186
"""
179187
abstract type InvestmentData <: ExtensionData end
180188

181189
"""
182-
StorageInvData <: InvestmentData
190+
struct StorageInvData <: InvestmentData
183191
184192
Extra investment data for storage investments. The extra investment data for storage
185193
investments can, but does not require investment data for the charge capacity of the storage
@@ -198,7 +206,7 @@ Hence, the names of the parameters have to be specified.
198206
abstract type StorageInvData <: InvestmentData end
199207

200208
"""
201-
SingleInvData <: InvestmentData
209+
struct SingleInvData <: InvestmentData
202210
203211
Extra investment data for type investments. The extra investment data has only a single
204212
field in which `AbstractInvData` has to be added.

src/structures/link.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
""" Declaration of the general type for formulation of links."""
1+
"""
2+
abstract type Formulation
3+
4+
Declaration of the general type for formulation of [`Link`](@ref)s. Formulations can be
5+
utilized to provide specific constraint functions for a [`Link`](@ref) while keeping other
6+
constraints unchanged. These subfunctions can be then utlized for several types of `Link`.
7+
"""
28
abstract type Formulation end
39

4-
""" Linear `Formulation`, that is input equals output."""
10+
"""
11+
struct Linear <: Formulation
12+
13+
Linear `Formulation`, that is input equals output."""
514
struct Linear <: Formulation end
615

716
"""
817
abstract type Link <: AbstractElement
918
10-
Declaration of the general type for links connecting nodes.
19+
General supertype for links connecting [`Node`](@ref)s.
1120
"""
1221
abstract type Link <: AbstractElement end
1322
Base.show(io::IO, l::Link) = print(io, "l_$(l.from)-$(l.to)")

src/structures/misc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ limiting the potential entries to the fields of [`PreviousPeriods`](@ref) and
66
NothingPeriod = Union{Nothing,TS.TimePeriod,TS.TimeStructure{T}} where {T}
77

88
"""
9-
PreviousPeriods{S<:NothingPeriod, T<:NothingPeriod, U<:NothingPeriod}
9+
struct PreviousPeriods{S<:NothingPeriod, T<:NothingPeriod, U<:NothingPeriod}
1010
1111
Contains the previous strategic, representative, and operational period used through the
1212
application of the `with_prev` iterator developed in `TimeStruct`.
@@ -42,7 +42,7 @@ Extracts the previous operational period (field `op`) from a [`PreviousPeriods`]
4242
op_per(prev_periods::PreviousPeriods) = prev_periods.op
4343

4444
"""
45-
CyclicPeriods{S<:NothingPeriod}
45+
struct CyclicPeriods{S<:NothingPeriod}
4646
4747
Contains information for calculating the cyclic constraints. The parameter `S` should be
4848
either an `AbstractStrategicPeriod` or `AbstractRepresentativePeriod`.

src/structures/model.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
""" Abstract type for differentation between types of models (investment, operational, ...)."""
1+
"""
2+
abstract type EnergyModel
3+
4+
A supertype for differentation between types of models (investment, operational, ...). Its
5+
main functionality is to provide new methods to the function [`objective`](@ref) and to
6+
provide global data required in several technologies.
7+
"""
28
abstract type EnergyModel end
39

410
"""
5-
OperationalModel <: EnergyModel
11+
struct OperationalModel <: EnergyModel
612
7-
Operational Energy Model without investments.
13+
Operational Energy Model without investments. The model does not discount the costs.
814
915
# Fields
1016
- **`emission_limit::Dict{<:ResourceEmit, <:TimeProfile}`** is a dictionary with
@@ -56,7 +62,7 @@ Returns the CO₂ instance used in modelling.
5662
co2_instance(modeltype::EnergyModel) = modeltype.co2_instance
5763

5864
"""
59-
AbstractInvestmentModel <: EnergyModel
65+
abstract type AbstractInvestmentModel <: EnergyModel
6066
6167
An abstract investment model type.
6268
@@ -72,7 +78,7 @@ An example for additional types is given by the inclusion of, *e.g.*, `SDDP`.
7278
abstract type AbstractInvestmentModel <: EnergyModel end
7379

7480
"""
75-
InvestmentModel <: AbstractInvestmentModel
81+
struct InvestmentModel <: AbstractInvestmentModel
7682
7783
A concrete basic investment model type based on the standard [`OperationalModel`](@ref).
7884
The concrete basic investment model is similar to an `OperationalModel`, but allows for

src/structures/node.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
""" `Node` as supertype for all technologies."""
1+
"""
2+
abstract type Node <: AbstractElement
3+
4+
A supertype for all technologies that convert a stream to another.
5+
"""
26
abstract type Node <: AbstractElement end
37
Base.show(io::IO, n::Node) = print(io, "n_$(n.id)")
48

src/structures/resource.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"""
2+
abstract type Resource
3+
24
General resource supertype to be used for the declaration of subtypes.
35
"""
46
abstract type Resource end
57
Base.show(io::IO, r::Resource) = print(io, "$(r.id)")
68

79
"""
8-
ResourceEmit{T<:Real} <: Resource
10+
struct ResourceEmit{T<:Real} <: Resource
911
1012
Resources that can be emitted (*e.g.*, CO₂, CH₄, NOₓ).
1113
@@ -22,7 +24,7 @@ struct ResourceEmit{T<:Real} <: Resource
2224
end
2325

2426
"""
25-
ResourceCarrier{T<:Real} <: Resource
27+
struct ResourceCarrier{T<:Real} <: Resource
2628
2729
Resources that can be transported and converted.
2830
These resources **cannot** be included as resources that are emitted, *e.g*, in the variable

test/test_deprecation.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
@testset "create_model" begin
32
"""
43
simple_graph()

test/test_modeltype.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
@testset "Test OperationalModel" begin
32

43
# Resources used in the analysis

0 commit comments

Comments
 (0)