- Posts: 343
- Thank you received: 4
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?
Michael
Please Log in or Create an account to join the conversation.
Michael
Please Log in or Create an account to join the conversation.
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:
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
Please Log in or Create an account to join the conversation.
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.
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.
Please Log in or Create an account to join the conversation.
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.
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.
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.
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.