From 003922ac709a24e919e1290aa82deaf962291a90 Mon Sep 17 00:00:00 2001 From: "Alinson S. Xavier" Date: Wed, 17 Sep 2025 13:57:44 -0500 Subject: [PATCH] Implement plant emissions --- docs/src/problem.md | 13 +- src/model/build.jl | 16 ++ src/reports/plants.jl | 38 +++++ test/fixtures/boat_example.jl | 1 + test/fixtures/boat_example/center_outputs.csv | 46 +++--- test/fixtures/boat_example/centers.csv | 60 +++---- .../fixtures/boat_example/plant_emissions.csv | 11 ++ test/fixtures/boat_example/plant_outputs.csv | 34 ++-- test/fixtures/boat_example/plants.csv | 154 +++++++++--------- test/src/model/build_test.jl | 11 ++ 10 files changed, 236 insertions(+), 148 deletions(-) create mode 100644 test/fixtures/boat_example/plant_emissions.csv diff --git a/docs/src/problem.md b/docs/src/problem.md index 3f088c1..958182f 100644 --- a/docs/src/problem.md +++ b/docs/src/problem.md @@ -57,6 +57,7 @@ The mathematical model employed by RELOG is based on three main components: | $K^\text{disp-limit}_{mut}$ | Maximum amount of material $m$ that can be disposed of at plant/center $u$ at time $t$ | tonne | | $K^\text{mix}_{pmt}$ | If plant $p$ receives one tonne of input material at time $t$, then $K^\text{mix}_{pmt}$ is the amount of product $m$ in this mix. Must be between zero and one, and the sum of these amounts must equal to one. | tonne | | $K^\text{output}_{pmt}$ | Amount of material $m$ produced by plant $p$ at time $t$ for each tonne of input material processed | tonne | +| $K^\text{plant-em}_{gpt}$ | Amount of greenhouse gas $g$ released by plant $p$ at time $t$ for each tonne of input material processed | tonne/tonne | | $K^\text{tr-em}_{gmt}$ | Amount of greenhouse gas $g$ released by transporting 1 tonne of material $m$ over one km at time $t$ | tonne/km-tonne | | $R^\text{tr}_{mt}$ | Cost to send material $m$ at time $t$ | \$/km-tonne | | $R^\text{collect}_{cmt}$ | Cost of collecting material $m$ at center $c$ at time $t$ | \$/tonne | @@ -80,6 +81,7 @@ The mathematical model employed by RELOG is based on three main components: | $z^{\text{input}}_{ut}$ | `z_input[u.name, t]` | Total plant/center input at time $t$ | tonne | | $z^{\text{prod}}_{umt}$ | `z_prod[u.name, m.name, t]` | Amount of product $m$ produced by plant/center $u$ at time $t$ | tonne | | $z^{\text{tr-em}}_{guvmt}$ | `z_tr_em[g.name, u.name, v.name, m.name, t]` | Amount of greenhouse gas $g$ released at time $t$ due to transportation of material $m$ from $u$ to $v$ | tonne | +| $z^{\text{plant-em}}_{gpt}$ | `z_plant_em[g.name, p.name, t]` | Amount of greenhouse gas $g$ released by plant $p$ at time $t$ | tonne | ## Objective function @@ -269,7 +271,8 @@ The goals is to minimize a linear objective function with the following terms: \end{align*} ``` -- Computation of transportation emissions (`eq_tr_em[g.name, u.name, v.name, m.name, t`) +- Computation of transportation emissions + (`eq_tr_em[g.name, u.name, v.name, m.name, t`): ```math \begin{align*} @@ -277,3 +280,11 @@ The goals is to minimize a linear objective function with the following terms: & \forall g \in G, (u, v, m) \in E, t \in T \end{align*} ``` + +- Computation of plant emissions (`eq_plant_em[g.name, p.name, t]`): +```math +\begin{align*} +& z^{\text{plant-em}}_{gpt} = \sum_{(u,m) \in E^-(p)} K^\text{plant-em}_{gpt} y_{upmt} +& \forall g \in G, p \in P, t \in T +``` + diff --git a/src/model/build.jl b/src/model/build.jl index a100506..40e85e3 100644 --- a/src/model/build.jl +++ b/src/model/build.jl @@ -124,6 +124,12 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false z_tr_em[g, p1.name, p2.name, m.name, t] = @variable(model, lower_bound = 0) end + # Plant emissions by greenhouse gas + z_plant_em = _init(model, :z_plant_em) + for p in plants, t in T, g in keys(p.emissions) + z_plant_em[g, p.name, t] = @variable(model, lower_bound = 0) + end + # Objective function # ------------------------------------------------------------------------- @@ -326,6 +332,16 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false ) end + # Plant emissions + eq_plant_em = _init(model, :eq_plant_em) + for p in plants, t in T, g in keys(p.emissions) + eq_plant_em[g, p.name, t] = @constraint( + model, + z_plant_em[g, p.name, t] == + p.emissions[g][t] * sum(y[src.name, p.name, m.name, t] for (src, m) in E_in[p]) + ) + end + if variable_names _set_names!(model) end diff --git a/src/reports/plants.jl b/src/reports/plants.jl index 46af6fa..47d063c 100644 --- a/src/reports/plants.jl +++ b/src/reports/plants.jl @@ -97,6 +97,44 @@ function plant_outputs_report(model)::DataFrame return df end +function plant_emissions_report(model)::DataFrame + df = DataFrame() + df."plant" = String[] + df."latitude" = Float64[] + df."longitude" = Float64[] + df."emission" = String[] + df."year" = Int[] + df."input amount (tonne)" = Float64[] + df."emission factor (tonne/tonne)" = Float64[] + df."emissions amount (tonne)" = Float64[] + + plants = model.ext[:instance].plants + T = 1:model.ext[:instance].time_horizon + + for p in plants, t in T, g in keys(p.emissions) + input_amount = JuMP.value(model[:z_input][p.name, t]) + input_amount > 1e-3 || continue + emissions = JuMP.value(model[:z_plant_em][g, p.name, t]) + emission_factor = p.emissions[g][t] + push!( + df, + Dict( + "plant" => p.name, + "latitude" => p.latitude, + "longitude" => p.longitude, + "emission" => g, + "year" => t, + "input amount (tonne)" => _round(input_amount), + "emission factor (tonne/tonne)" => _round(emission_factor), + "emissions amount (tonne)" => _round(emissions), + ), + ) + end + return df +end + write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution)) write_plant_outputs_report(solution, filename) = CSV.write(filename, plant_outputs_report(solution)) +write_plant_emissions_report(solution, filename) = + CSV.write(filename, plant_emissions_report(solution)) diff --git a/test/fixtures/boat_example.jl b/test/fixtures/boat_example.jl index c2d0f74..c8bb623 100644 --- a/test/fixtures/boat_example.jl +++ b/test/fixtures/boat_example.jl @@ -174,6 +174,7 @@ function run_boat_example() write_to_file(model, fixture("boat_example/model.lp")) RELOG.write_plants_report(model, fixture("boat_example/plants.csv")) RELOG.write_plant_outputs_report(model, fixture("boat_example/plant_outputs.csv")) + RELOG.write_plant_emissions_report(model, fixture("boat_example/plant_emissions.csv")) RELOG.write_centers_report(model, fixture("boat_example/centers.csv")) RELOG.write_center_outputs_report(model, fixture("boat_example/center_outputs.csv")) RELOG.write_transportation_report(model, fixture("boat_example/transportation.csv")) diff --git a/test/fixtures/boat_example/center_outputs.csv b/test/fixtures/boat_example/center_outputs.csv index 21b9d95..e92873b 100644 --- a/test/fixtures/boat_example/center_outputs.csv +++ b/test/fixtures/boat_example/center_outputs.csv @@ -1,27 +1,27 @@ center,latitude,longitude,output product,year,amount collected (tonne),amount disposed (tonne),disposal limit (tonne),collection cost ($),disposal cost ($) -NailFactory (Chicago),41.881832,-87.623177,Nail,1,1.0,0.0,Inf,1000.0,0.0 +NailFactory (Chicago),41.881832,-87.623177,Nail,1,1.0,-0.0,Inf,1000.0,-0.0 NailFactory (Chicago),41.881832,-87.623177,Nail,2,1.0,0.0,Inf,1000.0,0.0 NailFactory (Chicago),41.881832,-87.623177,Nail,3,1.0,0.0,Inf,1000.0,0.0 NailFactory (Chicago),41.881832,-87.623177,Nail,4,1.0,0.0,Inf,1000.0,0.0 -NailFactory (Chicago),41.881832,-87.623177,Nail,5,1.0,0.0,Inf,1000.0,0.0 +NailFactory (Chicago),41.881832,-87.623177,Nail,5,1.0,-0.0,Inf,1000.0,-0.0 NailFactory (Phoenix),33.448376,-112.074036,Nail,1,1.0,0.0,Inf,1000.0,0.0 NailFactory (Phoenix),33.448376,-112.074036,Nail,2,1.0,0.0,Inf,1000.0,0.0 NailFactory (Phoenix),33.448376,-112.074036,Nail,3,1.0,0.0,Inf,1000.0,0.0 NailFactory (Phoenix),33.448376,-112.074036,Nail,4,1.0,0.0,Inf,1000.0,0.0 -NailFactory (Phoenix),33.448376,-112.074036,Nail,5,1.0,0.0,Inf,1000.0,0.0 +NailFactory (Phoenix),33.448376,-112.074036,Nail,5,1.0,-0.0,Inf,1000.0,-0.0 NailFactory (Dallas),32.776664,-96.796988,Nail,1,1.0,0.0,Inf,1000.0,0.0 -NailFactory (Dallas),32.776664,-96.796988,Nail,2,1.0,-0.0,Inf,1000.0,-0.0 +NailFactory (Dallas),32.776664,-96.796988,Nail,2,1.0,0.0,Inf,1000.0,0.0 NailFactory (Dallas),32.776664,-96.796988,Nail,3,1.0,0.0,Inf,1000.0,0.0 -NailFactory (Dallas),32.776664,-96.796988,Nail,4,1.0,-0.0,Inf,1000.0,-0.0 +NailFactory (Dallas),32.776664,-96.796988,Nail,4,1.0,0.0,Inf,1000.0,0.0 NailFactory (Dallas),32.776664,-96.796988,Nail,5,1.0,-0.0,Inf,1000.0,-0.0 Forest (Chicago),41.881832,-87.623177,Wood,1,100.0,100.0,Inf,0.0,0.0 -Forest (Chicago),41.881832,-87.623177,Wood,2,100.0,100.0,Inf,0.0,0.0 -Forest (Chicago),41.881832,-87.623177,Wood,3,100.0,100.0,Inf,0.0,0.0 -Forest (Chicago),41.881832,-87.623177,Wood,4,100.0,100.0,Inf,0.0,0.0 +Forest (Chicago),41.881832,-87.623177,Wood,2,100.0,100.0,Inf,-0.0,0.0 +Forest (Chicago),41.881832,-87.623177,Wood,3,100.0,100.0,Inf,-0.0,0.0 +Forest (Chicago),41.881832,-87.623177,Wood,4,100.0,100.0,Inf,-0.0,0.0 Forest (Chicago),41.881832,-87.623177,Wood,5,100.0,100.0,Inf,0.0,0.0 Forest (Phoenix),33.448376,-112.074036,Wood,1,100.0,100.0,Inf,0.0,0.0 -Forest (Phoenix),33.448376,-112.074036,Wood,2,100.0,100.0,Inf,0.0,0.0 -Forest (Phoenix),33.448376,-112.074036,Wood,3,100.0,100.0,Inf,0.0,0.0 +Forest (Phoenix),33.448376,-112.074036,Wood,2,100.0,100.0,Inf,-0.0,0.0 +Forest (Phoenix),33.448376,-112.074036,Wood,3,100.0,100.0,Inf,-0.0,0.0 Forest (Phoenix),33.448376,-112.074036,Wood,4,100.0,100.0,Inf,0.0,0.0 Forest (Phoenix),33.448376,-112.074036,Wood,5,100.0,100.0,Inf,0.0,0.0 Forest (Dallas),32.776664,-96.796988,Wood,1,100.0,43.0,Inf,14250.0,0.0 @@ -33,7 +33,7 @@ Retail (Chicago),41.881832,-87.623177,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 Retail (Chicago),41.881832,-87.623177,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 Retail (Chicago),41.881832,-87.623177,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 Retail (Chicago),41.881832,-87.623177,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 -Retail (Chicago),41.881832,-87.623177,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 +Retail (Chicago),41.881832,-87.623177,UsedBoat,5,0.0,0.0,0.0,-0.0,0.0 Retail (New York City),40.712776,-74.005974,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 Retail (New York City),40.712776,-74.005974,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 Retail (New York City),40.712776,-74.005974,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 @@ -43,32 +43,32 @@ Retail (Los Angeles),34.052235,-118.243683,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 Retail (Los Angeles),34.052235,-118.243683,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 Retail (Los Angeles),34.052235,-118.243683,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 Retail (Los Angeles),34.052235,-118.243683,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 -Retail (Los Angeles),34.052235,-118.243683,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0 -Retail (Houston),29.760427,-95.369804,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 -Retail (Houston),29.760427,-95.369804,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 -Retail (Houston),29.760427,-95.369804,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 +Retail (Los Angeles),34.052235,-118.243683,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 +Retail (Houston),29.760427,-95.369804,UsedBoat,1,-0.0,0.0,0.0,0.0,0.0 +Retail (Houston),29.760427,-95.369804,UsedBoat,2,-0.0,0.0,0.0,-0.0,0.0 +Retail (Houston),29.760427,-95.369804,UsedBoat,3,-0.0,0.0,0.0,-0.0,0.0 Retail (Houston),29.760427,-95.369804,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 -Retail (Houston),29.760427,-95.369804,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0 +Retail (Houston),29.760427,-95.369804,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 Retail (Phoenix),33.448376,-112.074036,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 -Retail (Phoenix),33.448376,-112.074036,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 -Retail (Phoenix),33.448376,-112.074036,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 +Retail (Phoenix),33.448376,-112.074036,UsedBoat,2,-0.0,0.0,0.0,-0.0,0.0 +Retail (Phoenix),33.448376,-112.074036,UsedBoat,3,-0.0,0.0,0.0,-0.0,0.0 Retail (Phoenix),33.448376,-112.074036,UsedBoat,4,-0.0,0.0,0.0,-0.0,0.0 -Retail (Phoenix),33.448376,-112.074036,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0 +Retail (Phoenix),33.448376,-112.074036,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 Retail (Philadelphia),39.952583,-75.165222,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 Retail (Philadelphia),39.952583,-75.165222,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 Retail (Philadelphia),39.952583,-75.165222,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 Retail (Philadelphia),39.952583,-75.165222,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 Retail (Philadelphia),39.952583,-75.165222,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 -Retail (San Antonio),29.424122,-98.493629,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 -Retail (San Antonio),29.424122,-98.493629,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 +Retail (San Antonio),29.424122,-98.493629,UsedBoat,1,-0.0,0.0,0.0,-0.0,0.0 +Retail (San Antonio),29.424122,-98.493629,UsedBoat,2,-0.0,0.0,0.0,-0.0,0.0 Retail (San Antonio),29.424122,-98.493629,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 Retail (San Antonio),29.424122,-98.493629,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 -Retail (San Antonio),29.424122,-98.493629,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 +Retail (San Antonio),29.424122,-98.493629,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0 Retail (San Diego),32.715736,-117.161087,UsedBoat,1,0.0,0.0,0.0,0.0,0.0 Retail (San Diego),32.715736,-117.161087,UsedBoat,2,0.0,0.0,0.0,0.0,0.0 Retail (San Diego),32.715736,-117.161087,UsedBoat,3,0.0,0.0,0.0,0.0,0.0 Retail (San Diego),32.715736,-117.161087,UsedBoat,4,0.0,0.0,0.0,0.0,0.0 -Retail (San Diego),32.715736,-117.161087,UsedBoat,5,0.0,0.0,0.0,0.0,0.0 +Retail (San Diego),32.715736,-117.161087,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0 Retail (Dallas),32.776664,-96.796988,UsedBoat,1,6.31579,0.0,0.0,631.57895,0.0 Retail (Dallas),32.776664,-96.796988,UsedBoat,2,22.93629,0.0,0.0,2293.62881,0.0 Retail (Dallas),32.776664,-96.796988,UsedBoat,3,31.7714,0.0,0.0,3177.13952,0.0 diff --git a/test/fixtures/boat_example/centers.csv b/test/fixtures/boat_example/centers.csv index f71f570..78d5a77 100644 --- a/test/fixtures/boat_example/centers.csv +++ b/test/fixtures/boat_example/centers.csv @@ -29,53 +29,53 @@ Forest (Dallas),32.776664,-96.796988,2,,0.0,0.0,0.0 Forest (Dallas),32.776664,-96.796988,3,,0.0,0.0,0.0 Forest (Dallas),32.776664,-96.796988,4,,0.0,0.0,0.0 Forest (Dallas),32.776664,-96.796988,5,,0.0,0.0,0.0 -Retail (Chicago),41.881832,-87.623177,1,NewBoat,0.0,0.0,125000.0 -Retail (Chicago),41.881832,-87.623177,2,NewBoat,0.0,0.0,125000.0 +Retail (Chicago),41.881832,-87.623177,1,NewBoat,-0.0,0.0,125000.0 +Retail (Chicago),41.881832,-87.623177,2,NewBoat,-0.0,0.0,125000.0 Retail (Chicago),41.881832,-87.623177,3,NewBoat,0.0,0.0,125000.0 Retail (Chicago),41.881832,-87.623177,4,NewBoat,0.0,0.0,125000.0 Retail (Chicago),41.881832,-87.623177,5,NewBoat,0.0,0.0,125000.0 -Retail (New York City),40.712776,-74.005974,1,NewBoat,0.0,0.0,125000.0 -Retail (New York City),40.712776,-74.005974,2,NewBoat,0.0,0.0,125000.0 -Retail (New York City),40.712776,-74.005974,3,NewBoat,0.0,0.0,125000.0 +Retail (New York City),40.712776,-74.005974,1,NewBoat,-0.0,0.0,125000.0 +Retail (New York City),40.712776,-74.005974,2,NewBoat,-0.0,0.0,125000.0 +Retail (New York City),40.712776,-74.005974,3,NewBoat,-0.0,0.0,125000.0 Retail (New York City),40.712776,-74.005974,4,NewBoat,0.0,0.0,125000.0 Retail (New York City),40.712776,-74.005974,5,NewBoat,0.0,0.0,125000.0 -Retail (Los Angeles),34.052235,-118.243683,1,NewBoat,0.0,0.0,125000.0 -Retail (Los Angeles),34.052235,-118.243683,2,NewBoat,0.0,0.0,125000.0 -Retail (Los Angeles),34.052235,-118.243683,3,NewBoat,0.0,0.0,125000.0 +Retail (Los Angeles),34.052235,-118.243683,1,NewBoat,-0.0,0.0,125000.0 +Retail (Los Angeles),34.052235,-118.243683,2,NewBoat,-0.0,0.0,125000.0 +Retail (Los Angeles),34.052235,-118.243683,3,NewBoat,-0.0,0.0,125000.0 Retail (Los Angeles),34.052235,-118.243683,4,NewBoat,0.0,0.0,125000.0 -Retail (Los Angeles),34.052235,-118.243683,5,NewBoat,-0.0,0.0,125000.0 -Retail (Houston),29.760427,-95.369804,1,NewBoat,0.0,0.0,125000.0 -Retail (Houston),29.760427,-95.369804,2,NewBoat,0.0,0.0,125000.0 -Retail (Houston),29.760427,-95.369804,3,NewBoat,0.0,0.0,125000.0 +Retail (Los Angeles),34.052235,-118.243683,5,NewBoat,0.0,0.0,125000.0 +Retail (Houston),29.760427,-95.369804,1,NewBoat,-0.0,-0.0,125000.0 +Retail (Houston),29.760427,-95.369804,2,NewBoat,-0.0,0.0,125000.0 +Retail (Houston),29.760427,-95.369804,3,NewBoat,-0.0,0.0,125000.0 Retail (Houston),29.760427,-95.369804,4,NewBoat,0.0,0.0,125000.0 -Retail (Houston),29.760427,-95.369804,5,NewBoat,-0.0,0.0,125000.0 -Retail (Phoenix),33.448376,-112.074036,1,NewBoat,0.0,0.0,125000.0 -Retail (Phoenix),33.448376,-112.074036,2,NewBoat,0.0,0.0,125000.0 -Retail (Phoenix),33.448376,-112.074036,3,NewBoat,0.0,0.0,125000.0 -Retail (Phoenix),33.448376,-112.074036,4,NewBoat,-0.0,-0.0,125000.0 +Retail (Houston),29.760427,-95.369804,5,NewBoat,0.0,0.0,125000.0 +Retail (Phoenix),33.448376,-112.074036,1,NewBoat,-0.0,0.0,125000.0 +Retail (Phoenix),33.448376,-112.074036,2,NewBoat,-0.0,-0.0,125000.0 +Retail (Phoenix),33.448376,-112.074036,3,NewBoat,-0.0,0.0,125000.0 +Retail (Phoenix),33.448376,-112.074036,4,NewBoat,0.0,0.0,125000.0 Retail (Phoenix),33.448376,-112.074036,5,NewBoat,0.0,0.0,125000.0 -Retail (Philadelphia),39.952583,-75.165222,1,NewBoat,0.0,0.0,125000.0 -Retail (Philadelphia),39.952583,-75.165222,2,NewBoat,0.0,0.0,125000.0 -Retail (Philadelphia),39.952583,-75.165222,3,NewBoat,0.0,0.0,125000.0 +Retail (Philadelphia),39.952583,-75.165222,1,NewBoat,-0.0,0.0,125000.0 +Retail (Philadelphia),39.952583,-75.165222,2,NewBoat,-0.0,0.0,125000.0 +Retail (Philadelphia),39.952583,-75.165222,3,NewBoat,-0.0,0.0,125000.0 Retail (Philadelphia),39.952583,-75.165222,4,NewBoat,0.0,0.0,125000.0 Retail (Philadelphia),39.952583,-75.165222,5,NewBoat,0.0,0.0,125000.0 -Retail (San Antonio),29.424122,-98.493629,1,NewBoat,0.0,0.0,125000.0 -Retail (San Antonio),29.424122,-98.493629,2,NewBoat,0.0,0.0,125000.0 +Retail (San Antonio),29.424122,-98.493629,1,NewBoat,-0.0,-0.0,125000.0 +Retail (San Antonio),29.424122,-98.493629,2,NewBoat,-0.0,0.0,125000.0 Retail (San Antonio),29.424122,-98.493629,3,NewBoat,0.0,0.0,125000.0 Retail (San Antonio),29.424122,-98.493629,4,NewBoat,0.0,0.0,125000.0 -Retail (San Antonio),29.424122,-98.493629,5,NewBoat,0.0,0.0,125000.0 -Retail (San Diego),32.715736,-117.161087,1,NewBoat,0.0,0.0,125000.0 -Retail (San Diego),32.715736,-117.161087,2,NewBoat,0.0,0.0,125000.0 -Retail (San Diego),32.715736,-117.161087,3,NewBoat,0.0,0.0,125000.0 +Retail (San Antonio),29.424122,-98.493629,5,NewBoat,-0.0,0.0,125000.0 +Retail (San Diego),32.715736,-117.161087,1,NewBoat,-0.0,0.0,125000.0 +Retail (San Diego),32.715736,-117.161087,2,NewBoat,-0.0,0.0,125000.0 +Retail (San Diego),32.715736,-117.161087,3,NewBoat,-0.0,0.0,125000.0 Retail (San Diego),32.715736,-117.161087,4,NewBoat,0.0,0.0,125000.0 -Retail (San Diego),32.715736,-117.161087,5,NewBoat,0.0,0.0,125000.0 +Retail (San Diego),32.715736,-117.161087,5,NewBoat,-0.0,0.0,125000.0 Retail (Dallas),32.776664,-96.796988,1,NewBoat,63.15789,757894.73684,125000.0 Retail (Dallas),32.776664,-96.796988,2,NewBoat,71.46814,857617.72853,125000.0 Retail (Dallas),32.776664,-96.796988,3,NewBoat,75.8857,910628.37148,125000.0 Retail (Dallas),32.776664,-96.796988,4,NewBoat,76.90434,922852.03459,125000.0 Retail (Dallas),32.776664,-96.796988,5,NewBoat,77.27087,927250.44516,125000.0 -Retail (San Jose),37.338208,-121.886329,1,NewBoat,0.0,0.0,125000.0 -Retail (San Jose),37.338208,-121.886329,2,NewBoat,0.0,0.0,125000.0 -Retail (San Jose),37.338208,-121.886329,3,NewBoat,0.0,0.0,125000.0 +Retail (San Jose),37.338208,-121.886329,1,NewBoat,-0.0,0.0,125000.0 +Retail (San Jose),37.338208,-121.886329,2,NewBoat,-0.0,0.0,125000.0 +Retail (San Jose),37.338208,-121.886329,3,NewBoat,-0.0,0.0,125000.0 Retail (San Jose),37.338208,-121.886329,4,NewBoat,0.0,0.0,125000.0 Retail (San Jose),37.338208,-121.886329,5,NewBoat,0.0,0.0,125000.0 diff --git a/test/fixtures/boat_example/plant_emissions.csv b/test/fixtures/boat_example/plant_emissions.csv new file mode 100644 index 0000000..2602866 --- /dev/null +++ b/test/fixtures/boat_example/plant_emissions.csv @@ -0,0 +1,11 @@ +plant,latitude,longitude,emission,year,input amount (tonne),emission factor (tonne/tonne),emissions amount (tonne) +BoatFactory (Dallas),32.776664,-96.796988,CO2,1,63.15789,5.0,315.78947 +BoatFactory (Dallas),32.776664,-96.796988,CO2,2,71.46814,5.0,357.34072 +BoatFactory (Dallas),32.776664,-96.796988,CO2,3,75.8857,5.0,379.42849 +BoatFactory (Dallas),32.776664,-96.796988,CO2,4,76.90434,5.0,384.52168 +BoatFactory (Dallas),32.776664,-96.796988,CO2,5,77.27087,5.0,386.35435 +RecyclingPlant (Dallas),32.776664,-96.796988,CO2,1,6.31579,5.0,31.57895 +RecyclingPlant (Dallas),32.776664,-96.796988,CO2,2,22.93629,5.0,114.68144 +RecyclingPlant (Dallas),32.776664,-96.796988,CO2,3,31.7714,5.0,158.85698 +RecyclingPlant (Dallas),32.776664,-96.796988,CO2,4,33.80867,5.0,169.04336 +RecyclingPlant (Dallas),32.776664,-96.796988,CO2,5,34.54174,5.0,172.7087 diff --git a/test/fixtures/boat_example/plant_outputs.csv b/test/fixtures/boat_example/plant_outputs.csv index fad04cb..99c1429 100644 --- a/test/fixtures/boat_example/plant_outputs.csv +++ b/test/fixtures/boat_example/plant_outputs.csv @@ -20,7 +20,7 @@ BoatFactory (Houston),29.760427,-95.369804,NewBoat,3,0.0,0.0,0.0,0.0 BoatFactory (Houston),29.760427,-95.369804,NewBoat,4,0.0,0.0,0.0,0.0 BoatFactory (Houston),29.760427,-95.369804,NewBoat,5,0.0,0.0,0.0,0.0 BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,1,0.0,0.0,0.0,0.0 -BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,2,0.0,0.0,0.0,0.0 +BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,2,-0.0,0.0,0.0,0.0 BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,3,0.0,0.0,0.0,0.0 BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,4,0.0,0.0,0.0,0.0 BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,5,0.0,0.0,0.0,0.0 @@ -50,25 +50,25 @@ BoatFactory (San Jose),37.338208,-121.886329,NewBoat,3,0.0,0.0,0.0,0.0 BoatFactory (San Jose),37.338208,-121.886329,NewBoat,4,0.0,0.0,0.0,0.0 BoatFactory (San Jose),37.338208,-121.886329,NewBoat,5,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Nail,1,0.0,0.0,0.0,0.0 -RecyclingPlant (Chicago),41.881832,-87.623177,Nail,2,-0.0,0.0,0.0,0.0 +RecyclingPlant (Chicago),41.881832,-87.623177,Nail,2,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Nail,3,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Nail,4,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Nail,5,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Wood,1,0.0,0.0,0.0,0.0 -RecyclingPlant (Chicago),41.881832,-87.623177,Wood,2,-0.0,0.0,0.0,0.0 +RecyclingPlant (Chicago),41.881832,-87.623177,Wood,2,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Wood,3,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Wood,4,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,Wood,5,0.0,0.0,0.0,0.0 RecyclingPlant (New York City),40.712776,-74.005974,Nail,1,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Nail,2,0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Nail,2,-0.0,0.0,0.0,0.0 RecyclingPlant (New York City),40.712776,-74.005974,Nail,3,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Nail,4,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Nail,5,0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Nail,4,-0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Nail,5,-0.0,0.0,0.0,0.0 RecyclingPlant (New York City),40.712776,-74.005974,Wood,1,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Wood,2,0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Wood,2,-0.0,0.0,0.0,0.0 RecyclingPlant (New York City),40.712776,-74.005974,Wood,3,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Wood,4,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,Wood,5,0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Wood,4,-0.0,0.0,0.0,0.0 +RecyclingPlant (New York City),40.712776,-74.005974,Wood,5,-0.0,0.0,0.0,0.0 RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,1,0.0,0.0,0.0,0.0 RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,2,0.0,0.0,0.0,0.0 RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,3,0.0,0.0,0.0,0.0 @@ -90,14 +90,14 @@ RecyclingPlant (Houston),29.760427,-95.369804,Wood,3,0.0,0.0,0.0,0.0 RecyclingPlant (Houston),29.760427,-95.369804,Wood,4,0.0,0.0,0.0,0.0 RecyclingPlant (Houston),29.760427,-95.369804,Wood,5,0.0,0.0,0.0,0.0 RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,1,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,2,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,3,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,4,0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,2,-0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,3,-0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,4,-0.0,0.0,0.0,0.0 RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,5,0.0,0.0,0.0,0.0 RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,1,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,2,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,3,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,4,0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,2,-0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,3,-0.0,0.0,0.0,0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,4,-0.0,0.0,0.0,0.0 RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,5,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,1,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,2,0.0,0.0,0.0,0.0 @@ -109,12 +109,12 @@ RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,2,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,3,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,4,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,5,0.0,0.0,0.0,0.0 -RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,1,0.0,0.0,0.0,0.0 +RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,1,-0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,2,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,3,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,4,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,5,0.0,0.0,0.0,0.0 -RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,1,0.0,0.0,0.0,0.0 +RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,1,-0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,2,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,3,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,4,0.0,0.0,0.0,0.0 diff --git a/test/fixtures/boat_example/plants.csv b/test/fixtures/boat_example/plants.csv index eeddb4a..4b29720 100644 --- a/test/fixtures/boat_example/plants.csv +++ b/test/fixtures/boat_example/plants.csv @@ -1,101 +1,101 @@ plant,latitude,longitude,initial capacity,current capacity,year,operational?,input amount (tonne),opening cost ($),fixed operating cost ($),variable operating cost ($) -BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,2,false,0.0,0.0,0.0,0.0 +BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,0.0,0.0,0.0,0.0 +BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,0.0,0.0,0.0,0.0 +BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,2,false,0.0,0.0,0.0,0.0 +BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,5,false,0.0,0.0,0.0,0.0 +BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,1,true,63.15789,100000.0,250000.0,315.78947 BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,2,true,71.46814,0.0,250000.0,357.34072 BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,3,true,75.8857,0.0,250000.0,379.42849 BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,4,true,76.90434,0.0,250000.0,384.52168 BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,5,true,77.27087,0.0,250000.0,386.35435 -BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,2,false,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,3,false,0.0,0.0,0.0,0.0 RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,0.0,0.0,0.0,0.0 +RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,0.0,0.0,0.0,0.0 +RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,4,false,0.0,0.0,0.0,0.0 RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,0.0,0.0,0.0,0.0 +RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,2,false,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,3,false,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,4,false,0.0,0.0,0.0,0.0 RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,5,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,5,false,0.0,0.0,0.0,0.0 +RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,1,true,6.31579,500000.0,125000.0,15.78947 RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,2,true,22.93629,0.0,125000.0,57.34072 RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,3,true,31.7714,0.0,125000.0,79.42849 RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,4,true,33.80867,0.0,125000.0,84.52168 RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,5,true,34.54174,0.0,125000.0,86.35435 -RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,2,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,3,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,4,false,0.0,0.0,0.0,0.0 -RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,5,false,0.0,0.0,0.0,0.0 +RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,1,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,3,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,4,false,-0.0,0.0,0.0,-0.0 +RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,5,false,-0.0,0.0,0.0,-0.0 diff --git a/test/src/model/build_test.jl b/test/src/model/build_test.jl index c167321..00757bf 100644 --- a/test/src/model/build_test.jl +++ b/test/src/model/build_test.jl @@ -10,6 +10,7 @@ function model_build_test() z_disp = model[:z_disp] z_input = model[:z_input] z_tr_em = model[:z_tr_em] + z_plant_em = model[:z_plant_em] x = model[:x] obj = objective_function(model) # print(model) @@ -51,6 +52,12 @@ function model_build_test() @test haskey(z_tr_em, ("CO2", "C2", "L1", "P1", 1)) @test haskey(z_tr_em, ("CH4", "C2", "L1", "P1", 1)) + # Variables: Plant emissions + @test haskey(z_plant_em, ("CO2", "L1", 1)) + @test haskey(z_plant_em, ("CO2", "L1", 2)) + @test haskey(z_plant_em, ("CO2", "L1", 3)) + @test haskey(z_plant_em, ("CO2", "L1", 4)) + # Plants: Definition of total plant input @test repr(model[:eq_z_input]["L1", 1]) == "eq_z_input[L1,1] : -y[C2,L1,P1,1] - y[C1,L1,P2,1] + z_input[L1,1] = 0" @@ -129,4 +136,8 @@ function model_build_test() # Products: Transportation emissions @test repr(model[:eq_tr_em]["CH4", "L1", "C3", "P4", 1]) == "eq_tr_em[CH4,L1,C3,P4,1] : -0.333354 y[L1,C3,P4,1] + z_tr_em[CH4,L1,C3,P4,1] = 0" + + # Plants: Plant emissions + @test repr(model[:eq_plant_em]["CO2", "L1", 1]) == + "eq_plant_em[CO2,L1,1] : -0.1 y[C2,L1,P1,1] - 0.1 y[C1,L1,P2,1] + z_plant_em[CO2,L1,1] = 0" end