Example #1
0
 public tLN()
 {
     this.prefix      = "";
     this.lnClass     = tLNClassEnum.LPHD.ToString();
     this.lnClassEnum = tLNClassEnum.LPHD;
     this.inst        = ++index;
     this.status      = tStatusEnum.Unknown;
 }
Example #2
0
        /// <summary>
        /// Use this constructor to create a new LN and verify if it is Valid, if there's no other
        /// LN in the LD with the same prefix, class and instance. Check Status property in order
        /// to know its status.
        /// </summary>
        /// <param name="ld">
        /// A <see cref="tLDevice"/> to be used to check for duplicated instances.
        /// </param>
        /// <param name="lnClass">
        /// A <see cref="System.String"/> with the name of the LN Class as on IEC 61850-7-x
        /// </param>
        /// <param name="prefix">
        /// A <see cref="System.String"/> with the prefix on LN Class.
        /// </param>
        /// <param name="inst">
        /// A <see cref="System.UInt32"/> with the instance number of the LN Class.
        /// </param>
        /// <param name="lnType">
        /// A <see cref="tLNodeType"/> reference to instantied.
        /// </param>
        public tLN(tLDevice ld, string lnClass, string prefix, uint inst, tLNodeType lnType)
        {
            if (ld == null)
            {
                return;
            }
            if (lnType == null)
            {
                return;
            }

            if (inst == 0)
            {
                this.inst = ++index;
            }
            else
            {
                this.inst = inst;
            }

            this.lnClass = lnClass;

            this.lnType = lnType.id;

            // Search for duplicated LN
            if (ld.LN != null)
            {
                for (int i = 0; i < ld.LN.GetLength(0); i++)
                {
                    tLN ln = ld.LN[i];
                    if (ln.prefix == this.prefix && ln.inst == this.inst && ln.lnClass == this.lnClass)
                    {
                        this.status = tStatusEnum.Invalid;
                        break;
                    }
                }
                this.status = tStatusEnum.Valid;
            }
        }