QuickOPC User's Guide and Reference
AEConditionState Class
Members 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents Namespace : AEConditionState Class
Contains current state information about an OPC condition instance.
Object Model
AEConditionState ClassAESubconditionElement ClassAEAttributeValueDictionary ClassDAQuality ClassDAQuality ClassAESubconditionElementCollection ClassAESubconditionElement Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState)>
<ComVisibleAttribute(True)>
<GuidAttribute("2FF5B789-FCF1-4321-A4D5-2D5BB2E0B341")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class AEConditionState 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As AEConditionState
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState)]
[ComVisible(true)]
[Guid("2FF5B789-FCF1-4321-A4D5-2D5BB2E0B341")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class AEConditionState : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState)]
[ComVisible(true)]
[Guid("2FF5B789-FCF1-4321-A4D5-2D5BB2E0B341")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class AEConditionState sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes._AEConditionState, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks

 

In OPC Alarms and Events, information is usually provided in form of event notifications, especially for transient (simple and tracking) events. For condition-related events, however, it is also possible to get (upon request) information about the current state of a specified condition.

If you want to obtain the current state information for the condition instance in an OPC Alarms and Events sever, call the GetConditionState method. You pass in individual arguments for machine name, server class, fully qualified source name, condition name, and optionally an array of event attributes to be returned. You will receive back an AEConditionState object holding the current state information about an OPC condition instance.

// This example shows how to obtain current state information for the condition instance corresponding to a Source and 
// certain ConditionName.

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

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

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

            Console.WriteLine("ConditionState:");
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition);
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled);
            Console.WriteLine("    .Active: {0}", conditionState.Active);
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged);
            Console.WriteLine("    .Quality: {0}", conditionState.Quality);
            // Remark: IAEConditionState has many more properties
        }
    } 
}
' This example shows how to obtain current state information for the condition instance corresponding to a Source and 
' certain ConditionName.

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

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

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

            Dim conditionState As AEConditionState
            Try
                conditionState = client.GetConditionState("", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1", "Simulated")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine("ConditionState:")
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition)
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled)
            Console.WriteLine("    .Active: {0}", conditionState.Active)
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged)
            Console.WriteLine("    .Quality: {0}", conditionState.Quality)
            ' Remark: IAEConditionState has many more properties
        End Sub
    End Class

End Namespace
# This example shows how to obtain current state information for the condition instance corresponding to a Source and 
# certain ConditionName.

import time
import win32com.client

serverDescriptor = win32com.client.Dispatch('OpcLabs.EasyOpc.ServerDescriptor')
serverDescriptor.UrlString = 'opcae://localhost/OPCLabs.KitEventServer.2'
#serverDescriptor.ServerClass = 'OPCLabs.KitEventServer.2'

sourceDescriptor = win32com.client.Dispatch('OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor')
sourceDescriptor.QualifiedName = "Simulation.ConditionState1"

# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient') 

print('Getting condition state...')
conditionState = client.GetConditionState(serverDescriptor, sourceDescriptor, 'Simulated', [])

print('ConditionState:')
print('    .ActiveSubcondition: ', conditionState.ActiveSubcondition)
print('    .Enabled: ', conditionState.Enabled)
print('    .Active: ', conditionState.Active)
print('    .Acknowledged: ', conditionState.Acknowledged)
print('    .Quality: ', conditionState.Quality)
# Note that IAEConditionState has many more properties

print()
print('Finished.')
Rem This example shows how to obtain current state information for the condition instance corresponding to a Source and 
Rem certain ConditionName.

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 ConditionState: Set ConditionState = Client.GetConditionState(ServerDescriptor, SourceDescriptor, "Simulated", Array())
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

WScript.Echo "ConditionState:"
With ConditionState
    WScript.Echo Space(4) & ".ActiveSubcondition: " & .ActiveSubcondition
    WScript.Echo Space(4) & ".Enabled: " & .Enabled
    WScript.Echo Space(4) & ".Active: " & .Active
    WScript.Echo Space(4) & ".Acknowledged: " & .Acknowledged
    WScript.Echo Space(4) & ".Quality: " & .Quality
    Rem Note that IAEConditionState has many more properties
End With

 

 

In QuickOPC.NET, you can alternatively pass in a ServerDescriptor in place of machine name and server class arguments.

 

 

Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.AlarmsAndEvents.AEConditionState

Requirements

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

See Also

Reference

AEConditionState Members
OpcLabs.EasyOpc.AlarmsAndEvents Namespace