Skip to content

Commit

Permalink
Update how hydro op chars are selected from the database to only sele…
Browse files Browse the repository at this point in the history
…ct horizons on periods when the project is operational
  • Loading branch information
Janie115 committed Sep 12, 2024
1 parent 857a495 commit 0ceb995
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions gridpath/project/operations/operational_types/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def get_hydro_inputs_from_database(

# TODO: figure out if this still works after hydro update in ra toolkit
sql = f"""
SELECT project, horizon, average_power_fraction, min_power_fraction,
SELECT project, prj_tbl.horizon, average_power_fraction, min_power_fraction,
max_power_fraction
FROM
(SELECT project, stage_id, horizon
Expand All @@ -808,7 +808,7 @@ def get_hydro_inputs_from_database(
AND (project_specified_capacity_scenario_id = {subscenarios.PROJECT_SPECIFIED_CAPACITY_SCENARIO_ID}
OR project_new_cost_scenario_id = {subscenarios.PROJECT_NEW_COST_SCENARIO_ID})
AND stage_id = {stage}
) as projects_periods_timepoints_tbl
) as prj_tbl
INNER JOIN (
SELECT project, hydro_operational_chars_scenario_id
FROM inputs_project_operational_chars
Expand All @@ -819,6 +819,17 @@ def get_hydro_inputs_from_database(
LEFT OUTER JOIN
inputs_project_hydro_operational_chars
USING (hydro_operational_chars_scenario_id, project, stage_id, horizon)
JOIN (
SELECT DISTINCT balancing_type_horizon, horizon
FROM inputs_temporal_horizon_timepoints
WHERE temporal_scenario_id = {subscenarios.TEMPORAL_SCENARIO_ID}
AND subproblem_id = {subproblem}
AND stage_id = {stage}
) as hrz_tbl
ON (
balancing_type_project = balancing_type_horizon
AND prj_tbl.horizon = hrz_tbl.horizon
)
WHERE hydro_iteration = {hydro_iteration}
;
"""
Expand Down

0 comments on commit 0ceb995

Please sign in to comment.