Skip to content

Commit 4ab1322

Browse files
committed
Debugging the financial results
1 parent 6a4c732 commit 4ab1322

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/results/financial.jl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ function initial_capex(m::JuMP.AbstractModel, p::REoptInputs; _n="")
146146
for b in p.s.storage.types.elec
147147
if p.s.storage.attr[b].max_kw > 0
148148
initial_capex += p.s.storage.attr[b].installed_cost_per_kw * value.(m[Symbol("dvStoragePower"*_n)])[b] +
149-
p.s.storage.attr[b].installed_cost_per_kwh * value.(m[Symbol("dvStorageEnergy"*_n)])[b] +
150-
(p.s.storage.attr[b].installed_cost_constant * value.(m[Symbol("binIncludeStorageCostConstant"*_n)])[b])
149+
p.s.storage.attr[b].installed_cost_per_kwh * value.(m[Symbol("dvStorageEnergy"*_n)])[b]
150+
if (p.s.storage.attr[b].installed_cost_constant != 0) || (p.s.storage.attr[b].replace_cost_constant != 0)
151+
initial_capex += p.s.storage.attr[b].installed_cost_constant * value.(m[Symbol("binIncludeStorageCostConstant"*_n)])[b]
152+
end
151153
end
152154
end
153155

@@ -234,10 +236,19 @@ function replacement_costs_future_and_present(m::JuMP.AbstractModel, p::REoptInp
234236
else
235237
future_cost_storage = p.s.storage.attr[b].replace_cost_per_kwh * value.(m[Symbol("dvStorageEnergy"*_n)])[b]
236238
end
237-
if p.s.storage.attr[b].cost_constant_replacement_year >= p.s.financial.analysis_years
238-
future_cost_cost_constant = 0
239+
240+
if b in p.s.storage.types.elec
241+
if p.s.storage.attr[b].cost_constant_replacement_year >= p.s.financial.analysis_years
242+
future_cost_cost_constant = 0
243+
else
244+
if (p.s.storage.attr[b].installed_cost_constant != 0) || (p.s.storage.attr[b].replace_cost_constant != 0)
245+
future_cost_cost_constant = p.s.storage.attr[b].replace_cost_constant * value.(m[Symbol("binIncludeStorageCostConstant"*_n)])[b]
246+
else
247+
future_cost_cost_constant = 0
248+
end
249+
end
239250
else
240-
future_cost_cost_constant = p.s.storage.attr[b].replace_cost_constant * value.(m[Symbol("binIncludeStorageCostConstant"*_n)])[b]
251+
future_cost_cost_constant = 0
241252
end
242253

243254
future_cost += future_cost_inverter + future_cost_storage + future_cost_cost_constant

0 commit comments

Comments
 (0)