From 44849c7d313f28942d84b1084ad94176067e419d Mon Sep 17 00:00:00 2001 From: Hassan Date: Wed, 14 Mar 2018 10:13:48 -0600 Subject: [PATCH] setting the orientation of all edges (i,j) s.t. i> 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; @@ -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; @@ -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;