How to Read Tags from Rockweell PLC Fast? Or how do it RSLinx?

mikeav

Member
Join Date
Mar 2019
Location
Kaluga
Posts
21
Task Description:

Currently I am working on a program in C # for reading data from RSLogix5000 Series controllers (v18.11). The idea is to do without the RSLinx OPC servers.
The program successfully works using the recommended mechanisms described in manual 1756-pm020 from Rockwell.
(https://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm020_-en-p.pdf)
Everything is fine, but with a large number of tags, the Update Rate greatly increases even using a Multiply Service Request.
I studied using Wireshark how the exchange between RSLinx and PLC occurs during the exchange of tag reading via OPC connection with the server and it can be seen that it is completely different.
You can see that RSLinx creates a class:
Class (0xb2) - Create
And then works with this class 0xb2 using the service 0x4C.
It can be seen that for one such request the controller sends all tag values ​​in one package.

Question:
1. Can anyone help me how the communication mechanism between the PLC and RSLinx is built?
2. Is there any documentation on the classes of the RSLogix5000 series controllers?
Tried to search Google - found nothing ... I really need your help.
Thank you in advance.
 
RSLinx uses an undocumented service in which it seems to create an object to transmit a block of data from various tags. Almost like a multi-read request.

How fast do you want to read the tags? I've benchmarked the AdvancedHMI CLX driver reading as fast as 0.5ms with an L8x processor, but more typically 5ms on L7x and CompactLogix processors. If you stay within that 500 byte packet limit, then you can read all of your variables at those rates.
 
Nowadays I want to Create Registrator of tags values to *.csv file (almost realtime). I Already did it but based on OPC connection with RSLinx. It works perfect, but nowadays on production area I have some PC without RSLinx Classic, therefore I need create the same tool but without RSLinx.

My target of reading is so much Fast. I was very upset when reading 250 tags, my Software updated the tag for 270ms (was used Multiply Service Request by ~10 tags) and the RSLinx mechanism did it for 40ms!

Of cause, maybe, the solution is to use ReadFragment, it will fast, but for my task is not convenient.
 
I was trying to figure out the exact same thing earlier, I am at the point where I checked the comm with wireshark already, and came up with nothing but where you are. I couldn't figure out how to decode the algorithm proprietary to Rockwell,

But then I found out about this: https://github.com/kyle-github/libplctag

I haven't tried it yet, but according to the description this is exactly what you need. Ethernet->PC.

On the other hand, you can also use DDE to actually transfer data from RSLinx to say excel. Can't really change the transfer rates beyond a certain point, but it's as simple as Ctrl+C, Ctrl+V.

Thanks!
-PeeLC
 
I wrote my own CIP driver a couple years ago. It supports the larger 4k(EN2TR EN3TR) packet size as well as the older 500 byte size. Not sure why you are experiencing a delay like that. Are actually grouping the tags in the Ethernet packet? Post up a capture file from wireshark.
 
SD_Scott!

I just made exhange with my PLC with captures by two ways
1. My driver.
2. RSLinx driver.

Also tags is the same.
Captures of Wireshark and tag list here (I uploaded to cloud): https://yadi.sk/d/LuSofAKfYhG1uA

I tried ti extend paket for request but after PLC not answer (CompactLogix L23E).
Could you write idea how you did large request to PLC?

PeeLC, thanks a Lot for Link! I started to study it!
 
Last edited:
SD_Scott!

I just made exhange with my PLC with captures by two ways
1. My driver.
2. RSLinx driver.

Also tags is the same.
Captures of Wireshark and tag list here (I uploaded to cloud): https://yadi.sk/d/LuSofAKfYhG1uA

I tried ti extend paket for request but after PLC not answer (CompactLogix L23E).
Could you write idea how you did large request to PLC?

PeeLC, thanks a Lot for Link! I started to study it!

I'm on a box without wireshark. Can you post the text version. Also Archie is correct RSLinx does it differently. I would recommend using another "more generic product" to view the packets.
 
I'm on a box without wireshark. Can you post the text version. Also Archie is correct RSLinx does it differently. I would recommend using another "more generic product" to view the packets.

Never mind I found an online wireshark analyzer.

I looked and there are multiple sends and receives. Just post the multiple read request. Text if you can.
 
Last edited:
Nowadays I want to Create Registrator of tags values to *.csv file (almost realtime). I Already did it but based on OPC connection with RSLinx. It works perfect, but nowadays on production area I have some PC without RSLinx Classic, therefore I need create the same tool but without RSLinx.

My target of reading is so much Fast. I was very upset when reading 250 tags, my Software updated the tag for 270ms (was used Multiply Service Request by ~10 tags) and the RSLinx mechanism did it for 40ms!

Of cause, maybe, the solution is to use ReadFragment, it will fast, but for my task is not convenient.
Since you mentioned C# I assume you already have and use Visual Studio. Here is a test that will take you less than 10 minutes to try. I will be surprised if this tag reading is not faster than RSLinx:

1) Download and extract the latest AdvancedHMI. Get the beta version from here:
https://www.advancedhmi.com/forum/index.php?topic=2058.120

2) Open the AdvancedHMI solution in Visual Studio
3) Build the solution
4) Open the MainForm
5) From the Toolbox, add an EthernetIPforCLXCom to the form
6) Set the IPAddress property
7) Double click the form to get to the Load event handler.
8) Enter this code (modifying the tag list to your tags:
Code:
        Dim Tags(2) As String
        Tags(0) = "Tag1"
        Tags(1) = "Tag2"
        Tags(2) = "Tag3"

        EthernetIPforCLXCom1.BeginReadMultiple(Tags)
9) Then add this code to handle the DataReceived event:
Code:
    Private Sub EthernetIPforCLXCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.DataReceived
        Console.WriteLine(e.PlcAddress & "=" & e.Values(0))
    End Sub
10) Run the application and see how fast it reads and returns the data

You may want to add a system clock time stamp before calling the read and at each return of data so you can see the speed in the console window. If you had written your own C# driver, I will not go into details of how to do that.
 
I believe the "large packet request" is established on the forward open frame. The normal ~500 byte packet service is 0x54. The large packet format is service 0x5b. There are may be changes that need to be made to the TO/OT connection parameter as well.
 
I believe the "large packet request" is established on the forward open frame. The normal ~500 byte packet service is 0x54. The large packet format is service 0x5b. There are may be changes that need to be made to the TO/OT connection parameter as well.

Yes, it is done in the forward open request.
 
Since you mentioned C# I assume you already have and use Visual Studio. Here is a test that will take you less than 10 minutes to try. I will be surprised if this tag reading is not faster than RSLinx:

1) Download and extract the latest AdvancedHMI. Get the beta version from here:
https://www.advancedhmi.com/forum/index.php?topic=2058.120

2) Open the AdvancedHMI solution in Visual Studio
3) Build the solution
4) Open the MainForm
5) From the Toolbox, add an EthernetIPforCLXCom to the form
6) Set the IPAddress property
7) Double click the form to get to the Load event handler.
8) Enter this code (modifying the tag list to your tags:
Code:
        Dim Tags(2) As String
        Tags(0) = "Tag1"
        Tags(1) = "Tag2"
        Tags(2) = "Tag3"

        EthernetIPforCLXCom1.BeginReadMultiple(Tags)
9) Then add this code to handle the DataReceived event:
Code:
    Private Sub EthernetIPforCLXCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.DataReceived
        Console.WriteLine(e.PlcAddress & "=" & e.Values(0))
    End Sub
10) Run the application and see how fast it reads and returns the data

You may want to add a system clock time stamp before calling the read and at each return of data so you can see the speed in the console window. If you had written your own C# driver, I will not go into details of how to do that.

Thank you so much! Just after 10 min I will try it!
But for For clarification, I meant if there are 250 tags, then the packets will be sent.
#1. (tags 0 ... 14).
#2. (tags 15 ... 30).
....
# N. (tags 235 ... 250)
270ms is the time to return the update package # 1.
PLC time reply is ~6ms.
 
Thank you so much! Just after 10 min I will try it!
But for For clarification, I meant if there are 250 tags, then the packets will be sent.
#1. (tags 0 ... 14).
#2. (tags 15 ... 30).
....
# N. (tags 235 ... 250)
270ms is the time to return the update package # 1.
PLC time reply is ~6ms.

i can see where you are sending them in groups. It looks like you are getting the data back from the PLC so I would suspect the application code. Are you unpacking in a different thread? Just a question. Not sure what the issue is. How is the performance if you only send one group? Tags 0-14.
 

Similar Topics

Hi everyone. Quick questions. On UnityPro, I want to open and quickly read tags from a .STA files witouth opening the program. I have 30 plc...
Replies
2
Views
126
How to read/write tags using class3 connection with omron Nx/Nj Plc? when i am seeing wireshark packets for my existing connection its shows as...
Replies
0
Views
703
Dear Friends; I am trying to read the Tag Values in excel by using VBA. I write a code but was stuck on the following error: Dim OPC Server1 As...
Replies
21
Views
6,344
Hello, Just wondering if it is possible to make internal CitectSCADA project tags available to an OPC server. (Schneider OFS). There are...
Replies
0
Views
907
Hello Everyone, I've been trying to write a python code to read input and output tags from a PLC using CIP. I found the service...
Replies
25
Views
6,166
Back
Top Bottom