public int AddIED(string name) { int index = -1; if (dataTypeTemplatesField == null) { dataTypeTemplatesField = new tDataTypeTemplates(); } int i; tIED ied = new tIED(); if (name == null) { i = GetIED("TEMPLATE"); if (i >= 0) { SCL.nied++; } string n = ""; if (SCL.nied == 0) { SCL.nied++; } else { n += (SCL.nied++).ToString(); } ied.name = "TEMPLATE" + n; } else { i = GetIED(name); if (i >= 0) { return(-1); } ied.name = name; } ied.configVersion = "0"; int iap = ied.AddAP(null); ied.AddLDevice(null, ied.AccessPoint[iap].name, this.DataTypeTemplates); if (iEDField == null) { iEDField = new tIED[1]; iEDField [0] = ied; index = 0; } else { System.Array.Resize <tIED> (ref this.iEDField, this.iEDField.GetLength(0) + 1); index = this.iEDField.GetLength(0) - 1; this.iEDField [index] = ied; } return(index); }
/// <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)); }
/// <summary> /// Use this constructor to create a new tLNode to be used on SCL's Substation section. /// </summary> /// <param name="ied"> /// A <see cref="tIED"/> witch contains the referer LD and LN in a configured system. Use null if no IED is /// referer because you are creating a Specification. /// </param> /// <param name="ld"> /// A <see cref="tLDevice"/> reference witch contains a LN to be referer in a configured system. Use null if no IED is /// referer because you are creating a Specification. /// </param> /// <param name="ln"> /// A <see cref="tLN"/> reference in configured system. Use null if no IED is /// referer because you are creating a Specification. /// </param> public tLNode(tIED ied, tLDevice ld, tLN ln) { if (ied != null) { this.iedNameField = ied.name; if(ld != null) this.ldInstField = ld.inst; else this.ldInstField = ""; } else this.iedNameField = "None"; if(ln != null) { this.lnInstField = (string) System.Convert.ChangeType(this.tLN.inst, typeof(string)); this.lnClassField = this.tLN.lnClass; this.lnTypeField = this.tLN.lnType; } else { this.ldInstField = ""; this.prefixField = ""; this.lnClass = "XSWI"; } }
public tConnectedAP(tIED ied, int ap, tAddress addr) { this.iedNameField = ied.name; this.apName = ied.AccessPoint[ap].name; this.addressField = addr; }