Skip to content

Commit

Permalink
Change lower bound and test value (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawin authored Oct 14, 2024
1 parent ee4fc19 commit f841a1b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/constraints/capacity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Adds the capacity constraints for all asset types to the model
function add_capacity_constraints!(
model,
graph,
Ap,
Acv,
As,
dataframes,
df_flows,
flow,
Expand Down Expand Up @@ -289,9 +292,12 @@ function add_capacity_constraints!(
incoming_flow_highest_in_resolution[row.index] != 0
]

# - Lower limit for flows that are not transport assets
# - Lower limit for flows associated with assets
assets_with_non_negative_outgoing_flows = Ap Acv As
assets_with_non_negative_incoming_flows = Acv As
for row in eachrow(df_flows)
if !graph[row.from, row.to].is_transport
if row.from in assets_with_non_negative_outgoing_flows ||
row.to in assets_with_non_negative_incoming_flows
JuMP.set_lower_bound(flow[row.index], 0.0)
end
end
Expand Down
3 changes: 3 additions & 0 deletions src/create-model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,9 @@ function create_model(
@timeit to "add_capacity_constraints!" add_capacity_constraints!(
model,
graph,
Ap,
Acv,
As,
dataframes,
df_flows,
flow,
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ if !isdir(OUTPUT_FOLDER)
mkdir(OUTPUT_FOLDER)
end

include("utils.jl")

#=
Don't add your tests to runtests.jl. Instead, create files named
Expand Down
2 changes: 1 addition & 1 deletion test/test-case-studies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end
connection;
model_parameters_file = joinpath(@__DIR__, "inputs", "model-parameters-example.toml"),
)
@test energy_problem.objective_value 1844506.781181 atol = 1e-5
@test energy_problem.objective_value 2318866.768000 atol = 1e-5
end

@testset "Infeasible Case Study" begin
Expand Down
File renamed without changes.

0 comments on commit f841a1b

Please sign in to comment.