Skip to content

Commit 9aa7ce9

Browse files
committed
Add lower bound for transport flows
1 parent faab5e0 commit 9aa7ce9

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

src/constraints/capacity.jl

+20
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,26 @@ 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+
# - Maximum input flows limit
360+
attach_constraint!(
361+
model,
362+
constraints[table_name],
363+
cons_name,
364+
[
365+
@constraint(
366+
model,
367+
outgoing_flow 0,
368+
base_name = "$cons_name[$(row.asset),$(row.year),$(row.rep_period),$(row.time_block_start):$(row.time_block_end)]"
369+
) for (row, outgoing_flow) in
370+
zip(constraints[table_name].indices, constraints[table_name].expressions[:outgoing])
371+
],
372+
)
373+
374+
return
355375
end
356376

357377
# The below two functions are very similar

src/constraints/create.jl

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ 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,
1920
:limit_units_on_compact_method,
2021
:limit_units_on_simple_method,
2122
:min_output_flow_with_unit_commitment,

src/model-preparation.jl

+1
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ function add_expressions_to_constraints!(connection, variables, constraints)
531531
:capacity_outgoing_simple_method,
532532
:capacity_outgoing_simple_method_non_investable_storage_with_binary,
533533
:capacity_outgoing_simple_method_investable_storage_with_binary,
534+
:min_outgoing_flow_for_transport_flows_without_unit_commitment,
534535
)
535536
@timeit to "add_expression_terms_rep_period_constraints! for $table_name" add_expression_terms_rep_period_constraints!(
536537
connection,

src/sql/create-constraints.sql

+32
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,38 @@ where
195195
drop sequence id
196196
;
197197

198+
create sequence id start 1
199+
;
200+
201+
create table cons_min_outgoing_flow_for_transport_flows_without_unit_commitment as
202+
203+
with transport_flow_info as (
204+
select
205+
asset.asset,
206+
coalesce(
207+
(select bool_or(flow.is_transport)
208+
from flow
209+
where flow.from_asset = asset.asset),
210+
false
211+
) as outgoing_flows_have_transport_flows,
212+
from asset
213+
)
214+
select
215+
nextval('id') as id,
216+
t_high.*
217+
from
218+
t_highest_out_flows as t_high
219+
left join asset on t_high.asset = asset.asset
220+
left join transport_flow_info on t_high.asset = transport_flow_info.asset
221+
where
222+
asset.type in ('producer', 'storage', 'conversion')
223+
and transport_flow_info.outgoing_flows_have_transport_flows
224+
and not asset.unit_commitment
225+
;
226+
227+
drop sequence id
228+
;
229+
198230
create table cons_limit_units_on_compact_method as
199231
select
200232
*

0 commit comments

Comments
 (0)