Beispiel #1
0
 public Sim_Boundary(XmlElement xElem, Sim_Builder Builder)
 {
     foreach (XmlAttribute xAttr in xElem.Attributes)
     {
         FieldInfo fI = typeof(Sim_Boundary).GetField(xAttr.Name);
         if (fI == null)
         {
         }
         else if (fI.FieldType == typeof(String))
         {
             fI.SetValue(this, xAttr.Value);
         }
         else if (fI.FieldType == typeof(Double))
         {
             fI.SetValue(this, XmlConvert.ToDouble(xAttr.Value));
         }
         else if (fI.FieldType == typeof(List <PointF>))
         {
             List <PointF> InList = (List <PointF>)fI.GetValue(this);
             String[]      SplStr = xAttr.Value.Split(',');
             for (int a = 0; a < SplStr.Length; a += 2)
             {
                 InList.Add(new PointF(XmlConvert.ToSingle(SplStr[a]), XmlConvert.ToSingle(SplStr[a + 1])));
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Create a new shape object
        /// </summary>
        /// <param name="InShape"></param>
        public Sim_Boundary(Shape InShape, ICoordinateTransformation XF, Sim_Builder Builder)
        {
            List <PointF> MagnifiedPoints = new List <PointF>();

            foreach (Shape.Part Part in InShape.Parts)
            {
                foreach (Vertex v in Part)
                {
                    double[] NewPoint = XF.MathTransform.Transform(new double[] { v.X, v.Y });
                    CheckFunction(NewPoint[0], ref Min_X, ref Max_X, ref Centroid_X);
                    CheckFunction(NewPoint[1], ref Min_Y, ref Max_Y, ref Centroid_Y);
                    CheckFunction(NewPoint[0], ref Builder.Min_X, ref Builder.Max_X, ref Builder.Centroid_X);
                    CheckFunction(NewPoint[1], ref Builder.Min_Y, ref Builder.Max_Y, ref Builder.Centroid_Y);
                    Coordinates.Add(new PointF((float)NewPoint[0], (float)NewPoint[1]));
                    MagnifiedPoints.Add(new PointF((float)NewPoint[0] * 1000f, (float)NewPoint[1] * 1000f));
                }
            }

            Centroid_X /= (double)Coordinates.Count;
            Centroid_Y /= (double)Coordinates.Count;
            Builder.CoordinateCount += Coordinates.Count;
            this.CountyBoundary      = new GraphicsPath();
            this.CountyBoundary.AddLines(MagnifiedPoints.ToArray());
            this.CountyBoundary.CloseAllFigures();
            this.Name = (InShape.GetAttribute(0) ?? "?").ToString();
        }
Beispiel #3
0
 /// <summary>
 /// Write out our XML for our bus, and our savecase information
 /// </summary>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     Builder.Savecase.BusData.Add(BusNumber, new MacomberMapCommunications.Messages.EMS.MM_Bus_Data()
     {
         Angle = 0, Bus_Num = BusNumber, Dead = PerUnitVoltage == 0, Island_ID = 0, NomKv = (float)Voltage.NominalVoltage, Open = PerUnitVoltage == 0, TEID_Nd = NodeTEID, TEID_St = Substation.TEID, V_Pu = (float)PerUnitVoltage
     });
     return($"\r\n<Node Name=\"{Name}\" TEID=\"{NodeTEID}\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"Node\" KVLevel=\"{Voltage}\" Substation=\"{Substation.TEID}\" />\r\n<BusbarSection PUNElement=\"False\" Name=\"{Name}\" TEID=\"{TEID}\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"BusbarSection\" NodeTEID=\"{NodeTEID}\" KVLevel=\"{Voltage}\" Substation=\"{Substation.TEID}\" />");
 }
Beispiel #4
0
 /// <summary>
 /// Write out our transmission line XML, and our savecase components
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     Builder.Savecase.LineData.Add(new MacomberMapCommunications.Messages.EMS.MM_Line_Data()
     {
         End1_Bus = NearBus.BusNumber, End2_Bus = FarBus.BusNumber, LIMIT1 = (float)NormalLimit, LIMIT2 = (float)EmergencyLimit, LIMIT3 = (float)LoadshedLimit, MVA_End1 = (float)MVA_Est, MVA_End2 = -(float)MVA_Est, RMeas_End1 = (float)MVAR_Est, RMeas_End2 = (float)-MVAR_Est, R_End1 = (float)MVAR_Est, R_End2 = (float)-MVAR_Est, TEID_End1 = NearBus.NodeTEID, TEID_Ln = TEID, WMeas_End1 = (float)MW_Est, WMeas_End2 = (float)MW_Est, W_End1 = (float)MW_Est, W_End2 = (float)MW_Est
     });
     return($"<{ElemType} IsZBR=\"false\" PUNElement=\"false\" Name=\"{Name}\" TEID=\"{TEID}\" Substation1=\"{From.TEID}\" Substation2=\"{To.TEID}\" Sub1Name=\"{From.Name}\" Sub2Name=\"{To.Name}\" NormalLimit=\"{NormalLimit}\" EmergencyLimit=\"{EmergencyLimit}\" LoadshedLimit=\"{LoadshedLimit}\" ConnectedStations=\"{From.TEID},{To.TEID}\" Coordinates=\"{From.Longitude},{From.Latitude},{To.Longitude},{To.Latitude}\" IsSeriesCompensator=\"False\" IsMultipleSegment=\"False\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"Line\" KVLevel=\"{NearBus.Voltage}\" />");
 }
Beispiel #5
0
 /// <summary>
 /// Write out the XML for our load, and add our load state to our savecase
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     Builder.Savecase.LoadData.Add(new MacomberMapCommunications.Messages.EMS.MM_Load_Data()
     {
         Conn_Bus = Bus.BusNumber, Manual_Ld = false, Open_Ld = MW_Est == 0, W_Ld = (float)MW_Est, Remove_Ld = false, RMeas_Ld = (float)MVAR_Est, R_Ld = (float)MVAR_Est, WMeas_Ld = (float)MW_Est, TEID_Ld = TEID, RMVEnabl_Ld = true
     });
     return($"<{ElemType} TEID=\"{TEID}\" Name=\"{Name}\" Substation=\"{Substation.TEID}\"  Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"Load\" KVLevel=\"{Bus.Voltage}\" Estimated_MW=\"{MW_Est}\" Estimated_MVAR=\"{MVAR_Est}\" Estimated_MVA=\"{MVA_Est}\" Telemetered_MW=\"{MW_Est}\" Telemetered_MVAR=\"{MVAR_Est}\" Telemetered_MVA=\"{MVA_Est}\"/>");
 }
Beispiel #6
0
 /// <summary>
 /// Retrieve the XML for our breaker, and write out a breaker status in our savecase
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     Builder.Savecase.BreakerSwitchData.Add(new MacomberMapCommunications.Messages.EMS.MM_BreakerSwitch_Data()
     {
         TEID_CB = TEID, Open_CB = Open, Near_BS = NearBus.BusNumber, Far_BS = FarBus.BusNumber
     });
     return($"<Breaker Name=\"{Name}\" TEID=\"{TEID}\" PUNElement=\"False\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"Breaker\" KVLevel=\"{NearBus.Voltage}\" Substation=\"{Substation.TEID}\" HasSynchrocheckRelay=\"false\" HasSynchroscope=\"false\" NormalOpen=\"false\"/>");
 }
 /// <summary>
 /// Build our outgoing XML for our transformer, and write out our savecase data
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     Builder.Savecase.TransformerData.Add(new MacomberMapCommunications.Messages.EMS.MM_Transformer_Data()
     {
         AVR_XF = true, End1_Bus = Winding1.Bus.BusNumber, End2_Bus = Winding2.Bus.BusNumber, LIMIT1 = (float)MVA_Est * 1.2f, LIMIT2 = (float)MVAR_Est * 1.3f, LIMIT3 = (float)MVAR_Est * 1.4f, MVA_End1 = (float)MVA_Est, MVA_End2 = (float)-MVA_Est, Open_End1 = MW_Est == 0, Open_End2 = MW_Est == 0, R_End1 = (float)MVAR_Est, RMeas_End2 = (float)MVAR_Est, RMeas_End1 = (float)MVAR_Est, R_End2 = (float)-MVAR_Est, Tap = 5, TapMax = 8, TapMin = 2, ZTap = 4, ZTapMax = 7, ZTapMin = 3, WMeas_End1 = (float)MW_Est, WMeas_End2 = (float)-MW_Est, TEID_Xf = TEID, TEID_End1 = Winding1.TEID, TEID_REGND = Winding1.Bus.BusNumber, W_End1 = (float)MW_Est, W_End2 = (float)-MW_Est
     });
     return($"<{ElemType} TEID=\"{TEID}\" Name=\"{Name}\" Substation=\"{Substation.TEID}\"  Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"{ElemType}\" Winding1=\"{Winding1.TEID}\" Winding2=\"{Winding2.TEID}\" KVLevel1=\"{Winding1.Bus.Voltage}\" KVLevel2=\"{Winding2.Bus.Voltage}\" Windings=\"{Winding1.TEID},{Winding2.TEID}\" PhaseShifter=\"{IsPhaseShifter}\">\r\n\t\t" + Winding1.GetXml(Builder) + "\r\n\t\t" + Winding2.GetXml(Builder) + "\r\n\t</Transformer>");
 }
Beispiel #8
0
 /// <summary>
 /// Get the XML for our unit, and add in our unit information
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     //HSL =\"{Capacity}\"  Estimated_MW =\"{MW_Est}\" Estimated_MVAR=\"{MVAR_Est}\" Estimated_MVA=\"{MVA_Est}\" Telemetered_MW=\"{MW_Est}\" Telemetered_MVAR=\"{MVAR_Est}\" Telemetered_MVA=\"{MVA_Est}\"
     Builder.Savecase.UnitData.Add(new MacomberMapCommunications.Messages.EMS.MM_Unit_Data()
     {
         Open_Un = MW_Est == 0, TEID_Un = TEID, W_Un = (float)MW_Est, R_Un = (float)MVAR_Est, WMeas_Un = (float)MW_Est, RMeas_Un = (float)MVAR_Est, Conn_Bus = Bus.BusNumber, Reg_Bus = Bus.BusNumber, NoAVR_Un = true, NoPSS_Un = true
     });
     Builder.Savecase.UnitGenData.Add(new MacomberMapCommunications.Messages.EMS.MM_Unit_Gen_Data()
     {
         CAPMX_UNIT = (float)Capacity, GEN_UNIT = (float)MW_Est, HSL_UNIT = (float)Capacity, HDL_UNIT = (float)Capacity * .98f, HASL_UNIT = (float)Capacity * .99f, HEL_UNIT = (float)Capacity * 1.02f, Key = Substation.Name + "." + Name, FUEL_UNIT = "Gas", LEL_UNIT = 2, LDL_UNIT = 3, LSL_UNIT = 4, LASL_UNIT = 3, LMP_UNIT = (float)LMP, SPPSETP_UNIT = (float)LMP, TEID_UNIT = TEID, SCEDBP_UNIT = (float)MW_Est
     });
     Builder.Savecase.UnitSimulationData.Add(new MacomberMapCommunications.Messages.EMS.MM_Unit_Simulation_Data()
     {
         AGC_Plc = true, Fhz_Un = 60, FrqCtrl_Un = false, FrqTarg_SIsl = 60, Isl_Num = 0, TEID_Un = TEID
     });
     return($"<Unit TEID=\"{TEID}\" UnitTEID=\"{UnitTEID}\" Name=\"{Name}\" Substation=\"{Substation.TEID}\" UnitType=\"Thermal\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"Unit\" KVLevel=\"Other KV\" PrimaryFuelType=\"Gas\" MaxCapacity=\"{Capacity}\" MVARCapabilityCurve=\"20,-28.4,52.8,50,-19.9,41.9,60,-12.5,35,65,-8.5,30.9,72,0,0\" PANType=\"None\" />");
 }
Beispiel #9
0
        /// <summary>
        /// Locate a bus
        /// </summary>
        /// <param name="Builder"></param>
        /// <param name="RequiredVoltages"></param>
        /// <returns></returns>
        public Sim_Bus FindBus(Sim_Builder Builder, params Sim_VoltageLevel[] RequiredVoltages)
        {
            List <Sim_Bus> BusCandidates = new List <Sim_Bus>();

            foreach (Sim_Bus Bus in this.Elements.OfType <Sim_Bus>())
            {
                if (RequiredVoltages.Length == 0 || Array.IndexOf(RequiredVoltages, Bus.Voltage) != -1)
                {
                    BusCandidates.Add(Bus);
                }
            }

            //If we don't have a bus of the proper voltage, create it.
            if (RequiredVoltages.Length > 0 && BusCandidates.Count == 0)
            {
                Sim_Bus NewBus = new Sim_Bus(this, Builder.Buses.Count, "Bus" + Builder.Buses.Count.ToString(), Builder.Randomizer.GenerateNumber(1, Builder.Config.BusVoltageStdDev / 100.0), Builder);
                Builder.Buses.Add(NewBus);
                BusCandidates.Add(NewBus);
            }
            return(BusCandidates[Builder.Randomizer.Next(0, BusCandidates.Count)]);
        }
 /// <summary>
 /// Generate the XML and savecase information for our shunt compensator
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     return($"<{ElemType} TEID=\"{TEID}\" Name=\"{Name}\" Substation=\"{Substation.TEID}\"  Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"{ElemType}\" KVLevel=\"{Bus.Voltage}\" Open=\"{Open}\" Nominal_MVAR=\"{Nominal_MVAR}\" Estimated_MVAR=\"{Estimated_MVAR}\"/>");
 }
 public Sim_ShuntCompensator(String Name, Sim_Substation Sub, Sim_Bus Bus, bool Open, double MVAR_Est, double MVAR_Nominal, bool IsCapacitor, Sim_Builder Builder)
 {
     this.Name         = Name;
     this.Substation   = Sub;
     this.Bus          = Bus;
     this.Owner        = Builder.GetOwner();
     this.Operator     = Builder.GetOperator();
     this.TEID         = Builder.NextTEID();
     this.Open         = Open;
     this.Nominal_MVAR = MVAR_Nominal;
     Sub.Elements.Add(this);
     this.Estimated_MVAR = MVAR_Est;
     this.IsCapacitor    = IsCapacitor;
     this.ElemGuid       = Guid.NewGuid();
 }
Beispiel #12
0
 public Sim_Company(String Name, String Alias, String TelephoneNumber, String DUNS, Sim_Builder Builder)
 {
     this.Name            = Name;
     this.Alias           = Alias;
     this.TelephoneNumber = TelephoneNumber;
     this.DUNS            = DUNS;
     this.TEID            = Builder.NextTEID();
 }
Beispiel #13
0
        /// <summary>
        /// Find a nearby substation
        /// </summary>
        /// <returns></returns>
        public Sim_Substation FindNearbySubstation(List <Sim_Substation> Substations, double Distance, List <Sim_Line> Lines, Sim_Builder Builder)
        {
            Dictionary <Sim_Substation, Sim_Line> AlreadySubs = ConnectedSubstations(Lines);

            List <SubstationDistance> Distances = new List <SubstationDistance>();

            foreach (Sim_Substation Sub in Substations)
            {
                if (Sub != this && !AlreadySubs.ContainsKey(Sub))
                {
                    double Dist = Sub.DistanceTo(this);
                    if (Dist <= Distance)
                    {
                        Distances.Add(new SubstationDistance(Sub, Dist));
                    }
                }
            }
            Distances.Sort();
            if (Distances.Count == 0)
            {
                return(null);
            }
            else
            {
                return(Distances[Builder.Randomizer.Next(Distances.Count)].Sub);
            }
        }
Beispiel #14
0
 /// <summary>
 /// Generate the XML for our substation
 /// </summary>
 /// <param name="Builder"></param>
 /// <returns></returns>
 public String GetXml(Sim_Builder Builder)
 {
     return($"<{ElemType} Name=\"{Name}\" TEID=\"{TEID}\" County=\"{Parent.Name}\" HasSynchroscope=\"False\" HasSynchrocheck=\"False\" LongName=\"{Name}\" Longitude=\"{Longitude}\" Latitude=\"{Latitude}\" LatLong=\"{Latitude},{Longitude}\" ElemType=\"Substation\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" {KVLevels} {UnitString} {BusString} {ElemTypes} {LoadString} {ShuntCompensatorString} {TransformerString}/>");
 }
Beispiel #15
0
 /// <summary>
 /// Initialize our bus
 /// </summary>
 /// <param name="Sub"></param>
 /// <param name="BusNumber"></param>
 /// <param name="Name"></param>
 /// <param name="PerUnitVoltage"></param>
 /// <param name="Builder"></param>
 public Sim_Bus(Sim_Substation Sub, int BusNumber, String Name, double PerUnitVoltage, Sim_Builder Builder)
 {
     this.ElemGuid       = Guid.NewGuid();
     this.Name           = Name;
     this.Substation     = Sub;
     this.Voltage        = Builder.GetVoltage();
     this.PerUnitVoltage = PerUnitVoltage;
     this.Substation.Elements.Add(this);
     this.BusNumber = BusNumber;
     this.Owner     = Builder.GetOwner();
     this.ElemGuid  = Guid.NewGuid();
     this.NodeGuid  = Guid.NewGuid();
     this.Operator  = Builder.GetOperator();
     this.TEID      = Builder.NextTEID();
     this.NodeTEID  = Builder.NextTEID();
 }
Beispiel #16
0
 public String GetXml(Sim_Builder Builder)
 {
     return($"<{ElemType} TEID=\"{TEID}\" Name=\"{Name}\" Substation=\"{Substation.TEID}\"  Transformer=\"{Transformer.TEID}\" WindingType=\"{WindingType}\" WindingNodeTEID=\"{WindingNodeTEID}\" Owner=\"{Owner.TEID}\" Operator=\"{Operator.TEID}\" ElemType=\"{ElemType}\"  KVLevel=\"{Bus.Voltage}\"/>");
 }
Beispiel #17
0
 public Sim_TransformerWinding(string Name, Sim_Transformer Transformer, Sim_Bus Bus, Sim_Company Owner, Sim_Company Operator, bool IsPrimary, Sim_Builder Builder)
 {
     this.Name            = Name;
     this.TEID            = Builder.NextTEID();
     this.Owner           = Owner;
     this.Operator        = Operator;
     this.Bus             = Bus;
     this.IsPrimary       = IsPrimary;
     this.Transformer     = Transformer;
     this.Substation      = Transformer.Substation;
     this.WindingNodeTEID = Builder.NextTEID();
 }
Beispiel #18
0
 public Sim_Load(String Name, Sim_Substation Parent, Sim_Bus Bus, double MW_Est, double MVAR_Est, Sim_Builder Builder)
 {
     this.Substation = Parent;
     this.ElemGuid   = Guid.NewGuid();
     this.Substation.Elements.Add(this);
     this.Name     = Name;
     this.MW_Est   = MW_Est;
     this.MVAR_Est = MVAR_Est;
     this.Owner    = Builder.GetOwner();
     this.Operator = Builder.GetOperator();
     this.TEID     = Builder.NextTEID();
     this.Bus      = Bus;
 }
Beispiel #19
0
 /// <summary>
 /// Initialize a new transformer
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="Sub"></param>
 /// <param name="MW_Est"></param>
 /// <param name="MVAR_Est"></param>
 /// <param name="Bus1"></param>
 /// <param name="Bus2"></param>
 /// <param name="Builder"></param>
 public Sim_Transformer(String Name, Sim_Substation Sub, double MW_Est, double MVAR_Est, Sim_Bus Bus1, Sim_Bus Bus2, Sim_Builder Builder)
 {
     this.Name       = Name;
     this.Substation = Sub;
     this.ElemGuid   = Guid.NewGuid();
     this.Substation.Elements.Add(this);
     this.Owner    = Builder.GetOwner();
     this.Operator = Builder.GetOperator();
     this.MW_Est   = MW_Est;
     this.MVAR_Est = MVAR_Est;
     this.TEID     = Builder.NextTEID();
     this.Winding1 = new Sim_TransformerWinding(Name + "_1", this, Bus1, Owner, Operator, true, Builder);
     this.Winding2 = new Sim_TransformerWinding(Name + "_2", this, Bus2, Owner, Operator, false, Builder);
 }
Beispiel #20
0
 public Sim_Breaker(String Name, Sim_Substation Sub, Sim_Bus NearBus, Sim_Bus FarBus, Sim_Builder Builder, bool Open, bool IsBreaker)
 {
     this.Name       = Name;
     this.ElemGuid   = Guid.NewGuid();
     this.IsBreaker  = IsBreaker;
     this.Substation = Sub;
     this.NearBus    = NearBus;
     this.FarBus     = FarBus;
     this.Owner      = Builder.GetOwner();
     this.Operator   = Builder.GetOperator();
     this.TEID       = Builder.NextTEID();
     this.Open       = Open;
     this.Substation.Elements.Add(this);
 }
Beispiel #21
0
 public Sim_Substation(String Name, double Longitude, double Latitude, Sim_Boundary Parent, Sim_Builder Builder)
 {
     this.Name      = Name;
     this.Longitude = Longitude;
     this.Latitude  = Latitude;
     this.Parent    = Parent;
     this.Owner     = Builder.GetOwner();
     this.ElemGuid  = Guid.NewGuid();
     this.Operator  = Builder.GetOperator();
     this.TEID      = Builder.NextTEID();
 }
Beispiel #22
0
 public Sim_Unit(String Name, Sim_Bus Bus, Sim_Substation Parent, Sim_UnitType UnitType, double MW_Est, double MVAR_Est, double PercentageCapacity, Sim_Builder Builder)
 {
     this.Substation = Parent;
     this.Substation.Elements.Add(this);
     this.ElemGuid = Guid.NewGuid();
     this.Name     = Name;
     this.UnitType = UnitType;
     this.MW_Est   = MW_Est;
     this.MVAR_Est = MVAR_Est;
     this.LMP      = Builder.NextRandom(2, 50);
     this.MVA_Est  = Math.Round(Math.Sqrt(MW_Est * MW_Est + MVAR_Est * MVAR_Est));
     this.Capacity = this.MW_Est / PercentageCapacity;
     this.TEID     = Builder.NextTEID();
     this.UnitTEID = Builder.NextTEID();
     this.Owner    = Builder.GetOwner();
     this.Operator = Builder.GetOperator();
     this.Bus      = Bus;
 }
Beispiel #23
0
 public Sim_Line(Sim_Substation From, Sim_Substation To, List <Sim_Line> Lines, Sim_Builder Builder, double MW_Est, double MVAR_Est, double LineLoading)
 {
     this.ElemGuid       = Guid.NewGuid();
     this.From           = From;
     this.To             = To;
     this.Name           = "Line" + Lines.Count.ToString("000");
     this.MW_Est         = MW_Est;
     this.MVAR_Est       = MVAR_Est;
     this.MVA_Est        = Math.Sqrt(MW_Est * MW_Est + MVAR_Est * MVAR_Est);
     this.NormalLimit    = this.MVA_Est / LineLoading;
     this.EmergencyLimit = this.NormalLimit + Builder.Randomizer.Next(10);
     this.LoadshedLimit  = this.EmergencyLimit + Builder.Randomizer.Next(10);
     this.Owner          = Builder.GetOwner();
     this.Operator       = Builder.GetOperator();
     this.TEID           = Builder.NextTEID();
     this.From.Elements.Add(this);
     this.To.Elements.Add(this);
     this.NearBus = From.FindBus(Builder);
     this.FarBus  = To.FindBus(Builder, this.NearBus.Voltage);
 }