Skip to content

Commit af69b2d

Browse files
committed
Move to transport flows
1 parent a39e200 commit af69b2d

File tree

3 files changed

+45
-44
lines changed

3 files changed

+45
-44
lines changed

src/constraints/capacity.jl

-42
Original file line numberDiff line numberDiff line change
@@ -352,48 +352,6 @@ function add_capacity_constraints!(connection, model, expressions, constraints,
352352
],
353353
)
354354
end
355-
356-
cons_name = Symbol("min_output_flows_limit_for_transport_flows_without_unit_commitment")
357-
table_name = :min_outgoing_flow_for_transport_flows_without_unit_commitment
358-
359-
# - Minmum output flows limit if any of the flows is transport flow
360-
# - This allows negative flows but not all negative flows, so flows can pass through this asset
361-
# - Holds for producers, conversion and storage assets
362-
attach_constraint!(
363-
model,
364-
constraints[table_name],
365-
cons_name,
366-
[
367-
@constraint(
368-
model,
369-
outgoing_flow 0,
370-
base_name = "$cons_name[$(row.asset),$(row.year),$(row.rep_period),$(row.time_block_start):$(row.time_block_end)]"
371-
) for (row, outgoing_flow) in
372-
zip(constraints[table_name].indices, constraints[table_name].expressions[:outgoing])
373-
],
374-
)
375-
376-
# - Minmum input flows limit if any of the flows is transport flow
377-
# - This allows negative flows but not all negative flows, so flows can pass through this asset
378-
# - Holds for onversion and storage assets
379-
cons_name = Symbol("min_input_flows_limit_for_transport_flows")
380-
table_name = :min_incoming_flow_for_transport_flows
381-
382-
attach_constraint!(
383-
model,
384-
constraints[table_name],
385-
cons_name,
386-
[
387-
@constraint(
388-
model,
389-
incoming_flow 0,
390-
base_name = "$cons_name[$(row.asset),$(row.year),$(row.rep_period),$(row.time_block_start):$(row.time_block_end)]"
391-
) for (row, incoming_flow) in
392-
zip(constraints[table_name].indices, constraints[table_name].expressions[:incoming])
393-
],
394-
)
395-
396-
return
397355
end
398356

399357
# The below two functions are very similar

src/constraints/create.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ function compute_constraints_indices(connection)
1616
:capacity_outgoing_simple_method,
1717
:capacity_outgoing_simple_method_non_investable_storage_with_binary,
1818
:capacity_outgoing_simple_method_investable_storage_with_binary,
19-
:min_outgoing_flow_for_transport_flows_without_unit_commitment,
20-
:min_incoming_flow_for_transport_flows,
2119
:limit_units_on_compact_method,
2220
:limit_units_on_simple_method,
2321
:min_output_flow_with_unit_commitment,
@@ -29,6 +27,8 @@ function compute_constraints_indices(connection)
2927
:min_energy_over_clustered_year,
3028
:max_energy_over_clustered_year,
3129
:transport_flow_limit_simple_method,
30+
:min_outgoing_flow_for_transport_flows_without_unit_commitment,
31+
:min_incoming_flow_for_transport_flows,
3232
:group_max_investment_limit,
3333
:group_min_investment_limit,
3434
)

src/constraints/transport.jl

+43
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function add_transport_constraints!(
1818
expr_avail_export = expr_avail.expressions[:export]
1919
expr_avail_import = expr_avail.expressions[:import]
2020

21+
# - Capacity limits for transport flows
2122
let table_name = :transport_flow_limit_simple_method, cons = constraints[table_name]
2223
indices = _append_transport_data_to_indices(connection)
2324
var_flow = variables[:flow].container
@@ -89,6 +90,48 @@ function add_transport_constraints!(
8990
)
9091
end
9192

93+
# - Minmum output flows limit if any of the flows is transport flow
94+
# - This allows some negative flows but not all negative flows, so transport flows can pass through this asset
95+
# - Holds for producers, conversion and storage assets
96+
let table_name = :min_outgoing_flow_for_transport_flows_without_unit_commitment,
97+
cons_name = Symbol("min_output_flows_limit_for_transport_flows_without_unit_commitment")
98+
99+
attach_constraint!(
100+
model,
101+
constraints[table_name],
102+
cons_name,
103+
[
104+
@constraint(
105+
model,
106+
outgoing_flow 0,
107+
base_name = "$cons_name[$(row.asset),$(row.year),$(row.rep_period),$(row.time_block_start):$(row.time_block_end)]"
108+
) for (row, outgoing_flow) in
109+
zip(constraints[table_name].indices, constraints[table_name].expressions[:outgoing])
110+
],
111+
)
112+
end
113+
114+
# - Minmum input flows limit if any of the flows is transport flow
115+
# - This allows some negative flows but not all negative flows, so transport flows can pass through this asset
116+
# - Holds for onversion and storage assets
117+
let table_name = :min_incoming_flow_for_transport_flows,
118+
cons_name = Symbol("min_input_flows_limit_for_transport_flows")
119+
120+
attach_constraint!(
121+
model,
122+
constraints[table_name],
123+
cons_name,
124+
[
125+
@constraint(
126+
model,
127+
incoming_flow 0,
128+
base_name = "$cons_name[$(row.asset),$(row.year),$(row.rep_period),$(row.time_block_start):$(row.time_block_end)]"
129+
) for (row, incoming_flow) in
130+
zip(constraints[table_name].indices, constraints[table_name].expressions[:incoming])
131+
],
132+
)
133+
end
134+
92135
return
93136
end
94137

0 commit comments

Comments
 (0)