mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Split files
This commit is contained in:
38
src/reports/plant_emissions.jl
Normal file
38
src/reports/plant_emissions.jl
Normal file
@@ -0,0 +1,38 @@
|
||||
# RELOG: Reverse Logistics Optimization
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
using DataFrames
|
||||
using CSV
|
||||
|
||||
function plant_emissions_report(solution)::DataFrame
|
||||
df = DataFrame()
|
||||
df."plant type" = String[]
|
||||
df."location name" = String[]
|
||||
df."year" = Int[]
|
||||
df."emission type" = String[]
|
||||
df."emission amount (tonne)" = Float64[]
|
||||
T = length(solution["Energy"]["Plants (GJ)"])
|
||||
for (plant_name, plant_dict) in solution["Plants"]
|
||||
for (location_name, location_dict) in plant_dict
|
||||
for (emission_name, emission_amount) in location_dict["Emissions (tonne)"]
|
||||
for year = 1:T
|
||||
push!(
|
||||
df,
|
||||
[
|
||||
plant_name,
|
||||
location_name,
|
||||
year,
|
||||
emission_name,
|
||||
round(emission_amount[year], digits = 2),
|
||||
],
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return df
|
||||
end
|
||||
|
||||
write_plant_emissions_report(solution, filename) =
|
||||
CSV.write(filename, plant_emissions_report(solution))
|
||||
Reference in New Issue
Block a user