Skip to content

Commit

Permalink
fixing dcline for v0.7 (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonpbarrows authored and ccoffrin committed Aug 30, 2018
1 parent 4550559 commit 5b0e4c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/objective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ function objective_min_pwl_fuel_cost(pm::GenericPowerModel)
# pwl cost
dcline_lines = get_lines(ref[:dcline])
for (i, dcline) in ref[:dcline]
arc = (i, dcline["f_bus"], dcline["t_bus"])
for line in dcline_lines[i]
@constraint(pm.model, dc_p_cost[n][i] >= line["slope"]*dc_p[n][i] + line["intercept"])
@constraint(pm.model, dc_p_cost[n][i] >= line["slope"]*dc_p[n][arc] + line["intercept"])
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/io/matpower.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ end

"adds dcline costs, if gen costs exist"
function add_dcline_costs(data::Dict{String,Any})
if length(data["gencost"]) > 0 && length(data["dclinecost"]) <= 0
if length(data["gencost"]) > 0 && length(data["dclinecost"]) <= 0 && length(data["dcline"]) > 0
warn(LOGGER, "added zero cost function data for dclines")
model = data["gencost"][1]["model"]
if model == 1
Expand All @@ -557,7 +557,7 @@ function add_dcline_costs(data::Dict{String,Any})
"startup" => 0.0,
"shutdown" => 0.0,
"ncost" => 2,
"cost" => [0.0, 0.0, 0.0, 0.0]
"cost" => [dcline["pminf"], 0.0, dcline["pmaxf"], 0.0]
)
push!(data["dclinecost"], dclinecost)
end
Expand Down
3 changes: 3 additions & 0 deletions test/data/matpower/case5_pwlc.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@
4 10 0.00297 0.0297 0.00674 240.0 240.0 240.0 0.0 0.0 1 -30.0 30.0;
];

mpc.dcline = [
1 10 1 10 10 25.91 -4.16 1.1 0.92617 10 900 -900 900 -900 900 0 0 0 0 0 0 0 0
]

0 comments on commit 5b0e4c9

Please sign in to comment.