mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Reformat source code
This commit is contained in:
@@ -290,10 +290,10 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false
|
|||||||
for p in plants, t in T
|
for p in plants, t in T
|
||||||
eq_z_process[p.name, t] = @constraint(
|
eq_z_process[p.name, t] = @constraint(
|
||||||
model,
|
model,
|
||||||
z_process[p.name, t] == z_input[p.name, t] +
|
z_process[p.name, t] ==
|
||||||
sum(
|
z_input[p.name, t] + sum(
|
||||||
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t]
|
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t] for
|
||||||
for m in keys(p.input_mix)
|
m in keys(p.input_mix)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -448,20 +448,16 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false
|
|||||||
eq_storage_limit = _init(model, :eq_storage_limit)
|
eq_storage_limit = _init(model, :eq_storage_limit)
|
||||||
for p in plants, m in keys(p.storage_limit), t in T
|
for p in plants, m in keys(p.storage_limit), t in T
|
||||||
if isfinite(p.storage_limit[m][t])
|
if isfinite(p.storage_limit[m][t])
|
||||||
eq_storage_limit[p.name, m.name, t] = @constraint(
|
eq_storage_limit[p.name, m.name, t] =
|
||||||
model,
|
@constraint(model, z_storage[p.name, m.name, t] <= p.storage_limit[m][t])
|
||||||
z_storage[p.name, m.name, t] <= p.storage_limit[m][t]
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# All stored materials must be processed by end of time horizon
|
# All stored materials must be processed by end of time horizon
|
||||||
eq_storage_final = _init(model, :eq_storage_final)
|
eq_storage_final = _init(model, :eq_storage_final)
|
||||||
for p in plants, m in keys(p.input_mix)
|
for p in plants, m in keys(p.input_mix)
|
||||||
eq_storage_final[p.name, m.name] = @constraint(
|
eq_storage_final[p.name, m.name] =
|
||||||
model,
|
@constraint(model, z_storage[p.name, m.name, instance.time_horizon] == 0)
|
||||||
z_storage[p.name, m.name, instance.time_horizon] == 0
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Global emissions limit
|
# Global emissions limit
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ function plants_report(model)::DataFrame
|
|||||||
|
|
||||||
# Calculate total storage cost
|
# Calculate total storage cost
|
||||||
storage_cost = sum(
|
storage_cost = sum(
|
||||||
p.storage_cost[m][t] * value(model[:z_storage][p.name, m.name, t])
|
p.storage_cost[m][t] * value(model[:z_storage][p.name, m.name, t]) for
|
||||||
for m in keys(p.storage_cost)
|
m in keys(p.storage_cost)
|
||||||
)
|
)
|
||||||
|
|
||||||
var_operating_cost = input * p.capacities[1].var_operating_cost[t]
|
var_operating_cost = input * p.capacities[1].var_operating_cost[t]
|
||||||
@@ -100,8 +100,8 @@ function plant_inputs_report(model)::DataFrame
|
|||||||
|
|
||||||
for p in plants, m in keys(p.input_mix), t in T
|
for p in plants, m in keys(p.input_mix), t in T
|
||||||
amount_received = sum(
|
amount_received = sum(
|
||||||
value(model[:y][src.name, p.name, m.name, t])
|
value(model[:y][src.name, p.name, m.name, t]) for
|
||||||
for (src, prod) in model.ext[:E_in][p] if prod == m
|
(src, prod) in model.ext[:E_in][p] if prod == m
|
||||||
)
|
)
|
||||||
storage_level = value(model[:z_storage][p.name, m.name, t])
|
storage_level = value(model[:z_storage][p.name, m.name, t])
|
||||||
storage_cost = p.storage_cost[m][t] * storage_level
|
storage_cost = p.storage_cost[m][t] * storage_level
|
||||||
@@ -197,7 +197,8 @@ function plant_emissions_report(model)::DataFrame
|
|||||||
end
|
end
|
||||||
|
|
||||||
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
|
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
|
||||||
write_plant_inputs_report(solution, filename) = CSV.write(filename, plant_inputs_report(solution))
|
write_plant_inputs_report(solution, filename) =
|
||||||
|
CSV.write(filename, plant_inputs_report(solution))
|
||||||
write_plant_outputs_report(solution, filename) =
|
write_plant_outputs_report(solution, filename) =
|
||||||
CSV.write(filename, plant_outputs_report(solution))
|
CSV.write(filename, plant_outputs_report(solution))
|
||||||
write_plant_emissions_report(solution, filename) =
|
write_plant_emissions_report(solution, filename) =
|
||||||
|
|||||||
Reference in New Issue
Block a user