Merge 1681badf84
into 8e2769dc0e
commit
a430b07b62
@ -0,0 +1,110 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
function _add_planning_unified!(
|
||||
model::JuMP.Model,
|
||||
pu::ProfiledUnit,
|
||||
lm::TransmissionLine,
|
||||
sc::UnitCommitmentScenario,
|
||||
)::Nothing
|
||||
invest_unit = _init(model, :invest_unit)
|
||||
invest_line = _init(model, :invest_line)
|
||||
eq_invest_unit_history = _init(model, :eq_invest_unit_history)
|
||||
eq_invest_line_history = _init(model, :eq_invest_line_history)
|
||||
eq_invest_unit_capacity = _init(model, :eq_invest_unit_capacity)
|
||||
|
||||
# t == 0
|
||||
# TODO: If investment cost is zero, skip creating these investment variables
|
||||
invest_unit[sc.name, pu.name, 0] = @variable(
|
||||
model,
|
||||
binary = true,
|
||||
fixed = pu.invest == 0.0
|
||||
)
|
||||
invest_line[sc.name, lm.name, 0] = Int(lm.invest == 0.0)
|
||||
|
||||
for t in 1:model[:instance].time
|
||||
# Decision variable
|
||||
invest_unit[sc.name, pu.name, t] = @variable(model, binary = true)
|
||||
invest_line[sc.name, lm.name, t] = @variable(model, binary = true)
|
||||
|
||||
# Objective function terms
|
||||
add_to_expression!(
|
||||
model[:obj],
|
||||
invest_unit[sc.name, pu.name, t] - invest_unit[sc.name, pu.name, t-1],
|
||||
pu.invest[t] * sc.probability,
|
||||
)
|
||||
add_to_expression!(
|
||||
model[:obj],
|
||||
invest_line[sc.name, lm.name, t] - invest_line[sc.name, lm.name, t-1],
|
||||
lm.invest[t] * sc.probability,
|
||||
)
|
||||
|
||||
# Investment constraints
|
||||
# (1c) in the paper
|
||||
eq_invest_unit_history[sc.name, pu.name, t] = @constraint(
|
||||
model,
|
||||
invest_unit[sc.name, pu.name, t-1] <= invest_unit[sc.name, pu.name, t]
|
||||
)
|
||||
# (1d) in the paper
|
||||
eq_invest_line_history[sc.name, lm.name, t] = @constraint(
|
||||
model,
|
||||
invest_line[sc.name, lm.name, t-1] <= invest_line[sc.name, lm.name, t]
|
||||
)
|
||||
# (1h) in the paper TODO: separate this to two halves
|
||||
eq_invest_unit_capacity[sc.name, pu.name, t] = @constraint(
|
||||
model,
|
||||
pu.min_power[t] * invest_unit[sc.name, pu.name, t] <=
|
||||
model[:prod_above][sc.name, pu.name, t] <=
|
||||
pu.max_power[t] * invest_unit[sc.name, pu.name, t]
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
# TODO: add max_copy constraint
|
||||
function _add_planning_new_lines!(
|
||||
model::JuMP.Model,
|
||||
lm::TransmissionLine,
|
||||
bs::Bus,
|
||||
f::PhaseAngleFormulation,
|
||||
sc::UnitCommitmentScenario,
|
||||
)::Nothing
|
||||
θ = _init(model, :theta)
|
||||
flow = _init(model, :flow)
|
||||
invest_line = model[:invest_line]
|
||||
eq_invest_line_flow_a = _init(model, :eq_invest_line_flow_a)
|
||||
eq_invest_line_flow_b = _init(model, :eq_invest_line_flow_b)
|
||||
eq_invest_line_flow_limit = _init(model, :eq_invest_line_flow_limit)
|
||||
|
||||
bigM = 1e6 # TODO: make this a parameter
|
||||
|
||||
for t in 1:model[:instance].time
|
||||
# TODO: add bus field: phase_angle_limit? give default
|
||||
θ[sc.name, bs.name, t] = @variable(model, lower_bound = -pi, upper_bound = pi)
|
||||
flow[sc.name, lm.name, t] = @variable(model)
|
||||
|
||||
# (2b)
|
||||
eq_invest_line_flow_a[sc.name, lm.name, t] = @constraint(
|
||||
model,
|
||||
model[:flow][sc.name, lm.name, t] <=
|
||||
lm.susceptance * (θ[sc.name, lm.source.name, t] - θ[sc.name, lm.target.name, t])
|
||||
+ bigM * (1 - invest_line[sc.name, lm.name, t])
|
||||
)
|
||||
# (2c)
|
||||
eq_invest_line_flow_b[sc.name, lm.name, t] = @constraint(
|
||||
model,
|
||||
model[:flow][sc.name, lm.name, t] >=
|
||||
lm.susceptance * (θ[sc.name, lm.source.name, t] - θ[sc.name, lm.target.name, t])
|
||||
- bigM * (1 - invest_line[sc.name, lm.name, t])
|
||||
)
|
||||
# (2d)
|
||||
eq_invest_line_flow_limit[sc.name, lm.name, t] = @constraint(
|
||||
model,
|
||||
-lm.normal_flow_limit[t] * invest_line[sc.name, lm.name, t] <=
|
||||
model[:flow][sc.name, lm.name, t] <=
|
||||
lm.normal_flow_limit[t] * invest_line[sc.name, lm.name, t]
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
@ -0,0 +1,298 @@
|
||||
{
|
||||
"Parameters": {
|
||||
"Version": "0.4",
|
||||
"Time horizon (h)": 1,
|
||||
"Power balance penalty ($/MW)": 1000.0,
|
||||
"Scenario name": "s1",
|
||||
"Scenario weight": 1.0,
|
||||
"Operation cost weight": 1.0
|
||||
},
|
||||
"Buses": {
|
||||
"b1": {
|
||||
"Load (MW)": 80.0
|
||||
},
|
||||
"b2": {
|
||||
"Load (MW)": 240.0
|
||||
},
|
||||
"b3": {
|
||||
"Load (MW)": 40.0
|
||||
},
|
||||
"b4": {
|
||||
"Load (MW)": 160.0
|
||||
},
|
||||
"b5": {
|
||||
"Load (MW)": 240.0
|
||||
},
|
||||
"b6": {
|
||||
"Load (MW)": 0.0
|
||||
}
|
||||
},
|
||||
"Generators": {
|
||||
"gen1": {
|
||||
"Bus": "b1",
|
||||
"Type": "Profiled",
|
||||
"Maximum power (MW)": 150.0,
|
||||
"Cost ($/MW)": 0.0
|
||||
},
|
||||
"gen2": {
|
||||
"Bus": "b3",
|
||||
"Type": "Profiled",
|
||||
"Maximum power (MW)": 360.0,
|
||||
"Cost ($/MW)": 0.0
|
||||
},
|
||||
"gen3": {
|
||||
"Bus": "b6",
|
||||
"Type": "Profiled",
|
||||
"Maximum power (MW)": 600.0,
|
||||
"Cost ($/MW)": 0.0
|
||||
}
|
||||
},
|
||||
"Transmission lines": {
|
||||
"l1": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b2",
|
||||
"Susceptance (S)": 2.5,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 40.0,
|
||||
"Reactance (p.u.)": 0.4,
|
||||
"Resistance (p.u.)": 0.1,
|
||||
"Length (miles)": 40.0
|
||||
},
|
||||
"l2": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b4",
|
||||
"Susceptance (S)": 1.6666666666666667,
|
||||
"Normal flow limit (MW)": 80.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 60.0,
|
||||
"Reactance (p.u.)": 0.6,
|
||||
"Resistance (p.u.)": 0.15,
|
||||
"Length (miles)": 60.0
|
||||
},
|
||||
"l3": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"l4": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b3",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"l5": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b4",
|
||||
"Susceptance (S)": 2.5,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 40.0,
|
||||
"Reactance (p.u.)": 0.4,
|
||||
"Resistance (p.u.)": 0.1,
|
||||
"Length (miles)": 40.0
|
||||
},
|
||||
"l6": {
|
||||
"Source bus": "b3",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 0.0,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"new_l7": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b2",
|
||||
"Susceptance (S)": 2.5,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 40000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 40.0,
|
||||
"Reactance (p.u.)": 0.4,
|
||||
"Resistance (p.u.)": 0.1,
|
||||
"Length (miles)": 40.0
|
||||
},
|
||||
"new_l8": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b3",
|
||||
"Susceptance (S)": 2.6315789473684212,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 38000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 38.0,
|
||||
"Reactance (p.u.)": 0.38,
|
||||
"Resistance (p.u.)": 0.09,
|
||||
"Length (miles)": 38.0
|
||||
},
|
||||
"new_l9": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b4",
|
||||
"Susceptance (S)": 1.6666666666666667,
|
||||
"Normal flow limit (MW)": 80.0,
|
||||
"Investment cost ($)": 60000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 60.0,
|
||||
"Reactance (p.u.)": 0.6,
|
||||
"Resistance (p.u.)": 0.15,
|
||||
"Length (miles)": 60.0
|
||||
},
|
||||
"new_l10": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 20000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"new_l11": {
|
||||
"Source bus": "b1",
|
||||
"Target bus": "b6",
|
||||
"Susceptance (S)": 1.4705882352941175,
|
||||
"Normal flow limit (MW)": 70.0,
|
||||
"Investment cost ($)": 68000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 68.0,
|
||||
"Reactance (p.u.)": 0.68,
|
||||
"Resistance (p.u.)": 0.17,
|
||||
"Length (miles)": 68.0
|
||||
},
|
||||
"new_l12": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b3",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 20000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"new_l13": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b4",
|
||||
"Susceptance (S)": 2.5,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 40000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 40.0,
|
||||
"Reactance (p.u.)": 0.4,
|
||||
"Resistance (p.u.)": 0.1,
|
||||
"Length (miles)": 40.0
|
||||
},
|
||||
"new_l14": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 3.2258064516129035,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 31000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 31.0,
|
||||
"Reactance (p.u.)": 0.31,
|
||||
"Resistance (p.u.)": 0.08,
|
||||
"Length (miles)": 31.0
|
||||
},
|
||||
"new_l15": {
|
||||
"Source bus": "b2",
|
||||
"Target bus": "b6",
|
||||
"Susceptance (S)": 3.3333333333333335,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 30000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 30.0,
|
||||
"Reactance (p.u.)": 0.3,
|
||||
"Resistance (p.u.)": 0.08,
|
||||
"Length (miles)": 30.0
|
||||
},
|
||||
"new_l16": {
|
||||
"Source bus": "b3",
|
||||
"Target bus": "b4",
|
||||
"Susceptance (S)": 1.6949152542372883,
|
||||
"Normal flow limit (MW)": 82.0,
|
||||
"Investment cost ($)": 59000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 59.0,
|
||||
"Reactance (p.u.)": 0.59,
|
||||
"Resistance (p.u.)": 0.15,
|
||||
"Length (miles)": 59.0
|
||||
},
|
||||
"new_l17": {
|
||||
"Source bus": "b3",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 5.0,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 20000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 20.0,
|
||||
"Reactance (p.u.)": 0.2,
|
||||
"Resistance (p.u.)": 0.05,
|
||||
"Length (miles)": 20.0
|
||||
},
|
||||
"new_l18": {
|
||||
"Source bus": "b3",
|
||||
"Target bus": "b6",
|
||||
"Susceptance (S)": 2.0833333333333335,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 48000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 48.0,
|
||||
"Reactance (p.u.)": 0.48,
|
||||
"Resistance (p.u.)": 0.12,
|
||||
"Length (miles)": 48.0
|
||||
},
|
||||
"new_l19": {
|
||||
"Source bus": "b4",
|
||||
"Target bus": "b5",
|
||||
"Susceptance (S)": 1.5873015873015872,
|
||||
"Normal flow limit (MW)": 75.0,
|
||||
"Investment cost ($)": 63000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 63.0,
|
||||
"Reactance (p.u.)": 0.63,
|
||||
"Resistance (p.u.)": 0.16,
|
||||
"Length (miles)": 63.0
|
||||
},
|
||||
"new_l20": {
|
||||
"Source bus": "b4",
|
||||
"Target bus": "b6",
|
||||
"Susceptance (S)": 3.3333333333333335,
|
||||
"Normal flow limit (MW)": 100.0,
|
||||
"Investment cost ($)": 30000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 30.0,
|
||||
"Reactance (p.u.)": 0.3,
|
||||
"Resistance (p.u.)": 0.08,
|
||||
"Length (miles)": 30.0
|
||||
},
|
||||
"new_l21": {
|
||||
"Source bus": "b5",
|
||||
"Target bus": "b6",
|
||||
"Susceptance (S)": 1.639344262295082,
|
||||
"Normal flow limit (MW)": 78.0,
|
||||
"Investment cost ($)": 61000000.0,
|
||||
"Max number of parallel circuits": 4,
|
||||
"Guide Number": 61.0,
|
||||
"Reactance (p.u.)": 0.61,
|
||||
"Resistance (p.u.)": 0.15,
|
||||
"Length (miles)": 61.0
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue