Esempio n. 1
0
        /// <summary>
        /// Initialize a new blacstart corridor element
        /// </summary>
        /// <param name="xElem"></param>
        /// <param name="Target"></param>
        public MM_Blackstart_Corridor_Element(XmlElement xElem, MM_Blackstart_Corridor_Target Target)
            : base(xElem, false)
        {
            this.Blackstart_Target = Target;
            if (xElem.HasAttribute("Substation"))
            {
                this.Substation = MM_Repository.TEIDs[Convert.ToInt32(xElem.Attributes["Substation"].Value)] as MM_Substation;
            }
            if (xElem.Name == "Breaker" || xElem.Name == "Switch")
            {
                this.AssociatedElement = Integration.Data_Integration.LocateElement(xElem, typeof(MM_Breaker_Switch), true);
            }
            else
            {
                this.AssociatedElement = Integration.Data_Integration.LocateElement(xElem, Type.GetType("MacomberMapClient.Data_Elements.Physical.MM_" + xElem.Name), true);
            }

            if (this.AssociatedElement is MM_Line)
            {
                (this.AssociatedElement as MM_Line).IsBlackstart = true;
            }
            else
            {
                this.AssociatedElement.Substation.IsBlackstart = true;
            }
            ElemType = MM_Repository.FindElementType("Blackstart_Corridor");
        }
Esempio n. 2
0
 /// <summary>
 /// Initialize a new bus bar section
 /// </summary>
 /// <param name="BusNumber"></param>
 public MM_Bus(int BusNumber)
 {
     this.BusNumber = BusNumber;
     this.TEID      = -BusNumber;
     this.Name      = BusNumber.ToString();
     this.ElemType  = MM_Repository.FindElementType("BusbarSection");
 }
Esempio n. 3
0
 /// <summary>
 /// Initialize a new contiengency
 /// </summary>
 /// <param name="ContingencyName">The name of the contingency</param>
 /// <param name="ContingencyDescription">The description of the contingency</param>
 /// <param name="ContingencyPosition">The contingency position</param>
 /// <param name="Active">Whether the contingency is active</param>
 public MM_Contingency(String ContingencyName, String ContingencyDescription, int ContingencyPosition, bool Active)
 {
     this.Name        = ContingencyName;
     this.Description = ContingencyDescription;
     this.ElemType    = MM_Repository.FindElementType("Contingency");
     this.Position    = ContingencyPosition;
 }
Esempio n. 4
0
 public MM_Flowgate(XmlElement ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType      = MM_Repository.FindElementType("Flowgate");
     MonitoredElements  = new List <int>();
     ContingentElements = new List <int>();
 }
Esempio n. 5
0
 /// <summary>
 /// Initialize a new island
 /// </summary>
 /// <param name="ID"></param>
 public MM_Island(int ID)
 {
     this.ID       = ID;
     this.Name     = "Island " + this.ID.ToString();
     this.ElemType = MM_Repository.FindElementType("Island");
     this.TEID     = Data_Integration.GetTEID();
     MM_Repository.TEIDs.Add(this.TEID, this);
 }
Esempio n. 6
0
 /// <summary>
 /// Initialize a new CIM Unit
 /// </summary>
 public MM_Unit()
 {
     this.ElemType = MM_Repository.FindElementType("Unit");
     if (this.UnitType == null)
     {
         this.UnitType = MM_Repository.FindGenerationType("UNKNOWN");
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Initialize a new CIM Unit
 /// </summary>
 /// <param name="ElementSource">The data source for this Unit</param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Unit(DbDataReader ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("Unit");
     if (this.UnitType == null)
     {
         this.UnitType = MM_Repository.FindGenerationType("UNKNOWN");
     }
     this.UnitStatus.TEID = this.TEID;
 }
Esempio n. 8
0
        /// <summary>
        /// Initialize a new DCTie around its base line.
        /// </summary>
        /// <param name="BaseLine">The line on which the tie is based</param>
        /// <param name="TieDescriptor">The descriptor of the tie</param>
        public MM_Tie(MM_Line BaseLine, String TieDescriptor)
        {
            //Retrieve our information from our base line
            IntegrateFromLine(BaseLine);

            //Assign our tie descriptor and KV Level.
            this.TieDescriptor = MM_Repository.TitleCase(TieDescriptor);
            this.ElemType      = MM_Repository.FindElementType("Tie");
            //this.KVLevel = MM_Repository.KVLevels["DC Tie"];     //mn - was at "DCTIE vs "DC TIE" check to ensure what one is right - 20130610 -mn
        }
Esempio n. 9
0
 /// <summary>
 /// Initialize a new node from an XML document
 /// </summary>
 /// <param name="ElementSource"></param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Node(XmlElement ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("Node");
     String[] splStr = (ElementSource.Attributes["ConnectedElements"]).Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
     ConnectedElements = new List <MM_Element>(splStr.Length);
     for (int a = 0; a < splStr.Length; a++)
     {
         ConnectedElements[a] = (MM_Element)MM_Serializable.RetrieveConvertedValue(typeof(MM_Element), splStr[a], this, AddIfNew);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Instantiate a new transformer element from the CIM Server
 /// </summary>
 /// <param name="ElementSource">The data row for the element</param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Transformer(DbDataReader ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("Transformer");
     foreach (MM_TransformerWinding Winding in Windings)
     {
         Winding.Transformer = this;
         Winding.Owner       = this.Owner;
         Winding.Operator    = this.Operator;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Initialize a new empty load tracker
        /// </summary>
        public MM_LoadGen_Tracking()
        {
            InitializeComponent();
            flwMain.AutoScroll = true;

            //Initilaize our types
            AddType(MM_Repository.FindElementType("Load"), typeof(MM_Load));
            AddType(MM_Repository.FindElementType("LaaR"), typeof(MM_Load));
            AddType(MM_Repository.FindElementType("Capacitor"), typeof(MM_ShuntCompensator));
            AddType(MM_Repository.FindElementType("Reactor"), typeof(MM_ShuntCompensator));
            AddType(MM_Repository.FindElementType("SVC"), typeof(MM_StaticVarCompensator));
            AddType(MM_Repository.FindElementType("Line"), typeof(MM_Line));
            AddType(MM_Repository.FindElementType("Unit"), typeof(MM_Unit));
        }
Esempio n. 12
0
        /// <summary>
        /// Initialize a new CIM Substation
        /// </summary>
        /// <param name="ElementSource">The data source for this substation</param>
        /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
        public MM_Contingency(DbDataReader ElementSource, bool AddIfNew)
            : base(ElementSource, AddIfNew)
        {
            //The name, TEID, owner and operator are taken care of by the Element overload - define the rest
            this.Description = (String)ElementSource["LongName"];
            List <MM_Boundary> Boundaries = new List <MM_Boundary>();

            foreach (String County in ((String)ElementSource["Counties"]).Split(','))
            {
                Boundaries.Add(MM_Repository.Counties[County]);
            }
            Counties = Boundaries.ToArray();

            //Make sure we have this element type
            this.ElemType = MM_Repository.FindElementType("Contingency");
        }
 /// <summary>
 /// Initialize a new user event tracking window
 /// </summary>
 /// <param name="UserName"></param>
 /// <param name="EventTime"></param>
 public MM_UserInteraction_Viewer(String UserName, DateTime EventTime)
 {
     InitializeComponent();
     this.Text = "Event log: " + UserName;
     lvHistory.ListViewItemSorter = new MM_UserInteraction_Sorter(0, true);
     ShowInTaskbar                            = true;
     lvHistory.FullRowSelect                  = true;
     AssociatedEvent                          = new MM_AlarmViolation();
     AssociatedEvent.EventTime                = EventTime;
     AssociatedEvent.New                      = true;
     AssociatedEvent.Type                     = MM_Repository.ViolationTypes["UserAction"];
     AssociatedEvent.ViolatedElement          = new MM_Element();
     AssociatedEvent.ViolatedElement.ElemType = MM_Repository.FindElementType("User");
     AssociatedEvent.ViolatedElement.Name     = UserName;
     AssociatedEvent.ViolatedElement.TEID     = Data_Integration.GetTEID();
 }
Esempio n. 14
0
        /// <summary>
        /// Initialize a new remedial action scheme against an XML element
        /// </summary>
        /// <param name="xElem"></param>
        /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
        public MM_RemedialActionScheme(XmlElement xElem, bool AddIfNew)
            : base(xElem, AddIfNew)
        {
            this.ElemType = MM_Repository.FindElementType("RemedialActionScheme");
            List <MM_Element> Elements = new List <MM_Element>();

            foreach (XmlElement xChild in xElem.ChildNodes)
            {
                if (xChild.Name == "Breaker" || xChild.Name == "Switch")
                {
                    Elements.Add(Data_Integration.LocateElement(xChild, typeof(MM_Breaker_Switch), true));
                }
                else
                {
                    Elements.Add(Data_Integration.LocateElement(xChild, Type.GetType("Macomber_Map.Data_Elements.MM_" + xChild.Name), true));
                }
            }
            RASElements = Elements.ToArray();
        }
Esempio n. 15
0
 /// <summary>
 /// Initialize a new CIM Line
 /// </summary>
 /// <param name="ElementSource">The data source for this substation</param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Line(DbDataReader ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     //TEID, Name, Owner, Operator, and KVLevel are taken care of by the MM_Element constructor. Here, load in the substations and coordinates if any.
     if (this is MM_Tie)
     {
         this.ConnectedStations = (this as MM_Tie).AssociatedLine.ConnectedStations;
         this.Coordinates       = (this as MM_Tie).AssociatedLine.Coordinates;//(this as MM_Tie).AssociatedLine.Coordinates; -//MN// 20130607
     }
     else
     {
         this.ConnectedStations = new MM_Substation[] { (MM_Substation)MM_Repository.TEIDs[Convert.ToInt32(ElementSource["SUBSTATION1"])], (MM_Substation)MM_Repository.TEIDs[Convert.ToInt32(ElementSource["SUBSTATION2"])] };
         this.Coordinates       = new List <PointF> {
             ConnectedStations[0].LngLat, ConnectedStations[1].LngLat
         };
     }
     //Make sure we have this element type
     this.ElemType = MM_Repository.FindElementType("Line");
 }
Esempio n. 16
0
        /// <summary>
        /// Initialize a new CIM Line
        /// </summary>
        /// <param name="ElementSource">The XML source for this line</param>
        /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
        public MM_Line(XmlElement ElementSource, bool AddIfNew)
            : base(ElementSource, AddIfNew)
        {
            this.ElemType = MM_Repository.FindElementType("Line");

            if (ElementSource.HasAttribute("Contingencies"))
            {
                String[] splStr = ElementSource.Attributes["Contingencies"].Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string str in splStr)
                {
                    MM_Contingency con = null;
                    MM_Repository.Contingencies.TryGetValue(str, out con);
                    if (con != null && !Contingencies.Any(c => con.Name == c.Name))
                    {
                        this.Contingencies.Add(con);
                    }
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Create a boundary using a data reader
        /// </summary>
        ///<param name="sRd">SQL Data reader</param>
        ///<param name="AddIfNew"></param>
        public MM_Boundary(DbDataReader sRd, bool AddIfNew)
            : base(sRd, AddIfNew)
        {
            byte[] inBytes = (byte[])sRd["COORDINATES"];
            Coordinates = new List <PointF>(inBytes.Length / 8);
            List <PointF> ConvertedPoints = new List <PointF>(Coordinates.Count);

            for (int a = 0; a < inBytes.Length; a += 8)
            {
                Coordinates[a / 8] = new PointF(BitConverter.ToSingle(inBytes, a), BitConverter.ToSingle(inBytes, a + 4));
                ConvertedPoints.Add(new PointF(Coordinates[a / 8].X * 1000f, Coordinates[a / 8].Y * 1000f));
            }
            HitTestPath.AddLines(ConvertedPoints.ToArray());
            ConvertedPoints.Clear();

            if ((string)sRd["Name"] == "STATE")
            {
                this.ElemType = MM_Repository.FindElementType("State");
            }
            else
            {
                this.ElemType = MM_Repository.FindElementType("County");
            }
        }
Esempio n. 18
0
 /// <summary>
 /// Intialize a new remedial action scheme against a database entry
 /// </summary>
 /// <param name="dRd"></param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_RemedialActionScheme(DbDataReader dRd, bool AddIfNew)
     : base(dRd, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("RemedialActionScheme");
 }
Esempio n. 19
0
 /// <summary>
 /// Initialize a new CIM Contingency Definition
 /// </summary>
 public MM_RemedialActionScheme()
 {
     this.ElemType = MM_Repository.FindElementType("RemedialActionScheme");
 }
Esempio n. 20
0
 /// <summary>
 /// Initialize a parameterless node
 /// </summary>
 public MM_Bus()
     : base()
 {
     this.ElemType = MM_Repository.FindElementType("BusbarSection");
 }
Esempio n. 21
0
 /// <summary>
 /// Initialize a new node from an XML document
 /// </summary>
 /// <param name="ElementSource"></param>
 /// <param name="AddIfNew"></param>
 public MM_Bus(XmlElement ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("BusbarSection");
 }
Esempio n. 22
0
 /// <summary>
 /// Initialize a new CIM Substation
 /// </summary>
 /// <param name="ElementSource">The data source for this substation</param>
 /// <param name="AddIfNew"></param>
 public MM_Substation(DbDataReader ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     ElemType = MM_Repository.FindElementType("Substation");
 }
Esempio n. 23
0
 /// <summary>
 /// Initialize a new CIM substation
 /// </summary>
 public MM_Substation()
 {
     ElemType = MM_Repository.FindElementType("Substation");
 }
Esempio n. 24
0
 /// <summary>
 /// Create a new island point from a database
 /// </summary>
 /// <param name="dRd"></param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Island(DbDataReader dRd, bool AddIfNew)
     : base(dRd, AddIfNew)
 {
     this.Name     = "Island " + this.ID.ToString();
     this.ElemType = MM_Repository.FindElementType("Island");
 }
Esempio n. 25
0
 /// <summary>
 /// Initialize a new island
 /// </summary>
 public MM_Island()
 {
     this.Name     = "Island";
     this.ElemType = MM_Repository.FindElementType("Island");
 }
Esempio n. 26
0
 /// <summary>
 /// Initialize a new logical unit
 /// </summary>
 /// <param name="ElementSource"></param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Unit_Logical(DbDataReader ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("LogicalUnit");
 }
Esempio n. 27
0
 /// <summary>
 /// Initialize a new CIM load
 /// </summary>
 public MM_Load()
 {
     this.ElemType = MM_Repository.FindElementType("Load");
 }
Esempio n. 28
0
 /// <summary>
 /// Initialize a new CIM Transformer
 /// </summary>
 /// <param name="ElementSource">The XML source for this line</param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Load(XmlElement ElementSource, bool AddIfNew)
     : base(ElementSource, AddIfNew)
 {
     this.ElemType = MM_Repository.FindElementType("Load");
 }
Esempio n. 29
0
 /// <summary>
 /// Initialize a new logical unit
 /// </summary>
 public MM_Unit_Logical()
     : base()
 {
     this.ElemType = MM_Repository.FindElementType("LogicalUnit");
 }
Esempio n. 30
0
 /// <summary>
 /// Create a new island information point from XML
 /// </summary>
 /// <param name="xElem"></param>
 /// <param name="AddIfNew">Whether to add any new elements that may be created</param>
 public MM_Island(XmlElement xElem, bool AddIfNew)
     : base(xElem, AddIfNew)
 {
     this.Name     = "Island " + this.ID.ToString();
     this.ElemType = MM_Repository.FindElementType("Island");
 }