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.
OPC UA Write Exception
QuickOPC for UA does not automatically create subscriptions for reads or writes, therefore the parameters you needed to tweak for that purpose in "Classic" QuickOPC do not apply and are not needed. We do automatically create one subscription per session, but that is independent of the reads/writes, and has to do with checking of the server status, as mandated by the OPC compliance conditions. It is possibly to turn it off, but I do not recommend it unless there is a reason.
There is currently no way to set the timeout on UA operations with just a single number, as it were in QuickOPC "Classic". There are internal timeouts on various parts of the process (e.g. discovery, session creation, some communication timeouts). If you intended to tweak the timeout to prevent the connection timeout error, then it probably won't help, because 1 minute is already quite a long time, so there is probably something more at play than just a "slowness".
Regards
Please Log in or Create an account to join the conversation.
I will answer your other questions separately.
Please Log in or Create an account to join the conversation.
We're fairly worried about the change to OPC UA, it seems that the EasyUAClient is less likely to recover from a fault (i.e. Server has stopped publishing). We also very often get this error:
An OPC-UA operation failure with error code -1 (0xFFFFFFFF) occurred, originating from ''. The inner exception, of type 'OpcLabs.EasyOpc.UA.Engine.UAClientEngineException', contains details about the problem.
Timeout connecting the OPC-UA client session. The total timeout value was 60000 milliseconds, and we have waited for 0 milliseconds. The actual waiting time is lower than the total timeout (or even zero) if the connection operation has already started earlier.
We find that writes and reads generally take longer than with the DA client.
With the DA client we have a lot of setup code to increase timeouts and prevent caching and subscriptions, but we're unaware as to how to implement this with the UA client:
// Prevent creation of subscriptions on read
EasyDAClient.SharedParameters.Topic.SlowdownWeight = 0.0f;
EasyDAClient.SharedParameters.Topic.SpeedupWeight = 0.0f;
_opcClient = new EasyDAClient() { Isolated = true };
// Force asynchronous read/writes
_opcClient.InstanceParameters.Mode.DesiredMethod = OpcLabs.EasyOpc.DataAccess.Engine.DAReadWriteMethod.Asynchronous;
_opcClient.InstanceParameters.Mode.AllowAsynchronousMethod = true;
_opcClient.InstanceParameters.Mode.AllowSynchronousMethod = false;
// Reduce timeouts on Async methods
_opcClient.InstanceParameters.Timeouts.ReadItem = 60000;
_opcClient.InstanceParameters.Timeouts.WriteItem = 60000;
// Prevent creation of subscriptions on read
_opcClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
_opcClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;
Is there anyway we can do this using UA too, as I cannot see how to add these options.
Please Log in or Create an account to join the conversation.
Do I understand it correctly that the effects on the server are the same even if you do the Write using the UA Expert, and that the only difference is that the UA Expert does not show you any error from the Write?
Please Log in or Create an account to join the conversation.
I agree regarding the more restrictive writing in UA when it comes to data types, I found myself in a situation where attempting to write a C# object without specifying the type resulted in a BadTypeMismatch error hence the changing of the code which has led to this.
The written item in this case is a boolean, the DataType in the OPC Server and UA expert appears as Boolean, a one liner of how we write is:
EasyUAClient.WriteValue(
new UAWriteValueArguments(
new UAEndpointDescriptor(<string>),
new UANodeDescriptor(<string>),
true <o-bject {bool}>,
Boolean <System.Type>))
Please Log in or Create an account to join the conversation.
" at OpcLabs.EasyOpc.UA.Toolkit.UAClientSession.WriteAttributes(UAWriteEntry[] writeEntryArray, Exception[]& exceptionArray, UAWriteOutcome[]& outcomeArray, List`1[]& warningsArray)\r\n at OpcLabs.EasyOpc.UA.Engine.EasyUAEngine.InternalWriteList(UASmartSession smartSession, List`1 writeList, UAWriteResult[] writeResultArray)\r\n at OpcLabs.EasyOpc.UA.Engine.EasyUAEngine.WriteList(EasyUASession session, List`1 writeList, UAWriteResult[] writeResultArray)\r\n at OpcLabs.EasyOpc.UA.Engine.EasyUAEngine.Write(ICollection`1 writeListDictionary, UAWriteResult[] writeResultArray)\r\n at OpcLabs.EasyOpc.UA.Engine.EasyUAEngine.WriteAttributes(UAWriteArguments[] writeArgumentsArray, EasyUAAdaptableParameters easyUAAdaptableParameters)\r\n at OpcLabs.EasyOpc.UA.EasyUAClient.DisposeGuard[TResult](Func`1 func)\r\n at OpcLabs.EasyOpc.UA.EasyUAClient.DisposeGuardNotNull[TResult](Func`1 func)\r\n at OpcLabs.EasyOpc.UA.EasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)\r\n at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteMultipleValues(IEasyUAClient easyUAClient, UAWriteValueArguments[] writeValueArgumentsArray)\r\n at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteValue(IEasyUAClient easyUAClient, UAWriteValueArguments writeValueArguments)\r\n at OpcService.OpcUaExtensions.WriteItem(KeyValuePair`2 refs, Boolean rethrow)\r\n at OpcService.OpcExtensions.ProcessList(Queue`1 actions)\r\n at OpcService.Jobs.RtuData._opcExtensions_ThrowEvent(Object sender, OperationEventArgs e)\r\n at OpcService.OpcUaExtensions.EasyUAMonitoredItemChangedEventHandler.Invoke(Object sender, EasyUAMonitoredItemChangedEventArgs args)\r\n at OpcService.OpcUaExtensions.OpcClient_ItemChanged(Object sender, EasyUAMonitoredItemChangedEventArgs e)\r\n at OpcLabs.BaseLib.ComponentModel.NotifyingComponent.SafeCallback(String name, Action action)\r\n at OpcLabs.BaseLib.ComponentModel.NotifyingComponent.Raise[TEventArgs](Handler`1 handler, TEventArgs eventArgs)\r\n at OpcLabs.EasyOpc.UA.EasyUAClient.RaiseMonitoredItemChanged(EasyUAMonitoredItemChangedEventArgs eventArgs)\r\n at OpcLabs.EasyOpc.UA.Engine.EasyUAEngine.OnMonitoredItemNotification(UASmartMonitoredItem smartMonitoredItem, Exception exception, UAAttributeData attributeData, List`1 warnings)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UASmartEngine.OnMonitoredItemNotification(UAClientMonitoredItem clientMonitoredItem, Exception exception, UAAttributeData attributeData, List`1 warnings)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UAClientSessionBase.OnMonitoredItemNotification(UAClientMonitoredItem clientMonitoredItem, Exception exception, UAAttributeData attributeData, List`1 warnings)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscription.OnMonitoredItemNotification(UAClientMonitoredItem clientMonitoredItem, Exception exception, UAAttributeData attributeData, List`1 warnings)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UAClientMonitoredItem.SendNotification(Exception exception, MonitoredItemNotification sdkMonitoredItemNotification)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UAClientMonitoredItem.OnSdkNotification(MonitoredItem sdkMonitoredItem, MonitoredItemNotificationEventArgs sdkMonitoredItemNotificationEventArgs)\r\n at OpcLabs.EasyOpc.UA.Toolkit.UAEngineBase.SdkCallbackEnvelope(Func`1 usingFunction, String name, Action callback)\r\n at Opc.Ua.Client.MonitoredItem.SaveValueInCache(IEncodeable newValue)\r\n at Opc.Ua.Client.Subscription.SaveDataChange(NotificationMessage message, DataChangeNotification notifications, IList`1 stringTable)\r\n at Opc.Ua.Client.Subscription.OnMessageRecieved(Object state)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()\r\n at System.Threading.ThreadPoolWorkQueue.Dispatch()"
Please Log in or Create an account to join the conversation.
Have you tried to make the Write using other OPC client (UA Expert)? Does it work?
To explain the situation: The error you are getting is either (1) originating in the server, and we are simply passing it over to you, or (2) can also be that something went on the client side (in this case, because it *does* something on the server, it would be that something went bad during processing of the response). In our own code, we never "substitute" a UA status code (and even less such generic, noninformative one) for an error - we always throw a different exception kind, and with a meaningful description, to make it possible to differentiate from case (1). Unfortunately, we also rely on OPC UA stack code from OPC Foundation, and there are places in that code where such error is generated on the client side of things. That's why I at the moment cannot tell from sure whether the origins are in the server or the client.
There, is, however, one common issue with Write-s, and that is with the data types. OPC UA is more restrictive about the types than "Classic" OPC - it does not require the server to convert the value. QuickOPC attempts to figure out the proper type and convert the value to it before writing, but I can imagine that a problem may be there.
What data type is the tag?
And, how do you write to it - can you please post the piece of code? (There are several overloads of Write methods, and they differ in the way they handle data types).
Many thanks
Please Log in or Create an account to join the conversation.
2. It seems that the write does occur, regardless of whether we've had the exception returned or not. If we view the current value of the tag simultaneously using UA Expert, the status code is 'Good' until it has been written to. Once we write to it, the status code goes to 'Bad' the value and the data type become Null.
3. We'll work on capturing the call stack, for the moment we do not have it.
Please Log in or Create an account to join the conversation.
Some questions:
1. Does reading work fine?
2. Do I understand it correctly that you always get this error when trying to write anything? I.e. you are unable to write at all?
3. Can you capture the call stack of the exception?
Thank you
Please Log in or Create an account to join the conversation.
WriteValue(new UAWriteValueArguments(serverDescriptor, itemDescriptor, refs.Value, refs.Key.ItemType))
Exception:
An OPC-UA operation failure with error code -2147418112 (0x80010000) occurred, originating from 'OpcLabs.EasyOpcUAInternal'. The inner OPC-UA service exception with service result 'BadUnexpectedError' contains details about the problem.
Inner:
OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
StatusCode: {BadUnexpectedError} = 0x80010000 (2147549184)
Exception:
An OPC-UA operation failure with error code -2147483648 (0x80000000) occurred, originating from 'OpcLabs.EasyOpcUAInternal'. The inner OPC-UA service exception with service result 'Bad' contains details about the problem.
Inner:
OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
StatusCode: {Bad} = 0x80000000 (2147483648)
Can you shed any light on this?
Regards,
Seb
Please Log in or Create an account to join the conversation.