Example #1
0
 internal void MakeFileTree(Iec61850State iecs)
 {
     if (iedWindow != null)
     {
         iedWindow.Node_DirectoryUpdated(iecs.DataModel.files, null);
     }
 }
Example #2
0
 internal void MakeIecTree(Iec61850State iecs)
 {
     if (iedWindow != null)
     {
         iedWindow.makeTreeIec(iecs);
     }
 }
Example #3
0
        public void AddGooseExplorer(Iec61850State iecs, Logger logger)
        {
            DockContent gexView = new GooseExplorer(iecs, logger);

            gexView.FormClosed += new FormClosedEventHandler(gexView_FormClosed);
            gexView.TabText     = "GooseExplorer " + ++gexViewsCount;
            if (iecs != null && iecs.DataModel != null && iecs.DataModel.ied != null)
            {
                gexView.TabText += ": " + iecs.hostname;
            }
            documentViews.Add(gexView);
            gexView.Show(dockPanel);
        }
Example #4
0
 internal void UnBindFromCapture(Iec61850State iecs)
 {
     captureWindow.OnCaptureActiveChanged -= (ca) =>
     {
         iecs.CaptureDb.CaptureActive = ca;
     };
     captureWindow.OnClearCapture -= () =>
     {
         iecs.CaptureDb.Clear();
     };
     iecs.CaptureDb.OnNewPacket -= (cap) =>
     {
         captureWindow.AddPacket(cap);
     };
     // re-use for Reports
     iecs.Controller.NewReport -= reportWindow.ReportsView_OnNewReport;
 }
Example #5
0
        private void timer_Au_Tick(object sender, EventArgs e)
        {
            // Issue reads
            if (actualNode == null)
            {
                return;
            }
            Iec61850State iecs = actualNode.GetIecs();

            NodeBase[] ndarr = null;// = new NodeBase[1];
            if (actualNode is NodeData || actualNode is NodeDO || actualNode is NodeFC || actualNode is NodeVL || actualNode is NodeRCB)
            {
                ndarr    = new NodeBase[1];
                ndarr[0] = actualNode;
            }
            else if (actualNode is NodeLD || actualNode is NodeLN)
            {
                List <NodeBase> nblist = new List <NodeBase>();
                foreach (NodeBase nb in actualNode.GetChildNodes())
                {
                    if (actualNode is NodeLD)
                    {
                        // We are at LD level, we must go to FC level through LN level (grandchildren)
                        foreach (NodeBase nb2 in nb.GetChildNodes())
                        {
                            nblist.Add(nb2);
                        }
                    }
                    else
                    {
                        // We are at LN level, we go FC level / direct children
                        nblist.Add(nb);
                    }
                }
                ndarr = nblist.ToArray();
            }
            if (ndarr != null)
            {
                iecs.Send(ndarr, actualNode.CommAddress, ActionRequested.Read);
            }
        }
Example #6
0
        internal void makeTreeIec(Iec61850State iecs)
        {
            ctrl = iecs.Controller;
            if (treeViewIec.InvokeRequired)
            {
                OnNodeCallback d = new OnNodeCallback(makeTreeIec);
                this.Invoke(d, new object[] { iecs });
            }
            else
            {
                makeImageList(treeViewIec);
                treeViewIec.Nodes.Clear();
                TreeNode n = treeViewIec.Nodes.Add(iecs.DataModel.iec.Name + " = " + iecs.hostname +
                                                   ", Vendor = " + (iecs.DataModel.iec as NodeIed).VendorName +
                                                   ", Model = " + (iecs.DataModel.iec as NodeIed).ModelName +
                                                   ", Revision = " + (iecs.DataModel.iec as NodeIed).Revision +
                                                   ", DefineNVL = " + (iecs.DataModel.iec as NodeIed).DefineNVL
                                                   );
                NodeBase nb = iecs.DataModel.iec;
                n.Tag        = nb;
                n.ImageIndex = 0;
                foreach (NodeBase b in nb.GetChildNodes())
                {
                    TreeNode tn3 = n.Nodes.Add(b.Name);
                    tn3.Tag                = b;
                    tn3.ImageIndex         = 1;
                    tn3.SelectedImageIndex = 1;
                    makeTreeIec_dataNode(b, tn3);
                }

                /*nb = iecs.DataModel.files;
                 * TreeNode tn4 = n.Nodes.Add("Files");
                 * tn4.Tag = nb;
                 * tn4.ImageIndex = 3;
                 * tn4.SelectedImageIndex = 3;
                 * nb.Tag = tn4;
                 * makeTree_fileNode(nb, tn4);*/
            }
        }
Example #7
0
        void OnDisableAllRCBsClick(object sender, EventArgs e)
        {
            NodeLD        ld                 = (NodeLD)(sender as ToolStripItem).Tag;
            Iec61850State iecsld             = ld.GetIecs();
            string        disabledReports    = "";
            int           disabledReportsCnt = 0;

            if (iecsld != null)
            {
                NodeBase[] nds = ld.GetChildNodes();

                foreach (NodeBase nd in nds)
                {
                    NodeVL vl = (NodeVL)nd;

                    if (vl.Activated == false)
                    {
                        continue;
                    }

                    Iec61850State iecs = vl.GetIecs();

                    if (iecs != null)
                    {
                        if (vl.urcb != null)
                        {
                            NodeData        d    = (NodeData)vl.urcb.Parent;
                            List <NodeData> ndar = new List <NodeData>();
                            NodeBase        b;
                            if ((b = d.FindChildNode("RptEna")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = false;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("GI")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = false;
                                ndar.Add(n);
                            }

                            iecs.Send(ndar.ToArray(), d.CommAddress, ActionRequested.Write);

                            disabledReports += vl.urcb.Parent.Name + "\r\n";
                            disabledReportsCnt++;

                            vl.Activated = false;
                            vl.urcb      = null;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Basic structure not found!");
                    }
                }

                MessageBox.Show("Disabled " + disabledReportsCnt.ToString() + ((disabledReportsCnt == 1) ? " report:\r\n\r\n" : " reports:\r\n\r\n") + disabledReports + "\r\n", "Disable All RCBs");
            }
        }
Example #8
0
        void OnEnableAllRCBsClick(object sender, EventArgs e)
        {
            NodeLD        ld                = (NodeLD)(sender as ToolStripItem).Tag;
            Iec61850State iecsld            = ld.GetIecs();
            NodeBase      ur                = null;
            NodeBase      b                 = null;
            string        enabledReports    = "";
            int           enabledReportsCnt = 0;

            if (iecsld != null)
            {
                NodeBase[] nds = ld.GetChildNodes();

                foreach (NodeBase nd in nds)
                {
                    NodeVL vl = (NodeVL)nd;

                    if (vl.Activated == true)
                    {
                        continue;
                    }

                    Iec61850State iecs = vl.GetIecs();

                    ur = null;

                    if (iecs != null)
                    {
                        do
                        {
                            ur = (NodeData)iecs.DataModel.ied.FindNodeByValue(scsm_MMS_TypeEnum.visible_string, vl.IecAddress, ref ur);

                            if (ur == null) // Suitable URCB not found, list cannot be activated!
                            {
                                break;
                            }

                            vl.urcb = (NodeData)ur;
                            NodeData d = (NodeData)vl.urcb.Parent;
                            b = d.FindChildNode("Resv");
                        } while (!(ur.Parent.Name.Contains("rcb") && ((Boolean)((NodeData)b).DataValue == false)));

                        if (vl.urcb != null && ur != null)
                        {
                            NodeData        d    = (NodeData)vl.urcb.Parent;
                            List <NodeData> ndar = new List <NodeData>();

                            if ((b = d.FindChildNode("Resv")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = true;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("DatSet")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = ((NodeData)b).DataValue;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("OptFlds")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = new byte[] { 0x7c, 0x00 };
                                n.DataParam = 6;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("TrgOps")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = new byte[] { 0x74 };
                                n.DataParam = 2;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("RptEna")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = true;
                                ndar.Add(n);
                            }
                            if ((b = d.FindChildNode("GI")) != null)
                            {
                                NodeData n = new NodeData(b.Name);
                                n.DataType  = ((NodeData)b).DataType;
                                n.DataValue = true;
                                ndar.Add(n);
                            }
                            iecs.Send(ndar.ToArray(), d.CommAddress, ActionRequested.Write);

                            enabledReports += ur.Parent.Name + "\r\n";
                            enabledReportsCnt++;

                            vl.Activated = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Basic structure not found!");
                    }
                }

                MessageBox.Show("Enabled " + enabledReportsCnt.ToString() + ((enabledReportsCnt == 1) ? " report:\r\n\r\n" : " reports:\r\n\r\n") + enabledReports + "\r\n", "Enable All RCBs");
            }
        }
Example #9
0
 internal void makeTree(Iec61850State iecs)
 {
     ctrl = iecs.Controller;
     if (treeViewIed.InvokeRequired)
     {
         OnNodeCallback d = new OnNodeCallback(makeTree);
         this.Invoke(d, new object[] { iecs });
     }
     else
     {
         makeImageList(treeViewIed);
         treeViewIed.Nodes.Clear();
         TreeNode n = treeViewIed.Nodes.Add(iecs.DataModel.ied.Name + " = " + iecs.hostname +
                                            ", Vendor = " + (iecs.DataModel.ied as NodeIed).VendorName +
                                            ", Model = " + (iecs.DataModel.ied as NodeIed).ModelName +
                                            ", Revision = " + (iecs.DataModel.ied as NodeIed).Revision +
                                            ", DefineNVL = " + (iecs.DataModel.ied as NodeIed).DefineNVL
                                            );
         NodeBase nb = iecs.DataModel.ied;
         n.Tag        = nb;
         n.ImageIndex = 0;
         foreach (NodeBase b in nb.GetChildNodes())
         {
             TreeNode tn2 = n.Nodes.Add(b.Name);
             tn2.Tag                = b;
             tn2.ImageIndex         = 1;
             tn2.SelectedImageIndex = 1;
             TreeNode tn3 = tn2.Nodes.Add("Data");
             tn3.Tag                = b;
             tn3.ImageIndex         = 2;
             tn3.SelectedImageIndex = 2;
             makeTree_dataNode(b, tn3);
             NodeBase lb = iecs.DataModel.lists.FindChildNode(b.Name);
             if (lb != null)
             {
                 tn3                    = tn2.Nodes.Add("DataSets");
                 tn3.Tag                = lb;
                 tn3.ImageIndex         = 3;
                 tn3.SelectedImageIndex = 3;
                 makeTree_listNode(lb, tn3);
             }
             NodeBase ur = iecs.DataModel.urcbs.FindChildNode(b.Name);
             if (ur != null)
             {
                 tn3                    = tn2.Nodes.Add("Unbuffered Reports");
                 tn3.Tag                = ur;
                 tn3.ImageIndex         = 3;
                 tn3.SelectedImageIndex = 3;
                 makeTree_reportNode(ur, tn3);
             }
             NodeBase br = iecs.DataModel.brcbs.FindChildNode(b.Name);
             if (br != null)
             {
                 tn3                    = tn2.Nodes.Add("Buffered Reports");
                 tn3.Tag                = br;
                 tn3.ImageIndex         = 3;
                 tn3.SelectedImageIndex = 3;
                 makeTree_reportNode(br, tn3);
             }
         }
         nb = iecs.DataModel.files;
         TreeNode tn4 = n.Nodes.Add("Files");
         tn4.Tag                = nb;
         tn4.ImageIndex         = 3;
         tn4.SelectedImageIndex = 3;
         nb.Tag = tn4;
         makeTree_fileNode(nb, tn4);
     }
 }
Example #10
0
 public void Set_iecf(Iec61850State _iecf)
 {
     iecf = _iecf;
 }