Skip to content

Commit

Permalink
Fix case where the there are no time blocks to determine in a constraint
Browse files Browse the repository at this point in the history
For FI_Hydro_Reservoir in the EU case, there are no matches in the incoming
flows, so there is nothing constraining the time block. In this case, it uses
1 as time_block_start and num_timesteps and tmie_block_end of the single
block.

Related to #895
  • Loading branch information
abelsiqueira committed Oct 29, 2024
1 parent 95c90e3 commit 7a6306a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/20-tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ variables = compute_variables_indices(dataframes)
Now we can compute the model.

```@example manual
model = create_model(graph, sets, variables, representative_periods, dataframes, years, timeframe, groups, model_parameters)
model = create_model(connection, graph, sets, variables, representative_periods, dataframes, years, timeframe, groups, model_parameters)
```

Finally, we can compute the solution.
Expand Down
4 changes: 2 additions & 2 deletions src/tmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function tmp_create_constraints_indices(connection)
main.asset,
main.year,
main.rep_period,
sub.time_block_start,
COALESCE(sub.time_block_start, 1) AS time_block_start,
lead(sub.time_block_start - 1, 1, main.num_timesteps)
OVER (PARTITION BY main.asset, main.year, main.rep_period ORDER BY time_block_start)
AS time_block_end,
Expand Down Expand Up @@ -261,7 +261,7 @@ function tmp_create_constraints_indices(connection)
main.asset,
main.year,
main.rep_period,
sub.time_block_start,
COALESCE(sub.time_block_start, 1) AS time_block_start,
lead(sub.time_block_start - 1, 1, main.num_timesteps)
OVER (PARTITION BY main.asset, main.year, main.rep_period ORDER BY time_block_start)
AS time_block_end,
Expand Down

0 comments on commit 7a6306a

Please sign in to comment.