예제 #1
0
        //private void ConnValues()
        //{
        //    foreach (string name in CONN_NODE_NAMES)
        //    {
        //        switch (name)
        //        {
        //            case XML_ADDR_NODE:
        //                InitAddrData();
        //                break;
        //        }
        //    }
        //}

        //private void InitAddrData()
        //{
        //    //int idx = (int)(ConnType.Address);

        //    //foreach ()
        //}

        #endregion Construction/Destruction/Initialisation

        #region Public Methods

        public void LoadValues(XmlNode node, int idx)
        {
            int connNum = 0;
            Dictionary <string, string> TempNodes = m_Nodes;

            SubNetData[idx] = new SubNetwork();
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                CreateSubNetName(node, idx, SubNetData[idx]);
                foreach (KeyValuePair <string, string> nodeElement in TempNodes)
                {
                    string strTemp = node.ChildNodes[i].InnerText;
                    if (nodeElement.Key.Equals(node.ChildNodes[i].Name))
                    {
                        string tempNode = nodeElement.Value;
                        tempNode = strTemp;
                        if (nodeElement.Key.Equals(XML_CONN_NODE))
                        {
                            LoadConnData(node.ChildNodes[i], idx, connNum, SubNetData[idx]);
                            connNum++;
                        }
                        SubNetDevList.Add(SubNetData[idx]);
                        break;
                    }
                }
            }


            m_OldNodes.Clear();
            foreach (KeyValuePair <string, string> NodeElement in TempNodes)
            {
                string tempNode = NodeElement.Value;
                m_OldNodes.Add(NodeElement.Key, tempNode);
            }
        }
예제 #2
0
        private void CreateSubNetName(XmlNode node, int idx, SubNetwork subNet)
        {
            string name     = node.Attributes[XML_NAME_NODE].Value;
            string typeName = node.Attributes[XML_TYPE_NODE].Value;

            SubNetName[idx]   = name + ": " + typeName;
            subNet.SubNetName = name + ": " + typeName;
        }
예제 #3
0
        private void LoadPhysData(XmlNode node, int subIdx, int connIdx, int physIdx, SubNetwork subNet)
        {
            string strAttr = "";
            string strVal  = "";

            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                if (node.ChildNodes[i].Name == "P")
                {
                    strAttr = node.ChildNodes[i].Attributes["type"].Value;
                    if (!String.IsNullOrEmpty(strAttr))
                    {
                        strVal = node.ChildNodes[i].InnerText;
                        int[] idx = new int[] { subIdx, connIdx };
                        PhysNodes[subIdx, connIdx, physIdx][strAttr] = strVal;
                        subNet.Phys[connIdx, physIdx][strAttr]       = strVal;

                        if (strAttr == "Cable" && string.Equals(strVal.Substring(0, 6), "Switch"))
                        {
                            subNet.SwitchName[physIdx] = strVal.Substring(0, strVal.IndexOf(':'));
                        }
                        else if (strAttr == "Cable" && string.Equals(strVal.Substring(0, 3), "ODF"))
                        {
                            subNet.ODFName[physIdx] = strVal.Substring(0, strVal.IndexOf(':'));
                        }
                    }
                }
            }
        }
예제 #4
0
        private void LoadConnData(XmlNode node, int subIdx, int idx, SubNetwork subNet)
        {
            int                 physIdx = 0;
            XmlDocument         XmlDoc  = new XmlDocument();
            XmlNamespaceManager nsMgr   = new XmlNamespaceManager(XmlDoc.NameTable);

            nsMgr.AddNamespace("ns", "http://www.iec.ch/61850/2003/SCL");
            foreach (XmlNode cbNode in node.ChildNodes) // GSE / SMV
            {
                IedComm iedCommData = new IedComm
                {
                    IEDName = node.Attributes[XML_IED_NODE].Value,
                    CbName  = ((XmlElement)cbNode).GetAttribute("cbName"),
                    LdInst  = ((XmlElement)cbNode).GetAttribute("ldInst")
                };

                if (iedCommData.CbName != "" && iedCommData.LdInst != "")
                {
                    XmlNode cbAddrNode = cbNode.SelectSingleNode("ns:Address", nsMgr);
                    iedCommData.CbAddr = cbNode.Name + "\n";
                    foreach (XmlNode pNode in cbAddrNode)
                    {
                        iedCommData.CbAddr += ((XmlElement)pNode).GetAttribute("type")
                                              + ":" + pNode.InnerText + ";" + "\n";
                    }
                    IedCommDataList.Add(iedCommData);
                }
            }

            foreach (XmlNode physNode in node.ChildNodes) // physConn
            {
                if (((XmlElement)physNode).GetAttribute("type") == "Connection" || ((XmlElement)physNode).GetAttribute("type") == "RedConn")
                {
                    IedPhysComm iedPhysComm = new IedPhysComm();
                    iedPhysComm.IEDName = node.Attributes[XML_IED_NODE].Value;
                    foreach (XmlNode p in physNode.ChildNodes)
                    {
                        string ty = p.Attributes["type"].Value.ToString();
                        iedPhysComm.PhysAddr[ty] = p.InnerText;
                    }
                    IedPhysCommDataList.Add(iedPhysComm);
                }
            }

            subNet.IEDName[idx] = node.Attributes[XML_IED_NODE].Value;

            IedName[subIdx, idx] = node.Attributes[XML_IED_NODE].Value;
            ApName[subIdx, idx]  = node.Attributes[XML_AP_NODE].Value;
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                foreach (KeyValuePair <string, string> nodeElement in m_ConnNodes)
                {
                    string strTemp = node.ChildNodes[i].InnerText;
                    if (nodeElement.Key.Equals(node.ChildNodes[i].Name))
                    {
                        string tempNode = nodeElement.Value;
                        tempNode = strTemp;
                        if (nodeElement.Key.Equals(XML_ADDR_NODE))
                        {
                            LoadAddrData(node.ChildNodes[i], subIdx, idx);
                        }
                        else if (nodeElement.Key.Equals(XML_PHYS_NODE))
                        {
                            LoadPhysData(node.ChildNodes[i], subIdx, idx, physIdx, subNet);
                            physIdx++;
                        }
                        break;
                    }
                }
            }
        }