Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [milo-dev] OPC UA structure bug - where could be problem?

Yes there is absolutely a difference. The field name you pass to readFloatArray does nothing in the binary encoding, it's entirely order based. You could pass null and it wouldn't matter. 

I think the name only matters when the encoding is XML. 

On Wed, Mar 17, 2021 at 6:13 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
You really mean „order“ like there is difference if I do this:
Float[] speedArray = decoder.readFloatArray("speed");
Float[] torqueArray = decoder.readFloatArray("torque");
or this:
Float[] torqueArray = decoder.readFloatArray("torque");
Float[] speedArray = decoder.readFloatArray("speed");
? It seams like that. 

Jakub Znamenáček
On 17. 3. 2021 13:59 +0100, Kevin Herron <kevinherron@xxxxxxxxx>, wrote:
And if they don't match, for example if they are reversed, then it's because you are decoding the fields in the wrong order.

On Wed, Mar 17, 2021 at 5:56 AM Kevin Herron <kevinherron@xxxxxxxxx> wrote:
Yes, if you give the server different values for each array then when setting a breakpoint in this part of the code they should match what the server has.

On Wed, Mar 17, 2021 at 5:53 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
If I correctly understood how UaStructure works than
@Override
public CurveStructure decode(
        SerializationContext context,
        UaDecoder decoder) throws UaSerializationException {

    Float[] torqueArray = decoder.readFloatArray("torque");
    Float[] speedArray = decoder.readFloatArray("speed");

    return new CurveStructure(torqueArray,speedArray);
}

When I put break point on return and check the server the torqueArray should have values of torque. This is  the point where I read data from server.  I don’t know where could I make mistake (of course it was my first idea that I just switch those two by accident).

Or am I wrong Is there another part of code where I could make mistake? My understanding was that this is the „lowest“ part of the conversion.

Jakub Znamenáček
On 17. 3. 2021 13:47 +0100, Kevin Herron <kevinherron@xxxxxxxxx>, wrote:
Well, yes it was what I mean but unfortunately it has a Null value.

I'm trying to view the server's definition of the structure. What I keep trying to tell you is that you have hand-coded this structure to match instead of using dynamic codecs and you have likely just put the 2 fields in the wrong order.

On Wed, Mar 17, 2021 at 5:43 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
I hope this is what you mean:

<image001.png>

Jakub Znamenáček
On 17. 3. 2021 13:41 +0100, Kevin Herron <kevinherron@xxxxxxxxx>, wrote:
Can you follow the reference to the "DictionaryFragment" Property Node and view its value in UaExpert?

On Wed, Mar 17, 2021 at 5:32 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
I am sorry but I am not sure I understand. I went trough all java code and I didn’t found any bug there. Could you explain me in more details where could be the problem? You think it is in my java code or on the server side  (I know you wrote that you think that server is not problem). I didn’t created this variable on server so I don’t know how exactly it was created.

This is screenshot from UaExpert. But I don’t know what to check there (I am still beginner with OPC UA)

<image001.png>

Jakub Znamenáček
On 17. 3. 2021 13:14 +0100, Kevin Herron <kevinherron@xxxxxxxxx>, wrote:
I don't think it's a problem with the server, I think you've written the fields in the wrong way.

You would need to check the server's DataTypeDictionary or if it's a 1.04 server maybe the DataType Node for this type has a definition attribute on it.

On Wed, Mar 17, 2021 at 4:57 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
Hi Kevin,

So you think there could be problem on server side? I don’t have possibility to test it with another server unfortunately. Is there any way how to check it using UaExpert? 

Jakub Znamenáček
On 17. 3. 2021 12:49 +0100, Kevin Herron <kevinherron@xxxxxxxxx>, wrote:
Jakub,

Did you hand-code these definitions against some other server? I can only imagine that this is happening because the fields are encoded/decoded in the wrong order in your Codec implementation.

_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
On Wed, Mar 17, 2021 at 1:46 AM Jakub Znamenáček <znamenacekjakub@xxxxxxxxx> wrote:
Hi,

I am trying to read custom datatype over OPC UA and everything is working great except that my values are mixed up. 

When I use this for decoding:
@Overridepublic CurveStructure decode(        SerializationContext context,        UaDecoder decoder) throws UaSerializationException {    Float[] torqueArray = decoder.readFloatArray("torque");    Float[] speedArray = decoder.readFloatArray("speed");    return new CurveStructure(torqueArray,speedArray);}
I end up with torque values in speedArray and speed values in torqueArray. But using UaExpert for browsing the values for speed are named correctly (BrowseName is "speed“). Does anyone have idea where could be problem?

Whole code can be found here: https://github.com/bzumik1/metalForming/blob/master/src/main/java/com/siemens/metal_forming/connection/opcua/structure/CurveStructure.java


Jakub Znamenáček
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev

Back to the top