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.

How can I get the OPC item type? Can I get it with a read?

More
27 Feb 2024 18:39 #12596 by micham
Thank you! This was helpful.

Michael
The following user(s) said Thank You: support

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

More
27 Feb 2024 18:38 #12595 by micham

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

More
26 Feb 2024 13:52 #12590 by support
Hello,

OPC UA has built-in types (usually atomic), and then structured types. Some structured types are defined in the standard. And, the server can define its own types too (usually structured types).

So, the types you are seeing are also valid types. They are complex (structured) data types defined by the particular server.

reference.opcfoundation.org/Core/Part3/v105/docs/8

The built-in types are all in namespace 0, and have specific numeric node Id with low numbers. Ids of all types from the specification are in the UADataTypeIds class. And the integer codes are actually also identical with following enumeration:
    [ComVisible(true)]
    [Description("OPC-UA built-in type.")]
    [Designable]
    [DisplayName2("OPC-UA Built-In Type")]
    [Guid("56090438-D3B2-4BE0-A723-85576884EC55")]
    public enum UABuiltInType
    {
        /// <summary>
        /// An invalid or unspecified value. Enum value is 0.
        /// </summary>
        [Description("An invalid or unspecified value. Enum value is 0.")]
        Null = 0,
 
        /// <summary>
        /// A boolean logic value (true or false). Enum value is 1.
        /// </summary>
        [Description("A boolean logic value (true or false). Enum value is 1.")]
        Boolean = 1,
 
        /// <summary>
        /// An 8 bit signed integer value. Enum value is 2.
        /// </summary>
        [Description("An 8 bit signed integer value. Enum value is 2.")]
        SByte = 2,
 
        /// <summary>
        /// An 8 bit unsigned integer value. Enum value is 3.
        /// </summary>
        [Description("An 8 bit unsigned integer value. Enum value is 3.")]
        Byte = 3,
 
        /// <summary>
        /// A 16 bit signed integer value. Enum value is 4.
        /// </summary>
        [Description("A 16 bit signed integer value. Enum value is 4.")]
        Int16 = 4,
 
        /// <summary>
        /// A 16 bit signed integer value. Enum value is 5.
        /// </summary>
        [Description("A 16 bit signed integer value. Enum value is 5.")]
        UInt16 = 5,
 
        /// <summary>
        /// A 32 bit signed integer value. Enum value is 6.
        /// </summary>
        [Description("A 32 bit signed integer value. Enum value is 6.")]
        Int32 = 6,
 
        /// <summary>
        /// A 32 bit unsigned integer value. Enum value is 7.
        /// </summary>
        [Description("A 32 bit unsigned integer value. Enum value is 7.")]
        UInt32 = 7,
 
        /// <summary>
        /// A 64 bit signed integer value. Enum value is 8.
        /// </summary>
        [Description("A 64 bit signed integer value. Enum value is 8.")]
        Int64 = 8,
 
        /// <summary>
        /// A 64 bit unsigned integer value. Enum value is 9.
        /// </summary>
        [Description("A 64 bit unsigned integer value. Enum value is 9.")]
        UInt64 = 9,
 
        /// <summary>
        /// An IEEE single precision (32 bit) floating point value. Enum value is 10.
        /// </summary>
        [Description("An IEEE single precision (32 bit) floating point value. Enum value is 10.")]
        Float = 10,
 
        /// <summary>
        /// An IEEE double precision (64 bit) floating point value. Enum value is 11.
        /// </summary>
        [Description("An IEEE double precision (64 bit) floating point value. Enum value is 11.")]
        Double = 11,
 
        /// <summary>
        /// A sequence of Unicode characters. Enum value is 12.
        /// </summary>
        [Description("A sequence of Unicode characters. Enum value is 12.")]
        String = 12,
 
        /// <summary>
        /// An instance in time. Enum value is 13.
        /// </summary>
        [Description("An instance in time. Enum value is 13.")]
        DateTime = 13,
 
        /// <summary>
        /// A 128-bit globally unique identifier. Enum value is 14.
        /// </summary>
        [Description("A 128-bit globally unique identifier. Enum value is 14.")]
        Guid = 14,
 
        /// <summary>
        /// A sequence of bytes. Enum value is 15.
        /// </summary>
        [Description("A sequence of bytes. Enum value is 15.")]
        ByteString = 15,
 
        /// <summary>
        /// An XML element. Enum value is 16.
        /// </summary>
        [Description("An XML element. Enum value is 16.")]
        XmlElement = 16,
 
        /// <summary>
        /// An identifier for a node in the address space of a UA server. Enum value is 17.
        /// </summary>
        [Description("An identifier for a node in the address space of a UA server. Enum value is 17.")]
        NodeId = 17,
 
        /// <summary>
        /// A node id that stores the namespace URI instead of the namespace index. Enum value is 18.
        /// </summary>
        [Description("A node id that stores the namespace URI instead of the namespace index. Enum value is 18.")]
        ExpandedNodeId = 18,
 
        /// <summary>
        /// A structured result code. Enum value is 19.
        /// </summary>
        [Description("A structured result code. Enum value is 19.")]
        StatusCode = 19,
 
        /// <summary>
        /// A string qualified with a namespace. Enum value is 20.
        /// </summary>
        [Description("A string qualified with a namespace. Enum value is 20.")]
        QualifiedName = 20,
 
        /// <summary>
        /// A localized text string with a locale identifier. Enum value is 21.
        /// </summary>
        [Description("A localized text string with a locale identifier. Enum value is 21.")]
        LocalizedText = 21,
 
        /// <summary>
        /// An opaque object with a syntax that may be unknown to the receiver. Enum value is 22.
        /// </summary>
        [Description("An opaque object with a syntax that may be unknown to the receiver. Enum value is 22.")]
        ExtensionObject = 22,
 
        /// <summary>
        /// A data value with an associated quality and timestamp. Enum value is 23.
        /// </summary>
        [Description("A data value with an associated quality and timestamp. Enum value is 23.")]
        DataValue = 23,
 
        /// <summary>
        /// Any of the other built-in types. Enum value is 24.
        /// </summary>
        [Description("Any of the other built-in types. Enum value is 24.")]
        Variant = 24,
 
        /// <summary>
        /// Diagnostic information associated with a result code. Enum value is 25.
        /// </summary>
        [Description("Diagnostic information associated with a result code. Enum value is 25.")]
        DiagnosticInfo = 25,
 
        /// <summary>
        /// Any numeric value. Enum value is 26.
        /// </summary>
        [Description("Any numeric value. Enum value is 26.")]
        Number = 26,
 
        /// <summary>
        /// A signed integer. Enum value is 27.
        /// </summary>
        [Description("A signed integer. Enum value is 27.")]
        Integer = 27,
 
        /// <summary>
        /// An unsigned integer. Enum value is 28.
        /// </summary>
        [Description("An unsigned integer. Enum value is 28.")]
        UInteger = 28,
 
        /// <summary>
        /// An enumerated value. Enum value is 29.
        /// </summary>
        [Description("An enumerated value. Enum value is 29.")]
        Enumeration = 29
    }
}

So, in principle, you could recognize the built-in type if following conditions are all true:
- the namespace index is zero (.NamespaceIndex = 0), and
- the data type Id is numeric (.NodeIdType = UANodeIdType.UANodeIdType.Numeric), and
- the numeric identifier is less than or equal to 29 (.NumericIdentifier <= 29).

Regards
The following user(s) said Thank You: micham

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

More
26 Feb 2024 09:39 #12589 by micham
Hi,

In general the code works well and I get the data type such as Double, Boolean etc... but for some items I get the data types below:

nsu=urn:DEV2017:UnifiedAutomation:UaServerCpp ;ns=1;g=134100ec-ce0e-4d61-8d37-f1511b6faa8d
nsu=urn:UnifiedAutomation:CppDemoServer:BuildingAutomation ;ns=3;i=8

I assume that these are not a valid data type. Is it possible to programmatically identify these items and avoid adding them to my group?

Thank you.

Michael

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

More
26 Feb 2024 09:02 #12588 by support
Hello.

In OPC DA, you use GetPropertyValue or GetMultiplePropertyValues, with DAPropertyIds.DataType.

opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Late...f%20multiple%20properties.html
Look at "Example combined with item browsing".

Or

opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Late...%20of%20single%20property.html
Look at "Example with type casting"

I hope this helps.
The following user(s) said Thank You: micham

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

More
26 Feb 2024 08:58 #12587 by micham
Hi,

I have managed to use the code. It works fine. Thank you!

Do you have a similar code for OPC DA?

Thank you.

Michael

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

More
25 Feb 2024 15:47 #12586 by micham
Hi,

It looks promising but:

1. I need to add the items programmatically. In this example: the OPC items are fixed (see below).

valueResultArray = IEasyUAClientExtension.ReadMultipleValues(client, [
UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10845'),
UAAttributeId.DataType),
UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853'),
UAAttributeId.DataType),
UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10855'),
UAAttributeId.DataType),
])

2. I need it also for OPC DA. Do you have something similar for DA?

Thank you.

Michael

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

More
25 Feb 2024 08:54 #12585 by support
Hello.

does this help?

opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Late...d%20DataType%20attributes.html

(the comments at the top of the example code are not correct, they talk about Value attribute, but it should say DataType attribute).
Best regards

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

More
24 Feb 2024 15:38 #12584 by micham
How can I get the OPC item type?

For example: Boolean, Byte, Double, DateTime etc...
Can I get it with a read?

Thank you.

Michael

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

Moderators: support
Time to create page: 0.108 seconds