/// <summary> /// This method allows to create a new item of the history to identify when the file of an IED was imported. /// </summary> /// <param name="treeViewProject"> /// TreeView of the main SCL where the new nodes of the History will be insert. /// </param> /// <param name="objectSCLProject"> /// SCL object of the project file. /// </param> public void CreateHistory(TreeView treeViewProject, SCL objectSCLProject) { TreeViewSCL treeViewSCL = new TreeViewSCL(); TreeNode sCLObject; if (objectSCLProject.Header == null) { objectSCLProject.Header = new tHeader(); } HistoryDialog historyDlg = new HistoryDialog(objectSCLProject.Header); historyDlg.ShowDialog(); if (historyDlg.DialogResult == DialogResult.OK) { sCLObject = treeViewProject.Nodes["root"].Nodes["SCL"].Nodes["tHeader"]; if (sCLObject == null) { treeViewSCL.GetNodes(objectSCLProject.Header, treeViewProject.Nodes["root"].Nodes["SCL"]); } else { treeViewSCL.GetNodesItemOfArray(objectSCLProject.Header.History, objectSCLProject.Header.GetType(), sCLObject); } } historyDlg.Dispose(); }
public DataSetDialog() { this.treeViewSCL = new TreeViewSCL(); this.objectManagement = new ObjectManagement(); this.bandModify = false; InitializeComponent(); }
/// <summary> /// Description of the ContextMenuSCL component. /// </summary> public ContextMenuSCL(TreeViewSCL tvscl) { this.scl = tvscl.scl; this.contextMenuStrip = new ContextMenuStrip(); this.treeViewSCL = tvscl; this.objectManagement = new ObjectManagement(); }
/// <summary> /// Initializes a new instance of the <see cref="OpenSCL.UI.GSEDialog"/> class. /// </summary> /// <param name='tvscl'> /// Tvscl. /// </param> /// <param name='node'> /// Node. /// </param> /// <param name='scl'> /// Scl. /// </param> /// <param name='ied'> /// Ied. /// </param> /// <param name='ap'> /// Ap. /// </param> /// <param name='ld'> /// Ld. /// </param> public GSEDialog(TreeViewSCL tvscl, TreeNode node, tIED ied, tAccessPoint ap, tLDevice ld) { this.scl = tvscl.scl; this.ied = ied; this.ap = ap; this.ld = ld; this.node = node; this.tvscl = tvscl; // The InitializeComponent() call is required for Windows Forms designer support. InitializeComponent(); this.IdInst.Text = ld.inst; this.Text = "New GOOSE"; }
/// <summary> /// This method shows a dialog box that allows to edit a GOOSE or GSE configuration /// </summary> /// <param name="gseSelected"> /// GOOSE or GSE that was selected for Edit his configuration. /// </param> /// <param name="treeSCL"> /// TreeNode reference /// </param> /// <param name="apParentName"> /// Name of Access point where configuration will be edited according to the LN0 selected. /// </param> /// <param name="iedParentName"> /// Name of IED where configuration will be edited according to the LN0 selected. /// </param> public GSEDialog(TreeViewSCL tvscl, TreeNode node, tIED ied, tAccessPoint ap, tLDevice ld, tGSEControl gc) { this.editWindow = true; this.tvscl = tvscl; this.scl = tvscl.scl; this.ld = ld; this.ied = ied; this.ap = ap; this.node = node; this.gsec = gc; InitializeComponent(); this.datSet.SelectedItem = gc.datSet; this.oldGSEName = gc.name; this.IdInst.Text = this.ld.inst; var hgse = this.scl.Configuration.GetGSE(ied.name, ap.name, ld.inst, gc.name); if (hgse["gse"] is tGSE) { this.gse = (tGSE)hgse["gse"]; this.cbName.Text = gse.cbName; this.desc.Text = gse.desc; 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) { this.mac.Text = gse.Address.P[i].Value; } if (gse.Address.P[i].typeEnum == tPTypeEnum.APPID) { this.appId.Text = gse.Address.P[i].Value; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_PRIORITY) { this.vLANP.Text = gse.Address.P[i].Value; } if (gse.Address.P[i].typeEnum == tPTypeEnum.VLAN_ID) { this.vLANI.Text = gse.Address.P[i].Value; } } } } this.Text = "Edit GOOSE"; }
/// <summary> /// This method shows a dialog box that allows to edit a SMV configuration /// </summary> /// <param name="treeSCL"> /// TreeNode reference /// </param> /// <param name="apParentName"> /// Name of Access point where configuration will be added according to the LN0 selected. /// </param> /// <param name="iedParentName"> /// Name of IED where configuration will be added according to the LN0 selected. /// </param> /// <param name="smvObject"> /// Object that contains the information of SMV class /// </param> /// <param name="optObject"> /// Object that contains the information of SMV options class /// </param> public SMVDialog(TreeNode treeSCL, string apParentName, string iedParentName, object smvObject, object optObject, string ldInst) { SCL sCL = (SCL)treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Tag; this.edit = true; this.treeSCL = treeSCL; this.apParentName = apParentName; this.iedParentName = iedParentName; // The InitializeComponent() call is required for Windows Forms designer support. InitializeComponent(); this.datSet.DataSource = this.treeViewSCL.getDataset(this.treeSCL); //victor this.datSet.SelectedIndex = this.treeViewSCL.getDataSetSelected(treeSCL, smvObject); //victor this.oldSMVName = this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Tag, "name").ToString(); this.propertySMV.SelectedObject = smvObject; this.propertyOptions.SelectedObject = optObject; TreeNode smvNode = null; if (sCL.Communication != null) { this.treeViewSCL = new TreeViewSCL(); smvNode = this.treeViewSCL.SeekAssociation(this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes, this.objectManagement.FindVariable(smvObject, "name").ToString(), "cbName", "tSMV"); } tSMV tsmv = new tSMV(); this.ldInst.Enabled = false; this.ldInst.Text = ldInst; if (smvNode != null) { this.desc.Text = this.objectManagement.FindVariable(smvNode.Tag, "desc").ToString(); if (smvNode.FirstNode != null) { object arrayOf = smvNode.FirstNode.Tag; tP[] arr = (tP[])this.objectManagement.FindVariable(arrayOf, "P"); if (arr != null) { if (arr.Length > 0) { this.mac.Text = this.objectManagement.GetTpValue(arr, "MAC_Address"); this.appID.Text = this.objectManagement.GetTpValue(arr, "APPID"); this.vLANP.Text = this.objectManagement.GetTpValue(arr, "VLAN_PRIORITY"); this.vLANI.Text = this.objectManagement.GetTpValue(arr, "VLAN_ID"); } } } } this.Text = "Edit Sampled Value"; }
public AttributeReferences() { this.treeViewSCL = new TreeViewSCL(); this.objectManagement = new ObjectManagement(); }
/// <summary> /// This method updates the SCL tree using the SCL object that contains the clases of the /// IED imported. /// </summary> /// <param name="treeViewProject"> /// TreeView of the main SCL where the new nodes of the IED file will be insert. /// </param> /// <param name="scl"> /// SCL object created using the deserializer method on the ICD or CID file of the IED to import. /// </param> public void ImportIEDUI(TreeView treeViewProject, SCL scl) { TreeView treeViewSCLProject; TreeViewSCL treeViewSCL = new TreeViewSCL(); TreeNode sCLObject; treeViewSCLProject = treeViewProject; TreeNode treeViewToImport = new TreeNode(); treeViewToImport = treeViewSCL.GetTreeNodeSCL("TreeNodeToImport", scl); if (scl.Substation != null) { sCLObject = treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tSubstation[]"]; if (sCLObject != null) { treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.RemoveByKey("tSubstation[]"); treeViewSCL.GetNodesItemOfArray((treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag as SCL).Substation, treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag.GetType(), treeViewSCLProject.Nodes["root"].Nodes["SCL"]); } else { TreeNode node = new TreeNode(); node.Name = "tSubstation[]"; node.Text = "Substation"; node.Tag = scl.Header; treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.Add(node); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tSubstation[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tSubstation[]"], sCLObject); } } if (scl.Header != null) { sCLObject = treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tHeader"]; if (sCLObject != null) { treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.RemoveByKey("tHeader"); treeViewSCL.GetNodes((treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag as SCL).Header, treeViewSCLProject.Nodes["root"].Nodes["SCL"]); } else { TreeNode node = new TreeNode(); node.Name = "tHeader"; node.Text = "Header"; node.Tag = scl.Header; treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.Add(node); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tHeader"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tHeader"], sCLObject); } } if (scl.IED != null) { sCLObject = treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tIED[]"]; if (sCLObject != null) { treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.RemoveByKey("tIED[]"); treeViewSCL.GetNodesItemOfArray((treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag as SCL).IED, treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag.GetType(), treeViewSCLProject.Nodes["root"].Nodes["SCL"]); } else { TreeNode nodeIED = new TreeNode(); nodeIED.Name = "tIED[]"; nodeIED.Text = "IED"; nodeIED.Tag = scl.IED; treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.Add(nodeIED); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tIED[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tIED[]"], sCLObject); } } if (scl.Communication != null) { sCLObject = treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"]; if (sCLObject != null) { treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.RemoveByKey("tCommunication"); treeViewSCL.GetNodes((treeViewSCLProject.Nodes["root"].Nodes["SCL"].Tag as SCL).Communication, treeViewSCLProject.Nodes["root"].Nodes["SCL"]); } else { TreeNode nodeCommunication = new TreeNode(); nodeCommunication.Name = "tCommunication"; nodeCommunication.Text = "Communication"; nodeCommunication.Tag = scl.Communication; treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.Add(nodeCommunication); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tCommunication"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"], sCLObject); } } if (scl.DataTypeTemplates != null) { sCLObject = treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"]; if (sCLObject != null) { this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tLNodeType[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tLNodeType[]"], sCLObject); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tDOType[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tDOType[]"], sCLObject); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tDAType[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tDAType[]"], sCLObject); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tEnumType[]"], treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"].Nodes["tEnumType[]"], sCLObject); } else { TreeNode nodeDataTypeTemplates = new TreeNode(); nodeDataTypeTemplates.Name = "tDataTypeTemplates"; nodeDataTypeTemplates.Text = "DataTypeTemplates"; nodeDataTypeTemplates.Tag = scl.DataTypeTemplates; treeViewSCLProject.Nodes["root"].Nodes["SCL"].Nodes.Add(nodeDataTypeTemplates); this.CopyNodes(treeViewToImport.Nodes["SCL"].Nodes["tDataTypeTemplates"], treeViewProject.Nodes["root"].Nodes["SCL"].Nodes["tDataTypeTemplates"], sCLObject); } } }
public Utils() { this.objectManagement = new ObjectManagement(); this.treeViewSCL = new TreeViewSCL(); }
/// <summary> /// This method draws the Communication nodes on the main tree. /// </summary> private void DrawCommunication() { // Add a tCommunication object to SCL if (this.scl.Communication == null) { tCommunication communication = new tCommunication(); this.scl.Communication = communication; nodeComm = new TreeNode(); nodeComm.Name = "tCommunication"; nodeComm.Tag = this.scl.Communication; nodeComm.Text = "tCommunication"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes.Add(nodeComm); } else { nodeComm = this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"]; } // Add a Subnetwork if (this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"] == null) { nodeSubNetwork = new TreeNode(); nodeSubNetwork.Name = "tSubNetwork[]"; nodeSubNetwork.Tag = this.scl.Communication.SubNetwork; nodeSubNetwork.Text = "SubNetwork"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes.Add(nodeSubNetwork); } else { nodeSubNetwork = this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"]; } if (this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[this.nameSubNet.Text] == null && this.GetNodeName(nodeSubNetwork.Nodes, nameSubNet.Text, "name") == null) { int sni = this.scl.Communication.AddSubNetwork(this.nameSubNet.Text, this.descSubNet.Text); if (sni >= 0) { nodetSubNetwork = new TreeNode(); nodetSubNetwork.Name = this.scl.Communication.SubNetwork[sni].name; nodetSubNetwork.Text = "tSubNetwork"; nodetSubNetwork.Tag = this.scl.Communication.SubNetwork[sni]; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes.Add(nodetSubNetwork); } else { System.Windows.Forms.MessageBox.Show("Subnetwork couldn't be added. Verify if it already exist and try again", "Subnetwork wasn't added", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } else { nodetSubNetwork = this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[this.GetNodeName(nodeSubNetwork.Nodes, nameSubNet.Text, "name")]; } if (this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name].Nodes["tConnectedAP[]"] == null) { nodeComm = new TreeNode(); nodeComm.Name = "tConnectedAP[]"; nodeComm.Tag = this.scl.Communication.SubNetwork[nodetSubNetwork.Index].ConnectedAP; nodeComm.Text = "ConnectedAP"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"] .Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name].Nodes.Add(nodeComm); } else { nodeComm = this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name].Nodes["tConnectedAP[]"]; } this.treeViewSCL = new TreeViewSCL(); connap.apName = this.apName; connap.iedName = this.iedName; if (this.treeViewSCL.SeekAssociation(this.treeSCL.TreeView.Nodes["root"] .Nodes["SCL"].Nodes["tCommunication"] .Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name] .Nodes, this.apName, this.iedName) == null) { // Create tAddress tP[] tp = new tP[6]; tP_IP _ip = new tP_IP(); _ip.Value = this.ip.Text; tp[0] = _ip; tP_IPSUBNET _subnet = new tP_IPSUBNET(); _subnet.Value = this.mask.Text; tp[1] = _subnet; tP_IPGATEWAY _gate = new tP_IPGATEWAY(); _gate.Value = this.gateway.Text; tp[2] = _gate; tP_OSITSEL _tsel = new tP_OSITSEL(); _tsel.Value = this.tsel.Text; tp[3] = _tsel; tP_OSISSEL _ssel = new tP_OSISSEL(); _ssel.Value = this.ssel.Text; tp[4] = _ssel; tP_OSIPSEL _psel = new tP_OSIPSEL(); _psel.Value = this.psel.Text; tp[5] = _psel; tAddress addr = new tAddress(); addr.P = tp; tIED ied = this.scl.IED[this.scl.GetIED(this.iedName)]; int api = ied.GetAP(this.apName); int capi = this.scl.Communication .SubNetwork[nodetSubNetwork.Index].AddConnectedAP(ied, api, addr, null); if (capi >= 0) { AttributeReferences refe = new AttributeReferences(); nodetConnected = new TreeNode(); nodetConnected.Name = "tConnectedAP" + this.iedName + this.apName; nodetConnected.Tag = this.scl.Communication.SubNetwork[nodetSubNetwork.Index].ConnectedAP[capi]; nodetConnected.Text = "tConnectedAP"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"] .Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name] .Nodes["tConnectedAP[]"].Nodes.Add(nodetConnected); refe.Insert(this.scl.Communication.SubNetwork[nodetSubNetwork.Index].ConnectedAP[capi], this.treeSCL.TreeView.SelectedNode); // Add Nodes for tAddress and tP TreeNode nodeAddress = new TreeNode(); nodeAddress.Name = "Adress"; nodeAddress.Tag = address; nodeAddress.Text = "Address"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"] .Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name] .Nodes["tConnectedAP[]"].Nodes[nodetConnected.Name].Nodes.Add(nodeAddress); nodeP.Name = "tP[]"; nodeP.Text = "P"; treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"] .Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name] .Nodes["tConnectedAP[]"].Nodes[nodetConnected.Name] .Nodes["Adress"].Nodes.Add(nodeP); Utils.AddTPTreeNode(_ip, nodeP); Utils.AddTPTreeNode(_subnet, nodeP); Utils.AddTPTreeNode(_gate, nodeP); Utils.AddTPTreeNode(_tsel, nodeP); Utils.AddTPTreeNode(_psel, nodeP); Utils.AddTPTreeNode(_ssel, nodeP); } else { System.Windows.Forms.MessageBox.Show("ConnectedAP couldn't be added. Verify if it already exist and try again", "ConnectedAP wasn't added", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } else { nodetConnected = this.treeViewSCL.SeekAssociation(this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[nodetSubNetwork.Name].Nodes["tConnectedAP[]"].Nodes, this.apName, this.iedName, "apName", "iedName"); } }
void TSubstationLoad(object sender, EventArgs e) { this.treeViewSCL = new TreeViewSCL(); }