Exemplo n.º 1
0
        public void DeactivateNVL(NodeVL vl)
        {
            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);
                    vl.Activated = false;
                    vl.urcb      = null;
                }
            }
            else
            {
                Logger.getLogger().LogError("Basic structure not found!");
            }
        }
Exemplo n.º 2
0
        void OnDeleteNVLClick(object sender, EventArgs e)
        {
            NodeVL        nvl  = (NodeVL)(sender as ToolStripItem).Tag;
            Iec61850State iecs = nvl.GetIecs();

            NodeBase[] ndarr = new NodeBase[1];
            ndarr[0] = nvl;
            iecs.Send(ndarr, nvl.CommAddress, ActionRequested.DefineNVL);
        }
Exemplo n.º 3
0
        void OnDefineNVLClick(object sender, EventArgs e)
        {
            NodeVL          nvl  = (NodeVL)(sender as ToolStripItem).Tag;
            Iec61850State   iecs = nvl.GetIecs();
            List <NodeBase> ndar = new List <NodeBase>();

            foreach (NodeBase n in nvl.GetChildNodes())
            {
                ndar.Add(n);
            }
            iecs.Send(ndar.ToArray(), nvl.CommAddress, ActionRequested.DefineNVL);
        }
Exemplo n.º 4
0
        void OnDeactivateNVLClick(object sender, EventArgs e)
        {
            NodeVL        vl   = (NodeVL)(sender as ToolStripItem).Tag;
            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);
                    vl.Activated = false;
                    vl.urcb      = null;
                }
            }
            else
            {
                MessageBox.Show("Basic structure not found!");
            }
        }
Exemplo n.º 5
0
        public void ActivateNVL(NodeVL vl)
        {
            //Logger.getLogger().LogError("Function not active, try to configure an RCB!");
            //return;

            NodeBase      ur   = null;
            Iec61850State iecs = vl.GetIecs();
            bool          retry;

            if (iecs != null)
            {
                do
                {
                    ur = (NodeData)iecs.DataModel.ied.FindNodeByValue(scsm_MMS_TypeEnum.visible_string, vl.IecAddress, ref ur);
                    if (ur == null || ur.Parent == null)
                    {
                        Logger.getLogger().LogError("Suitable URCB not found, list cannot be activated!");
                        return;
                    }
                    retry   = !ur.Parent.Name.ToLower().Contains("rcb");
                    vl.urcb = (NodeData)ur;
                    NodeData d = (NodeData)vl.urcb.Parent;
                    NodeData b;
                    if ((b = (NodeData)d.FindChildNode("Resv")) != null)
                    {
                        // Resv is always a boolean
                        // If true then the rcb is occupied and we need to find another one
                        if ((bool)b.DataValue)
                        {
                            retry = true;
                        }
                    }
                } while (retry);

                if (vl.urcb != null)
                {
                    NodeData        d    = (NodeData)vl.urcb.Parent;
                    List <NodeData> ndar = new List <NodeData>();
                    NodeBase        b;
                    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);
                    vl.Activated = true;
                }
            }
            else
            {
                Logger.getLogger().LogError("Basic structure not found!");
            }
        }
Exemplo n.º 6
0
        void OnActivateNVLClick(object sender, EventArgs e)
        {
            NodeVL        vl   = (NodeVL)(sender as ToolStripItem).Tag;
            NodeBase      ur   = null;
            Iec61850State iecs = vl.GetIecs();

            if (iecs != null)
            {
                do
                {
                    ur = (NodeData)iecs.ied.FindNodeByValue(scsm_MMS_TypeEnum.visible_string, vl.Address, ref ur);
                    if (ur == null)
                    {
                        MessageBox.Show("Suitable URCB not found, list cannot be activated!");
                        return;
                    }
                } while (!ur.Parent.Name.ToLower().Contains("rcb"));
                vl.urcb = (NodeData)ur;

                if (vl.urcb != null)
                {
                    NodeData        d    = (NodeData)vl.urcb.Parent;
                    List <NodeData> ndar = new List <NodeData>();
                    NodeBase        b;
                    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);
                    vl.Activated = true;
                }
            }
            else
            {
                MessageBox.Show("Basic structure not found!");
            }
        }