OPC Studio User's Guide and Reference
AENodeElementCollection Class
Members 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Namespace : AENodeElementCollection Class
A collection of node elements (AENodeElement), keyed by their names.
Object Model
AENodeElementCollection ClassAENodeElement Class
Syntax
'Declaration
 
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection)>
<ComVisibleAttribute(True)>
<GuidAttribute("4FF6472F-CA4F-4D87-985B-A563DB230836")>
<CLSCompliantAttribute(True)>
<TypeConverterAttribute(OpcLabs.BaseLib.Collections.ObjectModel.Implementation.KeyedCollection2TypeConverter)>
<DefaultMemberAttribute("Item")>
<DebuggerTypeProxyAttribute(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)>
<DebuggerDisplayAttribute("Count = {Count}")>
<SerializableAttribute()>
Public NotInheritable Class AENodeElementCollection 
   Inherits OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2(Of String,AENodeElement)
   Implements OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection, System.Collections.Generic.ICollection(Of AENodeElement), System.Collections.Generic.IEnumerable(Of AENodeElement), System.Collections.Generic.IList(Of AENodeElement), System.Collections.Generic.IReadOnlyCollection(Of AENodeElement), System.Collections.Generic.IReadOnlyList(Of AENodeElement), System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable 
'Usage
 
Dim instance As AENodeElementCollection
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection)]
[ComVisible(true)]
[Guid("4FF6472F-CA4F-4D87-985B-A563DB230836")]
[CLSCompliant(true)]
[TypeConverter(OpcLabs.BaseLib.Collections.ObjectModel.Implementation.KeyedCollection2TypeConverter)]
[DefaultMember("Item")]
[DebuggerTypeProxy(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)]
[DebuggerDisplay("Count = {Count}")]
[Serializable()]
public sealed class AENodeElementCollection : OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2<string,AENodeElement>, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection, System.Collections.Generic.ICollection<AENodeElement>, System.Collections.Generic.IEnumerable<AENodeElement>, System.Collections.Generic.IList<AENodeElement>, System.Collections.Generic.IReadOnlyCollection<AENodeElement>, System.Collections.Generic.IReadOnlyList<AENodeElement>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable  
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection)]
[ComVisible(true)]
[Guid("4FF6472F-CA4F-4D87-985B-A563DB230836")]
[CLSCompliant(true)]
[TypeConverter(OpcLabs.BaseLib.Collections.ObjectModel.Implementation.KeyedCollection2TypeConverter)]
[DefaultMember("Item")]
[DebuggerTypeProxy(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)]
[DebuggerDisplay("Count = {Count}")]
[Serializable()]
public ref class AENodeElementCollection sealed : public OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2<String,AENodeElement>, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AENodeElementCollection, System.Collections.Generic.ICollection<AENodeElement>, System.Collections.Generic.IEnumerable<AENodeElement>, System.Collections.Generic.IList<AENodeElement>, System.Collections.Generic.IReadOnlyCollection<AENodeElement>, System.Collections.Generic.IReadOnlyList<AENodeElement>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable  
Remarks
This collection is returned by the browsing methods.

Information in an OPC Alarms and Events server is organized in a tree hierarchy (process space), where the branch nodes (event areas) serve organizational purposes (similar to folders in a file system), while the leaf nodes actually generate events (similar to files in a file system) – they are called event sources. Each node has a “short” name that is unique among other branches or leaves under the same parent branch (or a root). Event sources can be fully identified using a “fully qualified” source name, which determines the OPC event source without a need to further qualify it with its position in the tree. OPC event source may look a process tag (e.g. “FIC101”, or “Device1.Block101”), or possibly a device or subsystem identification; their syntax and meaning is fully determined by the particular OPC server they are coming from.

QuickOPC gives you methods to traverse through the address space information and obtain the information available there. It is also possible to filter the returned nodes by a server specific filter string.

If you want to retrieve a list of all event areas under a given parent area (or under a root) of the OPC server, call the BrowseAreas method. You will receive an AENodeElementCollection object. Each AENodeElement contains information gathered about one sub-area node, such as its name, or an indication whether it has children.

.NET

// This example shows how to obtain all areas directly under the root (denoted by empty string for the parent).
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class BrowseAreas 
    { 
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AENodeElementCollection nodeElements;
            try
            {
                nodeElements = client.BrowseAreas("", "OPCLabs.KitEventServer.2", "");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement nodeElement in nodeElements)
            {
                Debug.Assert(nodeElement != null);

                Console.WriteLine("nodeElements[\"{0}\"]:", nodeElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName);
            }
        }
    } 
}
# This example shows how to obtain all areas directly under the root (denoted by empty string for the parent).
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.AlarmsAndEvents import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object
client = EasyAEClient()

# Perform the operation
try:
    nodeElements = IEasyAEClientExtension.BrowseAreas(client, '', 'OPCLabs.KitEventServer.2', '')
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results
for nodeElement in nodeElements:
    assert nodeElement is not None
    print('NodeElements["', nodeElement.Name, '"]:', sep='')
    print('    .QualifiedName: ', nodeElement.QualifiedName, sep='')
' This example shows how to obtain all areas directly under the root (denoted by empty string for the parent).
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace AlarmsAndEvents._EasyAEClient

    Friend Class BrowseAreas
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim nodeElements As AENodeElementCollection
            Try
                nodeElements = client.BrowseAreas("", "OPCLabs.KitEventServer.2", "")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each nodeElement As AENodeElement In nodeElements
                Debug.Assert(nodeElement IsNot Nothing)

                Console.WriteLine("nodeElements[""{0}""]:", nodeElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName)
            Next nodeElement
        End Sub
    End Class

End Namespace

COM

Rem This example shows how to obtain all areas directly under the root (denoted by empty string for the parent).
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient")
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.BrowseAreas("", "OPCLabs.KitEventServer.2", "")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo "NodeElements(""" & NodeElement.Name & """):"
    With NodeElement
        WScript.Echo Space(4) & ".QualifiedName: " & .QualifiedName
    End With
Next

 

Similarly, if you want to retrieve a list of event sources under a given parent area (or under a root) of the OPC server, call the BrowseSources method. You will also receive back an AENodeElementCollection object, this time containing the event sources only. You can find information such as the fully qualified source name from the AENodeElement of any event source, extract it and pass it further to methods like GetConditionState or SubscribeEvents.

.NET

// This example shows how to obtain all sources under the "Simulation" area.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class BrowseSources
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AENodeElementCollection nodeElements;
            try
            {
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement nodeElement in nodeElements)
            {
                Debug.Assert(nodeElement != null);

                Console.WriteLine("nodeElements[\"{0}\"]:", nodeElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName);
            }
        }
    }
}
# This example shows how to obtain all sources under the "Simulation" area.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.AlarmsAndEvents import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object
client = EasyAEClient()

# Perform the operation
try:
    nodeElements = IEasyAEClientExtension.BrowseSources(client, '', 'OPCLabs.KitEventServer.2', 'Simulation')
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results
for nodeElement in nodeElements:
    assert nodeElement is not None
    print('NodeElements["', nodeElement.Name, '"]:', sep='')
    print('    .QualifiedName: ', nodeElement.QualifiedName, sep='')
' This example shows how to obtain all sources under the "Simulation" area.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace AlarmsAndEvents._EasyAEClient

    Friend Class BrowseSources
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim nodeElements As AENodeElementCollection
            Try
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each nodeElement As AENodeElement In nodeElements
                Debug.Assert(nodeElement IsNot Nothing)

                Console.WriteLine("nodeElements[""{0}""]:", nodeElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName)
            Next nodeElement
        End Sub
    End Class

End Namespace

COM

Rem This example shows how to obtain all sources under the "Simulation" area.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient")
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo "NodeElements(""" & NodeElement.Name & """):"
    With NodeElement
        WScript.Echo Space(4) & ".QualifiedName: " & .QualifiedName
    End With
Next

 

QuickOPC.NET: The most generic address space browsing method is BrowseNodes. It combines the functionality of BrowseAreas and BrowseSources, and it also allows the widest range of filtering options by passing in an argument of type AEBrowseParameters.

You can obtain both sources and areas in one BrowseNodes call, if you specify AEBrowseFilter.All in the browse parameters arguments.

 

 

Inheritance Hierarchy

System.Object
   System.Collections.ObjectModel.Collection<T>
      System.Collections.ObjectModel.KeyedCollection<TKey,TItem>
            OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.AENodeElementCollection

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also