Skip to content

Commit

Permalink
setting the orientation of all edges (i,j) s.t. i<j
Browse files Browse the repository at this point in the history
  • Loading branch information
hhijazi committed Mar 14, 2018
1 parent 51f6dfd commit 44849c7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions examples/MINLP/Power/PowerNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ int PowerNet::readgrid(const char* fname) {
file >> dest;
key = dest+","+src;//Taking care of reversed direction arcs
reversed = false;
if(arcID.find(key)!=arcID.end()) {//Reverse arc direction
if(get_node(src)->_id > get_node(dest)->_id) {//Reverse arc direction
// if(arcID.find(key)!=arcID.end()) {//Reverse arc direction
DebugOn("Adding arc linking " +src+" and "+dest);
DebugOn(" with reversed direction, reversing source and destination.\n");
reversed = true;
Expand Down Expand Up @@ -424,8 +425,7 @@ int PowerNet::readgrid(const char* fname) {
file >> ws >> word;


arc->cc = arc->tr*cos(arc->as); // Rectangular values for transformer phase shifters
arc->dd = arc->tr*sin(arc->as);

arc->status = atoi(word.c_str());
file >> ws >> word;

Expand All @@ -437,17 +437,21 @@ int PowerNet::readgrid(const char* fname) {
arc->tbound.max = atof(word.c_str())*pi/180.;
if (arc->tbound.min==0 && arc->tbound.max==0) {
DebugOn("Angle bounds are equal to zero. Setting them to -+60");
arc->tbound.min = -60*pi/180;
arc->tbound.max = 60*pi/180;
arc->tbound.min = -60*pi/180.;
arc->tbound.max = 60*pi/180.;

}
if (reversed) {
arc->tr /= 1;
arc->as *= -1;
arc->g /= pow(arc->tr,2);
arc->b /= pow(arc->tr,2);
arc->tr = 1./arc->tr;
arc->as *= -1.;
auto temp = arc->tbound.max;
arc->tbound.max = -1*arc->tbound.min;
arc->tbound.min = -1*temp;
arc->tbound.max = -1.*arc->tbound.min;
arc->tbound.min = -1.*temp;
}
arc->cc = arc->tr*cos(arc->as); // Rectangular values for transformer phase shifters
arc->dd = arc->tr*sin(arc->as);
// arc->tbound.max = 30*pi/180;
m_theta_ub += arc->tbound.max;

Expand Down

0 comments on commit 44849c7

Please sign in to comment.