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.

UAAttributeData ValueType.Name

More
17 Aug 2023 05:38 #12021 by support
Hello.

AFAIK, according to OPC UA specifications, for String, ByteString, and arrays of any type, Null value and an empty value (non-Null value with zero elements) should be treated the same by the receiving side. So, your code needs to be written in such way.

Because of this rule, in theory we could "coalesce" all such values, on the receiving side in the component, consistently to either all Null-s, or all "empty" values, so that the user code can be simplified. Will consider it. But the way it works now is per design, not an omission.

Best regards

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

More
16 Aug 2023 20:35 #12020 by falseSeige
Yes, you are correct, I did mean AttributeData.Value was null, not UAAttributeData.

I am connecting to a Kepware Server. Thank you for the links to the articles, they helped me to track down and fix the issue for all data types except the string. For this particular application I am reading the tag addresses dynamically, so simply appending the data type to the tag address worked - for example: Subscribed node: nsu=[ServerClass];ns=2;s=[Channel].[Device].TestBoolean@BOOLEAN

For the string datatype in the processor, I tested '' value and 'TEST' value. For the dynamic string tags I'm supplying the node as nsu=[ServerClass];ns=2;s=[Channel].[Device].TestString.DATA/20. If the tag is '' (empty) I get a null AttributeData.ValueType, if there is a value, for example 'TEST', AttributeData.ValueType = System.String. I guess the '' (empty) value is treated as NULL and not an empty string and that is why AttributeData.ValueType is null?

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

More
16 Aug 2023 05:08 #12005 by support
Hello.

QuickOPC does some manipulations to data types - see opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ata%20Types%20in%20OPC-UA.html .

If you want to reliably determine the data type of certain node, read its DataType attribute, see e.g.: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...d%20DataType%20attributes.html .

However, *none* of the transformations described in the article is what you are observing. It seems like a buggy server. Which OPC server are you connecting to?

Besides, the following statement stands out of the other ones:

'For String tags, the UAAttributeData returns null if the string is empty ...". Didn't you mean AttributeData.Value? AttributeData, as a whole, is null only if the reading actually *failed*, i.e. there will be an associated Exception describing the cause. AttribtueData.Value, however, can be null even if the reading succeeded, if null is what the server returned for the value.

Best regards
The following user(s) said Thank You: falseSeige

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

More
15 Aug 2023 22:34 #12004 by falseSeige
Hello,
I am using OPCLabs.QuickOPC (5.62.456) in .NET to read several tags via UA and accessing the UAAttributeData for the Value, DisplayValue, and ValueType.Name. I'm reading tags of Data Types Int16, String, Boolean, Float. When I examine ValueType.Name that is returned, the ValueType is only correct for a string tag, if the string is not empty, or the tag is of float datatype.
For Boolean and Int16 tags the .NET type returned is System.Single.
For the Float tags the .NET type returned is also System.Single (this is correct).
For String tags, the UAAttributeData returns null if the string is empty, but correctly shows a string datatype if the string is not null.
Is there something I'm missing or doing incorrectly?

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

Moderators: support
Time to create page: 0.085 seconds