Fix issue with collection disposal; increase precision in CSV reports

feature/CapEx
Alinson S. Xavier 3 years ago
parent 8432c49050
commit 7d4a763910
Signed by: isoron
GPG Key ID: 0DA8E4B9E1109DCA

@ -184,8 +184,8 @@ function create_shipping_node_constraints!(model::JuMP.Model)
for n in graph.collection_shipping_nodes
model[:eq_balance][n, t] = @constraint(
model,
sum(model[:flow][a, t] for a in n.outgoing_arcs) ==
n.location.amount[t] + model[:collection_dispose][n, t]
sum(model[:flow][a, t] for a in n.outgoing_arcs) +
model[:collection_dispose][n, t] == n.location.amount[t]
)
end
for prod in model[:instance].products

@ -24,7 +24,7 @@ function plant_emissions_report(solution)::DataFrame
location_name,
year,
emission_name,
round(emission_amount[year], digits = 2),
round(emission_amount[year], digits = 6),
],
)
end

@ -30,7 +30,7 @@ function plant_outputs_report(solution)::DataFrame
end
end
end
sent = round.(sent, digits = 2)
sent = round.(sent, digits = 6)
disposal_amount = zeros(T)
disposal_cost = zeros(T)
@ -38,8 +38,8 @@ function plant_outputs_report(solution)::DataFrame
disposal_amount += disposal_dict[product_name]["Amount (tonne)"]
disposal_cost += disposal_dict[product_name]["Cost (\$)"]
end
disposal_amount = round.(disposal_amount, digits = 2)
disposal_cost = round.(disposal_cost, digits = 2)
disposal_amount = round.(disposal_amount, digits = 6)
disposal_cost = round.(disposal_cost, digits = 6)
for year = 1:T
push!(
@ -49,7 +49,7 @@ function plant_outputs_report(solution)::DataFrame
location_name,
year,
product_name,
round(amount_produced[year], digits = 2),
round(amount_produced[year], digits = 6),
sent[year],
disposal_amount[year],
disposal_cost[year],

@ -28,25 +28,25 @@ function plants_report(solution)::DataFrame
for (plant_name, plant_dict) in solution["Plants"]
for (location_name, location_dict) in plant_dict
for year = 1:T
capacity = round(location_dict["Capacity (tonne)"][year], digits = 2)
received = round(location_dict["Total input (tonne)"][year], digits = 2)
processed = round(location_dict["Process (tonne)"][year], digits = 2)
in_storage = round(location_dict["Storage (tonne)"][year], digits = 2)
utilization_factor = round(processed / capacity * 100.0, digits = 2)
energy = round(location_dict["Energy (GJ)"][year], digits = 2)
capacity = round(location_dict["Capacity (tonne)"][year], digits = 6)
received = round(location_dict["Total input (tonne)"][year], digits = 6)
processed = round(location_dict["Process (tonne)"][year], digits = 6)
in_storage = round(location_dict["Storage (tonne)"][year], digits = 6)
utilization_factor = round(processed / capacity * 100.0, digits = 6)
energy = round(location_dict["Energy (GJ)"][year], digits = 6)
latitude = round(location_dict["Latitude (deg)"], digits = 6)
longitude = round(location_dict["Longitude (deg)"], digits = 6)
opening_cost = round(location_dict["Opening cost (\$)"][year], digits = 2)
opening_cost = round(location_dict["Opening cost (\$)"][year], digits = 6)
expansion_cost =
round(location_dict["Expansion cost (\$)"][year], digits = 2)
round(location_dict["Expansion cost (\$)"][year], digits = 6)
fixed_cost =
round(location_dict["Fixed operating cost (\$)"][year], digits = 2)
round(location_dict["Fixed operating cost (\$)"][year], digits = 6)
var_cost =
round(location_dict["Variable operating cost (\$)"][year], digits = 2)
storage_cost = round(location_dict["Storage cost (\$)"][year], digits = 2)
round(location_dict["Variable operating cost (\$)"][year], digits = 6)
storage_cost = round(location_dict["Storage cost (\$)"][year], digits = 6)
total_cost = round(
opening_cost + expansion_cost + fixed_cost + var_cost + storage_cost,
digits = 2,
digits = 6,
)
push!(
df,

@ -37,8 +37,8 @@ function products_report(solution; marginal_costs = true)::DataFrame
longitude,
year,
amount,
marginal_cost,
amount_disposed,
marginal_cost,
acquisition_cost,
disposal_cost,
],

@ -42,24 +42,24 @@ function transportation_report(solution)::DataFrame
round(dst_location_dict["Longitude (deg)"], digits = 6),
dst_location_dict["Input product"],
year,
round(src_location_dict["Distance (km)"], digits = 2),
round(src_location_dict["Distance (km)"], digits = 6),
round(
src_location_dict["Amount (tonne)"][year],
digits = 2,
digits = 6,
),
round(
src_location_dict["Amount (tonne)"][year] *
src_location_dict["Distance (km)"],
digits = 2,
digits = 6,
),
round(
src_location_dict["Transportation cost (\$)"][year],
digits = 2,
digits = 6,
),
round(
src_location_dict["Transportation energy (J)"][year] /
1e9,
digits = 2,
digits = 6,
),
],
)

@ -44,18 +44,18 @@ function transportation_emissions_report(solution)::DataFrame
round(dst_location_dict["Longitude (deg)"], digits = 6),
dst_location_dict["Input product"],
year,
round(src_location_dict["Distance (km)"], digits = 2),
round(src_location_dict["Distance (km)"], digits = 6),
round(
src_location_dict["Amount (tonne)"][year],
digits = 2,
digits = 6,
),
round(
src_location_dict["Amount (tonne)"][year] *
src_location_dict["Distance (km)"],
digits = 2,
digits = 6,
),
emission_name,
round(emission_amount[year], digits = 2),
round(emission_amount[year], digits = 6),
],
)
end

Loading…
Cancel
Save