- Posts: 5
- Thank you received: 2
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
- Quaintly3296
- Topic Author
- Offline
- Senior Member
/close
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Quaintly3296
- Topic Author
- Offline
- Senior Member
- Posts: 5
- Thank you received: 2
you were right, the server didnt implement this function.
Please Log in or Create an account to join the conversation.
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.
- Quaintly3296
- Topic Author
- Offline
- Senior Member
- Posts: 5
- Thank you received: 2
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.