Coding second order cone constraint in GAMS

Problems with modeling
Post Reply
bbiswas
User
User
Posts: 16
Joined: 5 years ago

Coding second order cone constraint in GAMS

Post by bbiswas »

Hi,
I'm working on second order cone programming for power distribution system problems. Suppose my system includes 5 buses and 4 lines. So,
set bi /bus1*bus5/
set li /line1*line4/
alias(bi,bj)

Now the vector V(bi) stands for voltage magnitude squared of a node, P(bi,bj) and Q(bi,bj) stand for the active and reactive power flow from bus bi to bj. My second order cone equation is

V(bi) + V(bj) >= || 2P(bi,bj), 2Q(bi,bj), (V(bi)-V(bj)) ||

I wrote this equation in GAMS as,

conic(bi).. V(bi)+V(bj) =C= sum(bj, (2*P(bi,bj) + 2*Q(bi,bj)))

I'm getting error for uncontrolled set. I will appreciate highly if anyone help to write the equation properly for GAMS mosek solver. Thanks.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Coding second order cone constraint in GAMS

Post by Renger »

Hi
You define the equation over bi, but the equation itself is over bi and bj on the left hand side:

Code: Select all

conic(bi).. V(bi)+V(bj) =C= sum(bj, (2*P(bi,bj) + 2*Q(bi,bj)))
In this equation, Gams has to use one V(bj) but is not clear which bj to choose. Then on the RHS you use at the same time the sum over all bj.

This would work

Code: Select all

alias(bj, bjj);
conic(bi,bj).. V(bi)+V(bj) =C= sum(bjj, (2*P(bi,bjj) + 2*Q(bi,bjj)))
* or 
conic(bi).. V(bi) =C= sum(bjj, (2*P(bi,bjj) + 2*Q(bi,bjj)))
but that is probably not what you want to achieve.
Over which bj should be summed?
Cheeers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
bbiswas
User
User
Posts: 16
Joined: 5 years ago

Re: Coding second order cone constraint in GAMS

Post by bbiswas »

Thank you for your response sir. In fact I need to know how to write conic constraints in GAMS language.
Like I mention in my case, let's assume V is a vector of variables which stands for the voltage magnitude squared of nodes. P and Q are also variable matrices stands for the active and reactive power flow among the nodes. The number of nodes of my system for example is 5.
So, the dimensions,
V is (5*1)
P is (5*5)
Q is (5*5)

Now, my conic equation is

V(i) + V(j) >= sqrt ((2*P(i,j))^2 + (2*Q(i,j))^2 + (V(i) - V(j))^2)

how can I write it as a conic constraint using "=C=" in GAMS language?
Thank you.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Coding second order cone constraint in GAMS

Post by Renger »

Hi
Did you have a look at the documentation on conic programming: Conic programming?
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply