mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Add disposal cost to product report
This commit is contained in:
2
Makefile
2
Makefile
@@ -5,7 +5,7 @@ VERSION := 0.5
|
||||
all: docs test
|
||||
|
||||
build/sysimage.so: src/sysimage.jl Project.toml Manifest.toml
|
||||
@$(JULIA) src/sysimage.jl
|
||||
@$(JULIA) src/sysimage.jl test/runtests.jl
|
||||
|
||||
clean:
|
||||
rm -rf build/*
|
||||
|
||||
@@ -46,6 +46,8 @@ function get_solution(model::JuMP.Model; marginal_costs = true)
|
||||
"Amount (tonne)" => n.location.amount,
|
||||
"Dispose (tonne)" =>
|
||||
[JuMP.value(model[:collection_dispose][n, t]) for t = 1:T],
|
||||
"Disposal cost (\$)" =>
|
||||
[JuMP.value(model[:collection_dispose][n, t]) * n.location.product.disposal_cost[t] for t = 1:T]
|
||||
)
|
||||
if marginal_costs
|
||||
location_dict["Marginal cost (\$/tonne)"] = [
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using DataFrames
|
||||
using CSV
|
||||
|
||||
function products_report(solution; marginal_costs = true)::DataFrame
|
||||
function products_report(solution)::DataFrame
|
||||
df = DataFrame()
|
||||
df."product name" = String[]
|
||||
df."location name" = String[]
|
||||
@@ -13,17 +13,22 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
df."longitude (deg)" = Float64[]
|
||||
df."year" = Int[]
|
||||
df."amount (tonne)" = Float64[]
|
||||
df."amount disposed (tonne)" = Float64[]
|
||||
df."marginal cost (\$/tonne)" = Float64[]
|
||||
df."amount disposed (tonne)" = Float64[]
|
||||
df."disposal cost (\$)" = Float64[]
|
||||
T = length(solution["Energy"]["Plants (GJ)"])
|
||||
for (prod_name, prod_dict) in solution["Products"]
|
||||
for (location_name, location_dict) in prod_dict
|
||||
for year = 1:T
|
||||
marginal_cost = location_dict["Marginal cost (\$/tonne)"][year]
|
||||
marginal_cost = NaN
|
||||
if "Marginal cost (\$/tonne)" in keys(location_dict)
|
||||
marginal_cost = location_dict["Marginal cost (\$/tonne)"][year]
|
||||
end
|
||||
latitude = round(location_dict["Latitude (deg)"], digits = 6)
|
||||
longitude = round(location_dict["Longitude (deg)"], digits = 6)
|
||||
amount = location_dict["Amount (tonne)"][year]
|
||||
amount_disposed = location_dict["Dispose (tonne)"][year]
|
||||
disposal_cost = location_dict["Disposal cost (\$)"][year]
|
||||
push!(
|
||||
df,
|
||||
[
|
||||
@@ -35,6 +40,7 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
amount,
|
||||
marginal_cost,
|
||||
amount_disposed,
|
||||
disposal_cost,
|
||||
],
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user