| |
| |
| |
|
|
| function _add_ramp_eqs!( |
| model::JuMP.Model, |
| g::ThermalUnit, |
| formulation_prod_vars::Gar1962.ProdVars, |
| formulation_ramping::PanGua2016.Ramping, |
| formulation_status_vars::Gar1962.StatusVars, |
| sc::UnitCommitmentScenario, |
| )::Nothing |
| |
| RESERVES_WHEN_SHUT_DOWN = true |
| gn = g.name |
| reserve = _total_reserves(model, g, sc) |
| eq_str_prod_limit = _init(model, :eq_str_prod_limit) |
| eq_prod_limit_ramp_up_extra_period = |
| _init(model, :eq_prod_limit_ramp_up_extra_period) |
| eq_prod_limit_shutdown_trajectory = |
| _init(model, :eq_prod_limit_shutdown_trajectory) |
| UT = g.min_uptime |
| SU = g.startup_limit |
| SD = g.shutdown_limit |
| RU = g.ramp_up_limit |
| RD = g.ramp_down_limit |
| T = model[:instance].time |
|
|
| |
| prod_above = model[:prod_above] |
|
|
| |
| is_on = model[:is_on] |
| switch_off = model[:switch_off] |
| switch_on = model[:switch_on] |
|
|
| for t in 1:T |
| Pbar = g.max_power[t] |
| if Pbar < 1e-7 |
| |
| continue |
| end |
|
|
| |
| |
| TRD = ceil((Pbar - SD) / RD) |
| TRU = floor((Pbar - SU) / RU) |
|
|
| |
| |
| if UT > 1 |
| |
| |
| |
| |
| eq_str_prod_limit[sc.name, gn, t] = @constraint( |
| model, |
| prod_above[sc.name, gn, t] + |
| g.min_power[t] * is_on[gn, t] + |
| reserve[t] <= |
| Pbar * is_on[gn, t] - |
| (t < T ? (Pbar - SD) * switch_off[gn, t+1] : 0.0) - sum( |
| (Pbar - (SU + i * RU)) * switch_on[gn, t-i] for |
| i in 0:min(UT - 2, TRU, t - 1) |
| ) |
| ) |
|
|
| if UT - 2 < TRU |
| |
| |
| eq_prod_limit_ramp_up_extra_period[sc.name, gn, t] = |
| @constraint( |
| model, |
| prod_above[sc.name, gn, t] + |
| g.min_power[t] * is_on[gn, t] + |
| reserve[t] <= |
| Pbar * is_on[gn, t] - sum( |
| (Pbar - (SU + i * RU)) * switch_on[gn, t-i] for |
| i in 0:min(UT - 1, TRU, t - 1) |
| ) |
| ) |
| end |
|
|
| |
| KSD = min(TRD, UT - 1, T - t - 1) |
| if KSD > 0 |
| KSU = min(TRU, UT - 2 - KSD, t - 1) |
| |
| eq_prod_limit_shutdown_trajectory[sc.name, gn, t] = @constraint( |
| model, |
| prod_above[sc.name, gn, t] + |
| g.min_power[t] * is_on[gn, t] + |
| (RESERVES_WHEN_SHUT_DOWN ? reserve[t] : 0.0) <= |
| Pbar * is_on[gn, t] - sum( |
| (Pbar - (SD + i * RD)) * switch_off[gn, t+1+i] for |
| i in 0:KSD |
| ) - sum( |
| (Pbar - (SU + i * RU)) * switch_on[gn, t-i] for |
| i in 0:KSU |
| ) - ( |
| (KSU >= TRU || KSU > t - 2) ? 0.0 : |
| max(0, (SU + (KSU + 1) * RU) - (SD + TRD * RD)) * |
| switch_on[gn, t-(KSU+1)] |
| ) |
| ) |
| end |
| end |
| end |
| end |
|
|