Example #1
0
 internal TransmissionUnit(Terminal linkPoint, TransmissionUnit powerSource)
 {
     I = new Complex[] { 0, 0, 0 };
     UpstreamUnit = powerSource;
     DownstreamUnits = new HashSet<TransmissionUnit>();
     powerSource.DownstreamUnits.Add(this);
     var tryT = linkPoint.ParentEquipment as PowerTransformer.TransformerEnd;
     var tryLine = linkPoint.ParentEquipment as ACLineSegment;
     //For now assume that Ends[0] is always the upstream TransformerEnd
     if (tryT != null) 
     {
         typeOfBranch = "TransformerEnd";
         tbranch = tryT;
         upstreamTerm = tryT.ParentTransformer.Ends[1].Terminal1;
         Node = upstreamTerm.ConnectionPoint.DynamicTopoNode;
         BaseKV = UpstreamUnit.BaseKV * 
             (tryT.ParentTransformer.Ends[1].BaseKV / tryT.ParentTransformer.Ends[0].BaseKV);  
     }
     if (tryLine != null)
     {
         typeOfBranch = "Conductor";
         lineBranch = tryLine;
         BaseKV = UpstreamUnit.BaseKV;
         if (ReferenceEquals(tryLine.Terminal1, linkPoint))
         {
             Node = tryLine.Terminal2.ConnectionPoint.DynamicTopoNode;
             upstreamTerm = tryLine.Terminal2;
         }
         if (ReferenceEquals(tryLine.Terminal2, linkPoint))
         {
             Node = tryLine.Terminal1.ConnectionPoint.DynamicTopoNode;
             upstreamTerm = tryLine.Terminal1;
         }
     }
     V = new Complex[]{BaseKV,BaseKV,BaseKV};
 }
Example #2
0
 /// <summary>
 /// Generates an OpenDSS definition for a line segment
 /// </summary>
 /// <param name="newLineSeg"></param>
 /// <returns></returns>
 /// 
 private string LineToDSS(ACLineSegment newLineSeg)
 {
     StringBuilder dssLine = new StringBuilder("new Line");
     dssLine.AppendFormat(".{0}", newLineSeg.Name);
     dssLine.Append(ToDSSBusFormat(newLineSeg.Terminal1,newLineSeg.Terminal2));
     dssLine.AppendFormat(" LineCode={0}", newLineSeg.LineModel.Name);
     dssLine.AppendFormat(" Length={0} ", newLineSeg.Length.ToString());
     return dssLine.ToString();
 }