Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

GetConditionState exception

More
30 May 2023 12:24 #11774 by Quaintly3296
We talked with the opc server company and they implemented the GetConditionState function - everything works just fine now.
/close
The following user(s) said Thank You: support

Please Log in or Create an account to join the conversation.

More
01 Sep 2022 09:49 #11081 by support
Replied by support on topic GetConditionState exception
Thank you. If it is not confidential information, can you share which OPC server it is, ideally with its ProgID or CLSID? We have "error enhancing" feature that can hint future users as to what the possible cause of the error was.

Please Log in or Create an account to join the conversation.

More
01 Sep 2022 09:41 #11080 by Quaintly3296
Thanks for your suggestions

you were right, the server didnt implement this function.
The following user(s) said Thank You: support

Please Log in or Create an account to join the conversation.

More
20 Aug 2022 07:13 #11075 by support
Replied by support on topic GetConditionState exception
Hello.
I do not see anything apparently wrong with your code.

I suggest that you try experimenting:
1. Do you have other OPC A&E client? Can you use it to get condition states, and does it work?
2. Test the code with other OPC A&E Servers (including our test server that comes with QuickOPC). Does it work? (Some servers will not have sources at the root, so you may have to change the "" in BrowseSource to some area that does have nodes, but otherwise the approach is the same).

Best regards

Please Log in or Create an account to join the conversation.

More
19 Aug 2022 14:50 #11074 by Quaintly3296
Hi,
we would like to get a list of all acknowledges states ( so client is aware of conditions occured while not connected )
Our approach is to
1. browse all sources
2. query source conditions
3. get condition state

Step 1 and 2 give us the expected results
but GetConditionState always throw an exception
 OpcLabs.EasyOpc.Engine.NetApiResultException (0x80070057): OPC NET API error - result ID: E_INVALIDARG; IOPCEventServer.GetConditionState
+ The client method called (or event/callback invoked) was 'GetConditionState'.
   --- End of inner exception stack trace ---
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ErrorTransformingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.EasyAEClientCompositor.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.CompositeEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.DelegatingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.DelegatingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.DelegatingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.LicensingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.DelegatingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ErrorTransformingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.ForwardingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.Implementation.DelegatingEasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient.GetConditionState(ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName, Int64[] attributes)
   at OpcLabs.EasyOpc.AlarmsAndEvents.IEasyAEClientExtension.GetConditionState(IEasyAEClient client, ServerDescriptor serverDescriptor, AENodeDescriptor sourceDescriptor, String conditionName)
   at TestOPC.OPCConnector.OPCConnector.GetAcknowledgeStatus() in C:\WorkingSpace\Repositories\TestOPC\TestOPC\OPCConnector\OPCConnector.cs:line 227
 

Test code:
EasyAEClient _aeClient = new();
ServerDescriptor _aeServer = new( "localhost", "XXX" );
AENodeElementCollection alarmConditions = _aeClient.BrowseSources(_aeServer, "");
 
foreach( AENodeElement alarmCondition in alarmConditions )
{
	AEConditionElementCollection conditionList = _aeClient.QuerySourceConditions( _aeServer, alarmCondition.QualifiedName );
 
	foreach (AEConditionElement conditionElement in conditionList)
	{
		try
		{
			AEConditionState condition = _aeClient.GetConditionState( _aeServer, alarmCondition.QualifiedName, conditionElement.Name );
 
			Console.WriteLine("ConditionState:");
			Console.WriteLine("    .ActiveSubcondition: {0}", condition.ActiveSubcondition);
			Console.WriteLine("    .Enabled: {0}", condition.Enabled);
			Console.WriteLine("    .Active: {0}", condition.Active);
			Console.WriteLine("    .Acknowledged: {0}", condition.Acknowledged);
			Console.WriteLine("    .Quality: {0}", condition.Quality);
		}
		catch( Exception )
		{
			// ignored
		}
	}
}

is anything wrong with our approach ?

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.064 seconds