OPCFoundation / UA-Java-Legacy

This repository is provided by OPC Foundation as legacy support for an Java version for OPC UA.
https://github.com/OPCFoundation/UA-.NETStandard
Other
354 stars 226 forks source link

GRANT 0.2 ETH(or BTC equivalent) - Writing to plc takes long #208

Open friko16 opened 3 years ago

friko16 commented 3 years ago

Hello guys, I need help, we got stuck in our project because of this. I am offering some Ethereum tip. My issue is that writing to plc takes too long time, around 2-3 seconds. When writing less values, like 2-3, then it takes shorter around 50ms, so it's seems it's linear dependent on the number of values. It blocks us. pseudo-code ( giving you idea how I am doing it ):

WriteValue[] _writeValues = new WriteValue[20];
// initializing writeValues with primitive opcua values..... below just one example of initializing the first value.
writeValues[0] = new WriteValue( // just one example of initializing first value
                    new NodeId(PlcGateway.namespaceIdx = 3, "NodePath.node.someNumber"),
                    Attributes.Value,
                    null,
                    new DataValue(new Variant(new UnsignedLong(2))
            );
SessionChannel sessionChannel; // initialized
sessionChannel.Write(writeValues);
jouniaro commented 3 years ago

Unfortunately, the OPC Foundation doesn't have any support services available, in fact. But in this case, the problem is 100% on the server side - you cannot perform the write any faster from the client, if you need to write all those changes.

friko16 commented 3 years ago

@jouniaro thank you for reply. The team writing software for PLC is pointing that it's probably an issue on our side ( the client who is writing to plc ). Is there a way to check out some PLC settings, e.g. with write speed or something ? How can we determine where is the problem ? Maybe it depends on plc configuration ?

jouniaro commented 3 years ago

You can use Wireshark to analyse the traffic and see how long it takes for the server to respond to your request. See https://www.prosysopc.com/blog/opc-ua-wireshark/ for details, for example.

friko16 commented 3 years ago

@jouniaro but I have measured it already inside my java app, by reading time right before and after writing the values. The PLC team still points to the java lib being the problem. Is measuring time by opc-ua-wireshark any better than my current approach with measuring time with java ?

jouniaro commented 3 years ago

Well, the Wireshark leaves your client side out of the question completely, so you can point out exactly how long it takes for the server to process the request.

friko16 commented 3 years ago

@jouniaro ohh thanks so much for pointing that out. I thought that maybe the problem is that I am sending those values in batch as list using the session.Write() method. I thought if I write the whole structure as one request ( not one by one in list, with primitive values as in the example in topic), by implementing serializer and deserializer, it would help. So you're saying that's not the case ?

jouniaro commented 3 years ago

Yes, I understood that you are making one Write call with several WriteValues in it. Then there is not much to optimise on your side.

kevinherron commented 3 years ago

@friko16 what PLC or server are you connecting to?