Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Parser for HVDC lines with PWL Costs #317

Merged
merged 2 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
]