Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually allow var negative power #938

Merged
merged 13 commits into from
Aug 23, 2024
19 changes: 12 additions & 7 deletions gridpath/project/operations/operational_types/gen_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def add_model_components(
| | :code:`GenVar_Max_Downward_Reserves_Constraint` |
| | *Defined over*: :code:`GEN_VAR_OPR_TMPS` |
| |
| Downward reserves cannot exceed power provision. |
| Downward reserves cannot exceed power provision when the capacity |
| factor is non-negative (power is non-negative); otherwise they are set |
| to zero. |
+-------------------------------------------------------------------------+

"""
Expand Down Expand Up @@ -203,7 +205,7 @@ def add_model_components(
# Variables
###########################################################################

m.GenVar_Provide_Power_MW = Var(m.GEN_VAR_OPR_TMPS, within=NonNegativeReals)
m.GenVar_Provide_Power_MW = Var(m.GEN_VAR_OPR_TMPS, within=Reals)
m.GenVar_Scheduled_Curtailment_MW = Var(m.GEN_VAR_OPR_TMPS, within=NonNegativeReals)

# Expressions
Expand Down Expand Up @@ -317,7 +319,7 @@ def max_power_rule(mod, g, tmp):
**Constraint Name**: GenVar_Max_Power_Constraint
**Enforced Over**: GEN_VAR_OPR_TMPS

Power provision plus upward services cannot exceed available power, which
Power provision plus curtailment cannot exceed available power, which
is equal to the available capacity multiplied by the capacity factor.
"""
return (
Expand Down Expand Up @@ -346,10 +348,13 @@ def max_downward_reserves_rule(mod, g, tmp):

Downward reserves can't exceed power provision.
"""
return (
mod.GenVar_Provide_Power_MW[g, tmp] - mod.GenVar_Downwards_Reserves_MW[g, tmp]
>= 0
)
if mod.gen_var_cap_factor[g, tmp] >= 0:
return (
mod.GenVar_Downwards_Reserves_MW[g, tmp]
<= mod.GenVar_Provide_Power_MW[g, tmp]
)
else:
return mod.GenVar_Downwards_Reserves_MW[g, tmp] == 0


# Operational Type Methods
Expand Down
Loading