Skip to content

Commit

Permalink
finalising explicit consideration of irrigation requirements also for…
Browse files Browse the repository at this point in the history
… pumped-storage scenario
  • Loading branch information
sebastiansterl committed Nov 10, 2023
1 parent cf4aa26 commit 7cc4cbe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Version 1.0.1 - September 2023

Version 1.0.2 - October 2023

Version 1.0.3 - November 2023

## License
See also the [LICENSE](./LICENSE.md) file.

24 changes: 12 additions & 12 deletions code/B_REVUB_main_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,17 +1454,17 @@
Q_STOR_spill_hourly_upper[n,y,HPP] = 0

# [calculate] spilling component of lower reservoir in m^3/s (eq. S40)
if (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr < Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = Q_STOR_flexible_hourly[n,y,HPP] - (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr
elif (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr >= Q_STOR_flexible_hourly[n,y,HPP]:
if (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr < Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP] - (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr
elif (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr >= Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = 0

# [calculate] total net outflow in m^3/s (eq. S36)
Q_STOR_out_hourly[n,y,HPP] = Q_STOR_stable_hourly[n,y,HPP] + Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_spill_hourly_lower[n,y,HPP]
Q_STOR_out_hourly[n,y,HPP] = Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_spill_hourly_lower[n,y,HPP]

# [calculate] reservoir volume in m^3 at next time step (eq. S34, S35)
V_STOR_hourly_upper[n+1,y,HPP] = V_STOR_hourly_upper[n,y,HPP] + (Q_in_frac_hourly[n,y,HPP] - Q_STOR_stable_hourly[n,y,HPP] - Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_pump_hourly[n,y,HPP] + (precipitation_flux_hourly[n,y,HPP] - evaporation_flux_hourly[n,y,HPP])*A_STOR_hourly_upper[n,y,HPP]/rho)*secs_hr
V_STOR_hourly_lower[n+1,y,HPP] = V_STOR_hourly_lower[n,y,HPP] + (Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_pump_hourly[n,y,HPP] - Q_STOR_spill_hourly_lower[n,y,HPP])*secs_hr
V_STOR_hourly_lower[n+1,y,HPP] = V_STOR_hourly_lower[n,y,HPP] + (Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_pump_hourly[n,y,HPP] - Q_STOR_spill_hourly_lower[n,y,HPP])*secs_hr

# [check] prevent unreal values when lake levels drop low
if V_STOR_hourly_upper[n+1,y,HPP] < 0:
Expand Down Expand Up @@ -1759,18 +1759,18 @@
if Q_STOR_spill_hourly_upper[n,y,HPP] < 0:
Q_STOR_spill_hourly_upper[n,y,HPP] = 0

# [calculate] spilling component of lower reservoir in m^3/s (eq. S40)
if (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr < Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = Q_STOR_flexible_hourly[n,y,HPP] - (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr
elif (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr >= Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = 0
# [calculate] spilling component of lower reservoir in m^3/s (eq. S40)
if (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr < Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP] - (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr
elif (V_lower_max[HPP] - V_STOR_hourly_lower[n,y,HPP])/secs_hr >= Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP]:
Q_STOR_spill_hourly_lower[n,y,HPP] = 0

# [calculate] total net outflow in m^3/s (eq. S36)
Q_STOR_out_hourly[n,y,HPP] = Q_STOR_stable_hourly[n,y,HPP] + Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_spill_hourly_lower[n,y,HPP]
Q_STOR_out_hourly[n,y,HPP] = Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_spill_hourly_lower[n,y,HPP]

# [calculate] reservoir volume in m^3 at next time step (eq. S34, S35)
V_STOR_hourly_upper[n+1,y,HPP] = V_STOR_hourly_upper[n,y,HPP] + (Q_in_frac_hourly[n,y,HPP] - Q_STOR_stable_hourly[n,y,HPP] - Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_spill_hourly_upper[n,y,HPP] + Q_STOR_pump_hourly[n,y,HPP] + (precipitation_flux_hourly[n,y,HPP] - evaporation_flux_hourly[n,y,HPP])*A_STOR_hourly_upper[n,y,HPP]/rho)*secs_hr
V_STOR_hourly_lower[n+1,y,HPP] = V_STOR_hourly_lower[n,y,HPP] + (Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_pump_hourly[n,y,HPP] - Q_STOR_spill_hourly_lower[n,y,HPP])*secs_hr
V_STOR_hourly_lower[n+1,y,HPP] = V_STOR_hourly_lower[n,y,HPP] + (Q_STOR_stable_hourly[n,y,HPP] - Q_out_stable_env_irr_hourly[n,y,HPP] + Q_STOR_flexible_hourly[n,y,HPP] - Q_STOR_pump_hourly[n,y,HPP] - Q_STOR_spill_hourly_lower[n,y,HPP])*secs_hr

# [check] prevent unreal values when lake levels drop low
if V_STOR_hourly_upper[n+1,y,HPP] < 0:
Expand Down
Binary file modified manual/REVUB_manual.pdf
Binary file not shown.

0 comments on commit 7cc4cbe

Please sign in to comment.