Exemple #1
0
        public System.Collections.Hashtable GetGSE(string iedname, string apname, string ldinst, string gsecname)
        {
            var h = new System.Collections.Hashtable();

            if (this.Communication == null)
            {
                return(h);
            }
            if (this.Communication.SubNetwork == null)
            {
                return(h);
            }

            for (int i = 0; i < this.Communication.SubNetwork.Length; i++)
            {
                tSubNetwork s = this.Communication.SubNetwork[i];
                if (s.ConnectedAP == null)
                {
                    return(h);
                }
                for (int c = 0; c < s.ConnectedAP.Length; c++)
                {
                    tConnectedAP cap = s.ConnectedAP[c];
                    if (cap.iedName.Equals(iedname) &&
                        cap.apName.Equals(apname))
                    {
                        if (cap.GSE == null)
                        {
                            return(h);
                        }
                        for (int g = 0; g < cap.GSE.Length; g++)
                        {
                            tGSE gse = cap.GSE[g];
                            if (gse.cbName.Equals(gsecname) &&
                                gse.ldInst.Equals(ldinst))
                            {
                                h.Add("gse", gse);
                                h.Add("subnetwork", s);
                                h.Add("connectedap", cap);
                                return(h);
                            }
                        }
                    }
                }
            }
            return(h);
        }
Exemple #2
0
        /// <summary>
        /// Add a new Connected Access Point to a Subnetwork.
        /// </summary>
        /// <param name="ied">
        /// A <see cref="tIED"/> object with the IED to connect to this subnetwork.
        /// </param>
        /// <param name="ap">
        /// A <see cref="System.Int32"/> with the index of the Access Point in the IED to connect to
        /// this subnetwork.
        /// </param>
        /// <param name="addr">
        /// A <see cref="tAddress"/> object to set Connected Access Point's address of the IED to
        /// connect to this network.
        /// </param>
        /// <param name="desc">
        /// A <see cref="System.String"/> with the description of the new Connected Access Point.
        /// </param>
        /// <returns>
        /// A <see cref="System.Int32"/>, with the index of Connected Access Point added, -1 on error.
        /// </returns>
        public int AddConnectedAP(tIED ied, int apIndex, tAddress addr, string desc)
        {
            if (ied == null || addr == null || apIndex < 0 || apIndex > ied.AccessPoint.GetLength(0))
            {
                return(-1);
            }

            tConnectedAP ap = new tConnectedAP();

            ap.Address = addr;
            ap.desc    = desc;
            ap.iedName = ied.name;
            ap.apName  = ied.AccessPoint[apIndex].name;

            if (this.connectedAPField == null)
            {
                this.connectedAPField    = new tConnectedAP[1];
                this.connectedAPField[0] = ap;
                return(0);
            }
            return(this.AddConnectedAP(ap));
        }
Exemple #3
0
        public int AddConnectedAP(tConnectedAP ap)
        {
            int index = -1;

            if (this.connectedAPField != null)
            {
                try {
                    System.Array.Resize <tConnectedAP>(ref this.connectedAPField,
                                                       this.connectedAPField.Length + 1);
                    index = this.connectedAPField.Length - 1;
                }
                catch {
                    return(-1);
                }
            }
            else
            {
                this.connectedAPField = new tConnectedAP[1];
                index = 0;
            }
            this.connectedAPField[index] = ap;
            return(index);
        }
Exemple #4
0
        public int ConnectAP(string subnetwork, string ap, tCommunication comm)
        {
            int iap = GetAP(ap);

            if (iap < 0)
            {
                return(-1);
            }
            if (comm == null)
            {
                return(-1);
            }
            int isn = comm.GetSubNetwork(subnetwork);

            if (isn < 0)
            {
                return(-1);
            }

            var cap = new tConnectedAP();

            cap.apName  = ap;
            cap.iedName = name;
            cap.Address = new tAddress();
            var ip = new tP_IP();

            ip.Value = comm.SubNetwork[isn].NetworkIP();
            cap.Address.AddtP(ip);
            var gw = new tP_IPGATEWAY();

            gw.Value = comm.SubNetwork[isn].LastIP();
            cap.Address.AddtP(gw);
            var ipnm = new tP_IPSUBNET();

            cap.Address.AddtP(ipnm);
            return(comm.SubNetwork[isn].AddConnectedAP(cap));
        }