OPC Studio User's Guide and Reference
AEConditionElement Class
Members  Example 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Namespace : AEConditionElement Class
Contains information gathered about an OPC event condition.
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)>
<ComVisibleAttribute(True)>
<FacetAttribute("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")>
<GuidAttribute("B25B39BE-F13F-42F3-972C-9AF835A4E383")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class AEConditionElement 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As AEConditionElement
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)]
[ComVisible(true)]
[Facet("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")]
[Guid("B25B39BE-F13F-42F3-972C-9AF835A4E383")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class AEConditionElement : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)]
[ComVisible(true)]
[Facet("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")]
[Guid("B25B39BE-F13F-42F3-972C-9AF835A4E383")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class AEConditionElement sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks
This object is filled in and returned e.g. when you query for OPC event categories.

 

The EasyAEClient.QueryCategoryConditions method finds out out event conditions supported by given event category.

 

The EasyAEClient.QuerySourceConditions method finds out event conditions associated with the given event source.

.NET

// This example shows how to enumerate all event conditions associated with the specified event source.
//
// 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 QuerySourceConditions 
    { 
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AEConditionElementCollection conditionElements;
            try
            {
                conditionElements = client.QuerySourceConditions("", "OPCLabs.KitEventServer.2", 
                    "Simulation.ConditionState1");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AEConditionElement conditionElement in conditionElements)
            {
                Debug.Assert(conditionElement != null);
                Console.WriteLine("ConditionElements[\"{0}\"]: {1} subcondition(s)", 
                    conditionElement.Name, conditionElement.SubconditionNames.Length);
            }
        }
    } 
}
# This example shows how to enumerate all event conditions associated with the specified event source.
#
# 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:
    conditionElements = IEasyAEClientExtension.QuerySourceConditions(client, '', 'OPCLabs.KitEventServer.2',
                                                                     AENodeDescriptor('Simulation.ConditionState1'))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results.
for conditionElement in conditionElements:
    assert conditionElement is not None
    print('ConditionElements[', conditionElement.Name, ']: ',
          conditionElement.SubconditionNames.Length, ' subcondition(s)',
          sep='')

print()
print('Finished.')
' This example shows how to enumerate all event conditions associated with the specified event source.
'
' 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 QuerySourceConditions
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim conditionElements As AEConditionElementCollection
            Try
                conditionElements = client.QuerySourceConditions( _
                    "", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each conditionElement As AEConditionElement In conditionElements
                Debug.Assert(conditionElement IsNot Nothing)
                Console.WriteLine("ConditionElements[""{0}""]: {1} subcondition(s)", _
                                  conditionElement.Name, conditionElement.SubconditionNames.Length)
            Next conditionElement
        End Sub
    End Class

End Namespace

COM

Rem This example shows how to enumerate all event conditions associated with the specified event source.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

Dim SourceDescriptor: Set SourceDescriptor = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor")
SourceDescriptor.QualifiedName = "Simulation.ConditionState1"

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

Dim ConditionElement: For Each ConditionElement In ConditionElements
    WScript.Echo "ConditionElements(" & ConditionElement.Name & "): " & (UBound(ConditionElement.SubconditionNames) + 1) & " subcondition(s)"
Next

 

 

 

 

Example

.NET

// This example shows information available about OPC event condition.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace DocExamples.AlarmsAndEvents._AEConditionElement 
{ 
    class Properties 
    {
        static void DumpSubconditionNames(IEnumerable<string> subconditionNames)
        {
            foreach (string name in subconditionNames) Console.WriteLine("            {0}", name);
        }

        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

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

            foreach (AECategoryElement categoryElement in categoryElements)
            {
                Debug.Assert(categoryElement != null);

                Console.WriteLine("Category {0}:", categoryElement);
                foreach (AEConditionElement conditionElement in categoryElement.ConditionElements)
                {
                    Debug.Assert(conditionElement != null);

                    Console.WriteLine("    Information about condition \"{0}\":", conditionElement);
                    Console.WriteLine("        .Name: {0}", conditionElement.Name);
                    Console.WriteLine("        .SubconditionNames:");
                    DumpSubconditionNames(conditionElement.SubconditionNames);
                }
            }
        }
    } 
}
# This example shows information available about OPC event condition.
#
# 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.AlarmsAndEvents import *
from OpcLabs.EasyOpc.OperationModel import *


def dumpSubconditionNames(subconditionNames):
    for name in subconditionNames:
        print('            ', name, sep='')


# Instantiate the client object.
client = EasyAEClient()

try:
    categoryElements = IEasyAEClientExtension.QueryEventCategories(client, '', 'OPCLabs.KitEventServer.2')
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message, sep='')
    exit()

# Display results
for categoryElement in categoryElements:
    assert categoryElement is not None
    print('Category ', categoryElement, sep='')
    for conditionElement in categoryElement.ConditionElements:
        assert  conditionElement is not None
        print('    Information about condition "', conditionElement, '":', sep='')
        print('        .Name: ', conditionElement.Name, sep='')
        print('        .SubconditionNames:')
        dumpSubconditionNames(conditionElement.SubconditionNames)
' This example shows information available about OPC event condition.
'
' 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._AEConditionElement

    Friend Class Properties
        Private Shared Sub DumpSubconditionNames(ByVal subconditionNames As IEnumerable(Of String))
            For Each name As String In subconditionNames
                Console.WriteLine("            {0}", name)
            Next name
        End Sub

        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

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

            For Each categoryElement As AECategoryElement In categoryElements
                Debug.Assert(categoryElement IsNot Nothing)

                Console.WriteLine("Category {0}:", categoryElement)
                For Each conditionElement As AEConditionElement In categoryElement.ConditionElements
                    Debug.Assert(conditionElement IsNot Nothing)

                    Console.WriteLine("    Information about condition ""{0}"":", conditionElement)
                    Console.WriteLine("        .Name: {0}", conditionElement.Name)
                    Console.WriteLine("        .SubconditionNames:")
                    DumpSubconditionNames(conditionElement.SubconditionNames)
                Next conditionElement
            Next categoryElement
        End Sub
    End Class

End Namespace
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.AEConditionElement

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