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 to write to a struct array

More
31 Jul 2021 17:03 #10083 by support
Hello.

Thank you very much for the additional information. But, one question remained unanswered - have you been able to make this Write using some other client? (and if so, can we can a Wireshark of that too)? Have you tried e.g. UaExpert?

Best regards

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

More
31 Jul 2021 13:51 #10082 by goosvanbeek
I'm using the KUKA OPC UA 2.0 server.

This browser does not support PDFs. Please download the PDF to view it: Download PDF

File Attachment:

File Name: QuickOpc.K...a.pcapng
File Size:63 KB


The server is running on the robot workstation in an isolated network. I don't have access to any other OPC UA server.

Remote access is not possible/allowed, so I enclosed a WireShark caption.

It contains the communication between the client and the server, reading/writing a struct array as described below.
; OPC UA STRUCT (KUKA KRL)
    STRUC STRC_BUNDLE_DIMENSION INT I_LENGTH, INT I_WIDTH, INT I_THICKNESS
    STRUC STRC_BUNDLE_INFO CHAR C_DESCR[20], STRC_BUNDLE_DIMENSION DIMENSION
    DECL STRC_BUNDLE_INFO STRC_ARRAY_BUNDLE_INFO[64]
// C# class
 internal class BundleDimension{
        public int Thickness{get;set;}
        public int Width    {get;set;}
        public int Length   {get;set;}
    }
    internal class BundleInfo{
        public string          Description    {get;set;}
        public BundleDimension BundleDimension{get;set;}
    }
Below the complete exception message.
OPC UA service result - {BadWriteNotSupported}. The server does not support writing the combination of value, status and timestamps provided.
+ A list of parts provided (or not provided) to the Write operation follows. Value: yes, index range: no, source timestamp: no, server timestamp: no.
+ The node descriptor used was: NodeId="ns=5;s=MotionDeviceSystem.ProcessData.STEU.$config.STRC_ARRAY_BUNDLE_INFO[64]".
+ The client method called (or event/callback invoked) was 'WriteMultiple'.

At the moment this is for test purposes only, but I hope to use it later.

Please let me know if you need more information.

Best regards,
Goos van Beek.
Attachments:

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

More
31 Jul 2021 08:06 #10081 by support
Hello,
thank you. The reason I asked is that we have fixed something in this area recently, but you already have the build with the fix.

I have additional questions:

1. Which OPC server are you connecting to?

2. Is there a chance you can expose its endpoint to us so that we can test from our side?

3. Is there a chance that we get hold of the server and test it here?

4. If not, will you be willing to capture a Wireshark trace of the communication between the client and the server?

5. Are you able to make this Write using some other client?

6. Is this the full error message (the one you reported)? Isn't it followed by a text (on a new line), similar to "+ A list of parts provided (or not provided) to the Write operation follows. ..."?

Best regards

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

More
30 Jul 2021 17:49 #10080 by goosvanbeek
My apologies, forget to mention it.
I'm using the latest Nuget version, 5.61.241

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

More
30 Jul 2021 04:34 #10074 by support
Hello,

which QuickOPC version and build you are using please?

Best regards

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

More
30 Jul 2021 00:56 #10073 by goosvanbeek
Hi support,

When I read the values of a struct array, the return value of client.ReadValue is a system.object[64].
var readValues = client.ReadValue(uaEndpointDescriptor, uaNodeDescriptor);
Each value is a UAGenericObject, of which I can update the value.

How can I save the updated values? I tried
var readValues = client.ReadValue(uaEndpointDescriptor, uaNodeDescriptor);
if(readValues is Array valueArray){
foreach(var value in valueArray){
    if(value is UAGenericObject uaGenericObject){
        var sequenceData = (SequenceData)((StructuredData)uaGenericObject.GenericData)?.FieldData["Elements"];
        if(!(sequenceData is null)){
            ((PrimitiveData)(sequenceData.Elements[0] as StructuredData)?.FieldData.Values.ElementAtOrDefault(1)).Value = "NEW VALUE";
        }
    }
}
var writeResult = client.WriteMultipleValues(new[]{
    new UAWriteValueArguments(uaEndpointDescriptor, uaNodeDescriptor, valueArray)
});
Console.WriteLine(writeResult[0]
    .ToString());
This results into a failure:
Failure Opc.UA.ServiceResult=0x80730000: OPC UA service result - {BadWriteNotSupported}. The server does not support writing the combination of value, status and timestamps provided.

Can you help me any further?

Regards,
Goos van Beek

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

Moderators: support
Time to create page: 0.067 seconds