JuMP variable definition

134 views
Skip to first unread message

ar.sh...@gmail.com

unread,
Dec 6, 2016, 12:35:46 PM12/6/16
to julia-opt
hello, I decided to implement Power Flow problem in julia, but while i cannot been determined the variable because when i defined, a set of special type of busess active powers(or other variables), the previously defined active powers are eliminated.
@variable(PF, P[i=1:nGen; bus[:,2][i] == 2] == gen[:,2][i]/baseMVA)
@variable(PF, P[i=1:nBus; bus[:,2][i] == 1] == -bus[:,3][i]/baseMVA)
can you help me?

Carleton Coffrin

unread,
Dec 6, 2016, 7:56:50 PM12/6/16
to julia-opt
Hi,

I can see two options,

1) Precompute a p_delta for each bus, which is the sum of generator output and bus load.  Then post KCL for each bus of the form,

for i in buses
  @constraint(p_delta[i] == sum{ p[(i,j)] for (i,j) in  bus_edges[i] })
end


2) Break up your p values into demands and generation, then you can post,

for i in buses
  @constraint(p_gen[i] - p_load[i] == sum{ p[(i,j)] for (i,j) in  bus_edges[i] })
end


Depending on your use case, you might also consider using PowerModels.jl 

It supports both AC and DC power flow computations.

Cheers,
-Carleton

ar.sh...@gmail.com

unread,
Dec 6, 2016, 10:56:30 PM12/6/16
to julia-opt
thanks for your help

Miles Lubin

unread,
Dec 10, 2016, 9:32:15 PM12/10/16
to julia-opt
Repeated definition of a variable with the same name will generate a warning in the next release of JuMP.

ar.sh...@gmail.com

unread,
Dec 10, 2016, 11:06:29 PM12/10/16
to julia-opt
how i can defined different bounds or fixed values to elements of a vector variable?
Reply all
Reply to author
Forward
0 new messages