libplctag / libplctag.NET

A .NET wrapper for libplctag.
https://libplctag.github.io/
Mozilla Public License 2.0
194 stars 50 forks source link

Read Performance for Numerous Tags #345

Closed noumanqaiser closed 1 year ago

noumanqaiser commented 1 year ago

This library is an amazing peice of work, Thank you for this.

I had a question about read performance. In the application I am working on, I need to read >100tags from a PLC very often(every second).

I understand that the Tag.Read() function would create an underlying connection with plc, read that tag and close the connection. When reading a large number of tags, would constantly opening/closing connection add in to the time needed/compute resources on PLC end?

To make this read process efficient, Is there a way that you can keep a connection open while you read a ton of tags and then close at once?

timyhac commented 1 year ago

That assumption is incorrect - libplctag will keep a TCP and an EIP connection open in between successive calls (as long as you don't Dispose of the tag, or call LibPlcTag.Shutdown().

Performance is often discussed here so you should be able to find other info around. Here is one post that is relevant: https://github.com/libplctag/libplctag/issues/413#issuecomment-1426545823