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.

## Coding second order cone constraint in GAMS

### Re: Coding second order cone constraint in GAMS

Hi

You define the equation over
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
but that is probably not what you want to achieve.

Over which bj should be summed?

Cheeers

Renger

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)))
```

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)))
```

Over which bj should be summed?

Cheeers

Renger

____________________________________

Enjoy modeling even more: The lazy economist

Enjoy modeling even more: The lazy economist

### Re: Coding second order cone constraint in GAMS

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.

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.

### Re: Coding second order cone constraint in GAMS

____________________________________

Enjoy modeling even more: The lazy economist

Enjoy modeling even more: The lazy economist