/// <summary> /// This method Edit a GSEControl shows the information to edit all values pre-configured for GSE and GSEControl classes. /// </summary> /// <param name="treeSCL"> /// TreeNode reference /// </param> /// <param name="gseName"> /// Name of GSE to modify /// </param> /// <param name="gsc"> /// Array of GSEControl values. /// </param> public void UpdateGSE() { this.gsec.datSet = this.datSet.SelectedItem.ToString(); node.TreeView.SelectedNode.Tag = this.gsec; node.TreeView.SelectedNode.Text = this.gsec.name; tGSE gse = (tGSE)tvscl.GetGSENode(ied.name, ap.name, ld.inst, gsec.name).Tag; gse.desc = this.desc.Text; if (gse.Address == null) { gse.InitAddess(); } if (gse.Address != null && gse.Address.P != null) { for (int i = 0; i < gse.Address.P.Length; i++) { if (gse.Address.P[i].typeEnum == tPTypeEnum.MAC_Address) { gse.Address.P[i].Value = this.mac.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.APPID) { gse.Address.P[i].Value = this.appId.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_PRIORITY) { gse.Address.P[i].Value = this.vLANP.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_ID) { gse.Address.P[i].Value = this.vLANI.Text; } } } gse.cbName = this.cbName.Text; this.gsec.name = this.cbName.Text; }
/// <summary> /// This method Adds a new Node. shows the information to edit all values pre-configured for GSE and GSEControl classes. /// </summary> /// <param name="treeSCL"> /// TreeNode reference. /// </param> /// <param name="gsc"> /// Array of GSEControl values /// </param> public void AddGSE() { // Add a GSEControl to IED tGSEControl cgse = new tGSEControl(); cgse.name = this.cbName.Text; cgse.appID = this.appId.Text; cgse.desc = this.desc.Text; cgse.type = tGSEControlTypeEnum.GOOSE; cgse.datSet = this.datSet.SelectedItem.ToString(); ld.LN0.AddGSEControl(cgse); if (!this.tvscl.AddGSEControlNode(ied.name, ap.name, ld.inst, cgse)) { MessageBox.Show("Can't update Tree for new GSEControl", "Adding a New GOOSE", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Add a GSE to Network tGSE gse = new tGSE(); gse.cbName = cgse.name; gse.desc = cgse.desc; gse.ldInst = ld.inst; gse.InitAddess(); if (gse.Address != null && gse.Address.P != null) { for (int i = 0; i < gse.Address.P.Length; i++) { if (gse.Address.P[i].typeEnum == tPTypeEnum.MAC_Address) { gse.Address.P[i].Value = this.mac.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.APPID) { gse.Address.P[i].Value = this.appId.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_PRIORITY) { gse.Address.P[i].Value = this.vLANP.Text; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_ID) { gse.Address.P[i].Value = this.vLANI.Text; } } } int iedindex = this.scl.GetIED(ied.name); var lcap = this.scl.GetIEDConnectedAP(iedindex); for (int i = 0; i < lcap.Count; i++) { IEDConnectedAP iap = (IEDConnectedAP)lcap[i]; tConnectedAP cap = this.scl.GetConnectedAP(iap.subnetwork, iap.connectedap); if (cap.apName.Equals(ap.name) && cap.iedName.Equals(ied.name)) { cap.AddGSE(gse); System.Console.WriteLine("Adding a new GSE Node..."); if (!this.tvscl.AddGSENode(ied.name, ap.name, ld.inst, gse)) { MessageBox.Show("Can't update Tree new GSE", "Adding a New GOOSE", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }