Skip to content

Commit

Permalink
Fix Parser for HVDC lines with PWL Costs (#317)
Browse files Browse the repository at this point in the history
* do not add HVDC line costs when no HVDC lines exist
* fix non-increasing domain on default hvdc pwl costs, and added test case
* closes #316
  • Loading branch information
ccoffrin authored Jun 26, 2018
1 parent f3c2291 commit 8b82b73
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PowerModels.jl Change Log
- Added support for network data with multiple phases
- Removed explicit series variables from branch flow model
- Improved helper functions ref, var, con to work with multiple networks and phases
- Minor issues closed #316

### v0.7.2
- Removed Memento depreciation warnings
Expand Down
3 changes: 2 additions & 1 deletion src/core/objective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ function objective_min_pwl_fuel_cost(pm::GenericPowerModel)
# pwl cost
dcline_lines = get_lines(nw_ref[:dcline])
for (i, dcline) in nw_ref[:dcline]
arc = (i, dcline["f_bus"], dcline["t_bus"])
for line in dcline_lines[i]
@constraint(pm.model, dc_p_cost[i] >= line["slope"]*sum(var(pm, n, h, :p_dc)[i] for h in phase_ids(pm, n)) + line["intercept"])
@constraint(pm.model, dc_p_cost[i] >= line["slope"]*sum(var(pm, n, h, :p_dc)[arc] for h in phase_ids(pm, n)) + 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 @@ -556,7 +556,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 @@ -567,7 +567,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
4 changes: 4 additions & 0 deletions test/data/matpower/case5_pwlc.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@
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 8b82b73

Please sign in to comment.