|
1 | | - |
2 | | -function EMB.SingleInvData( |
3 | | - capex_trans::TimeProfile, |
4 | | - trans_max_inst::TimeProfile, |
5 | | - initial::Real, |
6 | | - inv_mode::Investment, |
7 | | -) |
8 | | - @warn( |
9 | | - "The used implementation of a `StartInvData` will be discontinued in the near future.\n" * |
10 | | - "You have to only change the value of the field `initial` to a `FixedProfile` " * |
11 | | - "for utilizing the new version.", |
12 | | - maxlog = 1 |
13 | | - ) |
14 | | - return SingleInvData( |
15 | | - StartInvData(capex_trans, trans_max_inst, FixedProfile(initial), inv_mode) |
16 | | - ) |
17 | | -end |
18 | | -function EMB.SingleInvData( |
19 | | - capex_trans::TimeProfile, |
20 | | - trans_max_inst::TimeProfile, |
21 | | - initial::Real, |
22 | | - inv_mode::Investment, |
23 | | - life_mode::LifetimeMode, |
24 | | -) |
25 | | - @warn( |
26 | | - "The used implementation of a `StartInvData` will be discontinued in the near future.\n" * |
27 | | - "You have to only change the value of the field `initial` to a `FixedProfile` " * |
28 | | - "for utilizing the new version.", |
29 | | - maxlog = 1 |
30 | | - ) |
31 | | - return SingleInvData( |
32 | | - StartInvData(capex_trans, trans_max_inst, FixedProfile(initial), inv_mode, life_mode), |
33 | | - ) |
34 | | -end |
35 | | - |
36 | | -function EMB.InvData(; |
37 | | - capex_cap::TimeProfile, |
38 | | - cap_max_inst::TimeProfile, |
39 | | - cap_max_add::TimeProfile, |
40 | | - cap_min_add::TimeProfile, |
41 | | - inv_mode::Investment = ContinuousInvestment(), |
42 | | - cap_start::Union{Real,Nothing} = nothing, |
43 | | - cap_increment::TimeProfile = FixedProfile(0), |
44 | | - life_mode::LifetimeMode = UnlimitedLife(), |
45 | | - lifetime::TimeProfile = FixedProfile(0), |
46 | | -) |
47 | | - |
48 | | - # Create the new investment mode structures |
49 | | - if isa(inv_mode, BinaryInvestment) |
50 | | - @error( |
51 | | - "BinaryInvestment() cannot use the constructor as it is not possible to " * |
52 | | - "deduce the capacity for the investment. You have to instead use the new " * |
53 | | - "types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/how-to/update-models)" |
54 | | - ) |
55 | | - return |
56 | | - elseif isa(inv_mode, FixedInvestment) |
57 | | - @error( |
58 | | - "FixedInvestment() cannot use the constructor as it is not possible to " * |
59 | | - "deduce the capacity for the investment. You have to instead use the new " * |
60 | | - "types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/how-to/update-models)" |
61 | | - ) |
62 | | - return |
63 | | - elseif isa(inv_mode, DiscreteInvestment) |
64 | | - tmp_inv_mode = DiscreteInvestment(cap_increment) |
65 | | - elseif isa(inv_mode, ContinuousInvestment) |
66 | | - tmp_inv_mode = ContinuousInvestment(cap_min_add, cap_max_add) |
67 | | - elseif isa(inv_mode, SemiContinuousInvestment) |
68 | | - tmp_inv_mode = SemiContinuousInvestment(cap_min_add, cap_max_add) |
69 | | - end |
70 | | - |
71 | | - @warn( |
72 | | - "The used implementation of a `InvData` will be discontinued in the near " * |
73 | | - "future. See the documentation for the new implementation using the type " * |
74 | | - "`SingleInvData` in the section on _How to update your model to the latest versions_.\n" * |
75 | | - "The core change is that we allow the individual parameters are moved to the " * |
76 | | - "fields `inv_mode` and `life_mode`.\n", |
77 | | - maxlog = 1 |
78 | | - ) |
79 | | - |
80 | | - # Create the new lifetime mode structures |
81 | | - if isa(life_mode, UnlimitedLife) |
82 | | - tmp_life_mode = UnlimitedLife() |
83 | | - elseif isa(life_mode, StudyLife) |
84 | | - tmp_life_mode = StudyLife(lifetime) |
85 | | - elseif isa(life_mode, PeriodLife) |
86 | | - tmp_life_mode = PeriodLife(lifetime) |
87 | | - elseif isa(life_mode, RollingLife) |
88 | | - tmp_life_mode = RollingLife(lifetime) |
89 | | - end |
90 | | - |
91 | | - # Create the new generalized investment data |
92 | | - if isnothing(cap_start) |
93 | | - return EMB.SingleInvData(capex_cap, cap_max_inst, tmp_inv_mode, tmp_life_mode) |
94 | | - else |
95 | | - return EMB.SingleInvData( |
96 | | - capex_cap, |
97 | | - cap_max_inst, |
98 | | - cap_start, |
99 | | - tmp_inv_mode, |
100 | | - tmp_life_mode, |
101 | | - ) |
102 | | - end |
103 | | -end |
104 | | - |
105 | | -function EMB.InvDataStorage(; |
106 | | - #Investment data related to storage power |
107 | | - capex_rate::TimeProfile, |
108 | | - rate_max_inst::TimeProfile, |
109 | | - rate_max_add::TimeProfile, |
110 | | - rate_min_add::TimeProfile, |
111 | | - capex_stor::TimeProfile, |
112 | | - stor_max_inst::TimeProfile, |
113 | | - stor_max_add::TimeProfile, |
114 | | - stor_min_add::TimeProfile, |
115 | | - inv_mode::Investment = ContinuousInvestment(), |
116 | | - rate_start::Union{Real,Nothing} = nothing, |
117 | | - stor_start::Union{Real,Nothing} = nothing, |
118 | | - rate_increment::TimeProfile = FixedProfile(0), |
119 | | - stor_increment::TimeProfile = FixedProfile(0), |
120 | | - life_mode::LifetimeMode = UnlimitedLife(), |
121 | | - lifetime::TimeProfile = FixedProfile(0), |
122 | | -) |
123 | | - |
124 | | - # Create the new investment mode structures |
125 | | - if isa(inv_mode, BinaryInvestment) |
126 | | - @error( |
127 | | - "BinaryInvestment() cannot use the constructor as it is not possible to " * |
128 | | - "deduce the capacity for the investment. You have to instead use the new " * |
129 | | - "types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/how-to/update-models)" |
130 | | - ) |
131 | | - return |
132 | | - elseif isa(inv_mode, FixedInvestment) |
133 | | - @error( |
134 | | - "FixedInvestment() cannot use the constructor as it is not possible to " * |
135 | | - "deduce the capacity for the investment. You have to instead use the new " * |
136 | | - "types as outlined in the documentation (https://energymodelsx.github.io/EnergyModelsInvestments.jl/how-to/update-models)" |
137 | | - ) |
138 | | - return |
139 | | - elseif isa(inv_mode, DiscreteInvestment) |
140 | | - inv_mode_rate = DiscreteInvestment(rate_increment) |
141 | | - inv_mode_cap = DiscreteInvestment(stor_increment) |
142 | | - elseif isa(inv_mode, ContinuousInvestment) |
143 | | - inv_mode_rate = ContinuousInvestment(rate_min_add, rate_max_add) |
144 | | - inv_mode_cap = ContinuousInvestment(stor_min_add, stor_max_add) |
145 | | - elseif isa(inv_mode, SemiContinuousInvestment) |
146 | | - inv_mode_rate = SemiContinuousInvestment(rate_min_add, rate_max_add) |
147 | | - inv_mode_cap = SemiContinuousInvestment(stor_min_add, stor_max_add) |
148 | | - end |
149 | | - |
150 | | - @warn( |
151 | | - "The used implementation of a `InvDataStorage` will be discontinued in the near " * |
152 | | - "future. See the documentation for the new implementation using the type " * |
153 | | - "`StorageInvData` in the section on _How to update your model to the latest " * |
154 | | - "versions_.\n" * |
155 | | - "The core change is that we allow now for individual investments in `charge`, " * |
156 | | - "`level`, as well `discharge` capacities.\n" * |
157 | | - "This constructore should NOT be used for `HydroStor` or `PumpedHydroStor nodes " * |
158 | | - "introduced in the package [EnergyModelsRenewableProducers]" * |
159 | | - "(https://energymodelsx.github.io/EnergyModelsRenewableProducers.jl/stable/library/public/#EnergyModelsRenewableProducers.HydroStor).", |
160 | | - maxlog = 1 |
161 | | - ) |
162 | | - |
163 | | - # Create the new lifetime mode structures |
164 | | - if isa(life_mode, UnlimitedLife) |
165 | | - tmp_life_mode = UnlimitedLife() |
166 | | - elseif isa(life_mode, StudyLife) |
167 | | - tmp_life_mode = StudyLife(lifetime) |
168 | | - elseif isa(life_mode, PeriodLife) |
169 | | - tmp_life_mode = PeriodLife(lifetime) |
170 | | - elseif isa(life_mode, RollingLife) |
171 | | - tmp_life_mode = RollingLife(lifetime) |
172 | | - end |
173 | | - |
174 | | - # Create the new generalized investment data |
175 | | - if isnothing(rate_start) |
176 | | - charge_type = |
177 | | - NoStartInvData(capex_rate, rate_max_inst, inv_mode_rate, tmp_life_mode) |
178 | | - else |
179 | | - charge_type = StartInvData( |
180 | | - capex_rate, |
181 | | - rate_max_inst, |
182 | | - rate_start, |
183 | | - inv_mode_rate, |
184 | | - tmp_life_mode, |
185 | | - ) |
186 | | - end |
187 | | - if isnothing(stor_start) |
188 | | - level_type = NoStartInvData(capex_stor, stor_max_inst, inv_mode_cap, tmp_life_mode) |
189 | | - else |
190 | | - level_type = |
191 | | - StartInvData(capex_stor, stor_max_inst, stor_start, inv_mode_cap, tmp_life_mode) |
192 | | - end |
193 | | - |
194 | | - return EMB.StorageInvData(charge = charge_type, level = level_type) |
195 | | -end |
196 | | - |
197 | | -""" |
198 | | -When the field `cap` is not included, it is assumed that its value is `FixedProfile(0)`. |
199 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
200 | | -in the near future. |
201 | | -""" |
202 | | -EMI.FixedInvestment() = EMI.FixedInvestment(FixedProfile(0)) |
203 | | -""" |
204 | | -When the field `cap` is not included, it is assumed that its value is `FixedProfile(0)`. |
205 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
206 | | -in the near future. |
207 | | -""" |
208 | | -EMI.BinaryInvestment() = EMI.BinaryInvestment(FixedProfile(0)) |
209 | | -""" |
210 | | -When the field `increment` is not included, it is assumed that its value is `FixedProfile(0)`. |
211 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
212 | | -in the near future. |
213 | | -""" |
214 | | -EMI.DiscreteInvestment() = EMI.DiscreteInvestment(FixedProfile(0)) |
215 | | -""" |
216 | | -When the fields `min_add` and `max_add` are not included, it is assumed that their values |
217 | | -are `FixedProfile(0)`. This behavior is only for allowing the legacy constructor to work, |
218 | | -while it will be removed in the near future. |
219 | | -""" |
220 | | -EMI.ContinuousInvestment() = EMI.ContinuousInvestment(FixedProfile(0), FixedProfile(0)) |
221 | | -""" |
222 | | -When the fields `min_add` and `max_add` are not included, it is assumed that their values |
223 | | -are `FixedProfile(0)`. This behavior is only for allowing the legacy constructor to work, |
224 | | -while it will be removed in the near future. |
225 | | -""" |
226 | | -EMI.SemiContinuousInvestment() = |
227 | | - EMI.SemiContinuousInvestment(FixedProfile(0), FixedProfile(0)) |
228 | | -""" |
229 | | -When the fields `min_add`, `max_add`, and `capex_offset` are not included, it is assumed |
230 | | -that their values are `FixedProfile(0)`. This behavior is only for allowing the legacy |
231 | | -constructor to work, while it will be removed in the near future. |
232 | | -""" |
233 | | -EMI.SemiContinuousOffsetInvestment() = |
234 | | - EMI.SemiContinuousOffsetInvestment(FixedProfile(0), FixedProfile(0), FixedProfile(0)) |
235 | | - |
236 | | -""" |
237 | | -When the field `lifetime` is not included, it is assumed that its value is `FixedProfile(0)`. |
238 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
239 | | -in the near future. |
240 | | -""" |
241 | | -EMI.StudyLife() = EMI.StudyLife(FixedProfile(0)) |
242 | | -""" |
243 | | -When the field `lifetime` is not included, it is assumed that its value is `FixedProfile(0)`. |
244 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
245 | | -in the near future. |
246 | | -""" |
247 | | -EMI.PeriodLife() = EMI.PeriodLife(FixedProfile(0)) |
248 | | -""" |
249 | | -When the field `lifetime` is not included, it is assumed that its value is `FixedProfile(0)`. |
250 | | -This behavior is only for allowing the legacy constructor to work, while it will be removed |
251 | | -in the near future. |
252 | | -""" |
253 | | -EMI.RollingLife() = EMI.RollingLife(FixedProfile(0)) |
0 commit comments