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
|
||||
eq_z_process[p.name, t] = @constraint(
|
||||
model,
|
||||
z_process[p.name, t] == z_input[p.name, t] +
|
||||
sum(
|
||||
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t]
|
||||
for m in keys(p.input_mix)
|
||||
z_process[p.name, t] ==
|
||||
z_input[p.name, t] + sum(
|
||||
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t] for
|
||||
m in keys(p.input_mix)
|
||||
)
|
||||
)
|
||||
end
|
||||
@@ -448,20 +448,16 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false
|
||||
eq_storage_limit = _init(model, :eq_storage_limit)
|
||||
for p in plants, m in keys(p.storage_limit), t in T
|
||||
if isfinite(p.storage_limit[m][t])
|
||||
eq_storage_limit[p.name, m.name, t] = @constraint(
|
||||
model,
|
||||
z_storage[p.name, m.name, t] <= p.storage_limit[m][t]
|
||||
)
|
||||
eq_storage_limit[p.name, m.name, t] =
|
||||
@constraint(model, z_storage[p.name, m.name, t] <= p.storage_limit[m][t])
|
||||
end
|
||||
end
|
||||
|
||||
# All stored materials must be processed by end of time horizon
|
||||
eq_storage_final = _init(model, :eq_storage_final)
|
||||
for p in plants, m in keys(p.input_mix)
|
||||
eq_storage_final[p.name, m.name] = @constraint(
|
||||
model,
|
||||
z_storage[p.name, m.name, instance.time_horizon] == 0
|
||||
)
|
||||
eq_storage_final[p.name, m.name] =
|
||||
@constraint(model, z_storage[p.name, m.name, instance.time_horizon] == 0)
|
||||
end
|
||||
|
||||
# Global emissions limit
|
||||
|
||||
@@ -36,8 +36,8 @@ function plants_report(model)::DataFrame
|
||||
|
||||
# Calculate total storage cost
|
||||
storage_cost = sum(
|
||||
p.storage_cost[m][t] * value(model[:z_storage][p.name, m.name, t])
|
||||
for m in keys(p.storage_cost)
|
||||
p.storage_cost[m][t] * value(model[:z_storage][p.name, m.name, t]) for
|
||||
m in keys(p.storage_cost)
|
||||
)
|
||||
|
||||
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
|
||||
amount_received = sum(
|
||||
value(model[:y][src.name, p.name, m.name, t])
|
||||
for (src, prod) in model.ext[:E_in][p] if prod == m
|
||||
value(model[:y][src.name, p.name, m.name, t]) for
|
||||
(src, prod) in model.ext[:E_in][p] if prod == m
|
||||
)
|
||||
storage_level = value(model[:z_storage][p.name, m.name, t])
|
||||
storage_cost = p.storage_cost[m][t] * storage_level
|
||||
@@ -197,7 +197,8 @@ function plant_emissions_report(model)::DataFrame
|
||||
end
|
||||
|
||||
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) =
|
||||
CSV.write(filename, plant_outputs_report(solution))
|
||||
write_plant_emissions_report(solution, filename) =
|
||||
|
||||
Reference in New Issue
Block a user