mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Make marginal costs optional in write_reports
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
using DataFrames
|
||||
using CSV
|
||||
|
||||
function products_report(solution; marginal_costs = true)::DataFrame
|
||||
function products_report(solution; marginal_costs)::DataFrame
|
||||
df = DataFrame()
|
||||
df."product name" = String[]
|
||||
df."location name" = String[]
|
||||
@@ -21,7 +21,11 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
for (prod_name, prod_dict) in solution["Products"]
|
||||
for (location_name, location_dict) in prod_dict
|
||||
for year = 1:T
|
||||
if marginal_costs
|
||||
marginal_cost = location_dict["Marginal cost (\$/tonne)"][year]
|
||||
else
|
||||
marginal_cost = 0.0
|
||||
end
|
||||
latitude = round(location_dict["Latitude (deg)"], digits = 6)
|
||||
longitude = round(location_dict["Longitude (deg)"], digits = 6)
|
||||
amount = location_dict["Amount (tonne)"][year]
|
||||
@@ -49,4 +53,4 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
return df
|
||||
end
|
||||
|
||||
write_products_report(solution, filename) = CSV.write(filename, products_report(solution))
|
||||
write_products_report(solution, filename; marginal_costs = true) = CSV.write(filename, products_report(solution; marginal_costs))
|
||||
|
||||
@@ -13,8 +13,8 @@ function write(solution::AbstractDict, filename::AbstractString)
|
||||
end
|
||||
end
|
||||
|
||||
function write_reports(solution::AbstractDict, basename::AbstractString)
|
||||
RELOG.write_products_report(solution, "$(basename)_products.csv")
|
||||
function write_reports(solution::AbstractDict, basename::AbstractString; marginal_costs = true)
|
||||
RELOG.write_products_report(solution, "$(basename)_products.csv"; marginal_costs)
|
||||
RELOG.write_plants_report(solution, "$(basename)_plants.csv")
|
||||
RELOG.write_plant_outputs_report(solution, "$(basename)_plant_outputs.csv")
|
||||
RELOG.write_plant_emissions_report(solution, "$(basename)_plant_emissions.csv")
|
||||
|
||||
Reference in New Issue
Block a user