| |
| |
| |
|
|
| function _add_status_vars!( |
| model::JuMP.Model, |
| g::ThermalUnit, |
| formulation_status_vars::Gar1962.StatusVars, |
| )::Nothing |
| is_on = _init(model, :is_on) |
| switch_on = _init(model, :switch_on) |
| switch_off = _init(model, :switch_off) |
| for t in 1:model[:instance].time |
| if g.must_run[t] |
| is_on[g.name, t] = 1.0 |
| switch_on[g.name, t] = (t == 1 ? 1.0 - _is_initially_on(g) : 0.0) |
| switch_off[g.name, t] = 0.0 |
| else |
| is_on[g.name, t] = @variable(model, binary = true, base_name = "is_on_$(g.name)_$(t)") |
| switch_on[g.name, t] = @variable(model, binary = true, base_name = "switch_on_$(g.name)_$(t)") |
| switch_off[g.name, t] = @variable(model, binary = true, base_name = "switch_off_$(g.name)_$(t)") |
| end |
| add_to_expression!(model[:obj], is_on[g.name, t], g.min_power_cost[t]) |
| end |
| return |
| end |
|
|
| function _add_status_eqs!( |
| model::JuMP.Model, |
| g::ThermalUnit, |
| formulation_status_vars::Gar1962.StatusVars, |
| )::Nothing |
| eq_binary_link = _init(model, :eq_binary_link) |
| eq_switch_on_off = _init(model, :eq_switch_on_off) |
| is_on = model[:is_on] |
| switch_off = model[:switch_off] |
| switch_on = model[:switch_on] |
| for t in 1:model[:instance].time |
| if !g.must_run[t] |
| |
| if t == 1 |
| eq_binary_link[g.name, t] = @constraint( |
| model, |
| is_on[g.name, t] - _is_initially_on(g) == |
| switch_on[g.name, t] - switch_off[g.name, t] |
| ) |
| else |
| eq_binary_link[g.name, t] = @constraint( |
| model, |
| is_on[g.name, t] - is_on[g.name, t-1] == |
| switch_on[g.name, t] - switch_off[g.name, t] |
| ) |
| end |
| |
| eq_switch_on_off[g.name, t] = @constraint( |
| model, |
| switch_on[g.name, t] + switch_off[g.name, t] <= 1 |
| ) |
| end |
| end |
| return |
| end |
|
|