You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old March 1st, 2019, 12:33 PM   #1
mikeav
Member
Russian Federation

mikeav is offline
 
Join Date: Mar 2019
Location: Kaluga
Posts: 20
How to Read Tags from Rockweell PLC Fast? Or how do it RSLinx?

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.rockwellautomatio...m020_-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.
  Reply With Quote
Old March 1st, 2019, 01:48 PM   #2
Archie
Member
United States

Archie is offline
 
Join Date: May 2002
Location: Orangeburg, SC
Posts: 1,915
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.
__________________
Expectations lead to disappointment. Appreciation leads to satisfaction.

AdvancedHMI - HMI Software without the license key hassles
  Reply With Quote
Old March 1st, 2019, 02:19 PM   #3
mikeav
Member
Russian Federation

mikeav is offline
 
Join Date: Mar 2019
Location: Kaluga
Posts: 20
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.
  Reply With Quote
Old March 1st, 2019, 02:26 PM   #4
PeeLC
Member
United States

PeeLC is offline
 
PeeLC's Avatar
 
Join Date: Oct 2018
Location: Krypton
Posts: 30
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
  Reply With Quote
Old March 1st, 2019, 02:31 PM   #5
SD_Scott
Member
United States

SD_Scott is offline
 
SD_Scott's Avatar
 
Join Date: Feb 2006
Location: South Carolina
Posts: 168
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.
  Reply With Quote
Old March 1st, 2019, 02:50 PM   #6
mikeav
Member
Russian Federation

mikeav is offline
 
Join Date: Mar 2019
Location: Kaluga
Posts: 20
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 by mikeav; March 1st, 2019 at 02:53 PM.
  Reply With Quote
Old March 1st, 2019, 02:59 PM   #7
SD_Scott
Member
United States

SD_Scott is offline
 
SD_Scott's Avatar
 
Join Date: Feb 2006
Location: South Carolina
Posts: 168
Quote:
Originally Posted by mikeav View Post
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.
  Reply With Quote
Old March 1st, 2019, 03:04 PM   #8
Mark-
Lifetime Supporting Member
United States

Mark- is offline
 
Join Date: Nov 2008
Location: Texas
Posts: 680
Hello,

I wrote this awhile back:
http://www.plctalk.net/qanda/showthread.php?t=113081

If you parse all the data from the start of RSLinx accessing the PLC to the normal repetitive read/writes it will help see what is being done.

My2c.
__________________
Good luck,

Mark
PeakHMI
  Reply With Quote
Old March 1st, 2019, 03:07 PM   #9
SD_Scott
Member
United States

SD_Scott is offline
 
SD_Scott's Avatar
 
Join Date: Feb 2006
Location: South Carolina
Posts: 168
Quote:
Originally Posted by SD_Scott View Post
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 by SD_Scott; March 1st, 2019 at 03:11 PM.
  Reply With Quote
Old March 1st, 2019, 03:08 PM   #10
Archie
Member
United States

Archie is offline
 
Join Date: May 2002
Location: Orangeburg, SC
Posts: 1,915
Quote:
Originally Posted by mikeav View Post
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/in...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.
__________________
Expectations lead to disappointment. Appreciation leads to satisfaction.

AdvancedHMI - HMI Software without the license key hassles
  Reply With Quote
Old March 1st, 2019, 03:10 PM   #11
dmroeder
Lifetime Supporting Member
United States

dmroeder is offline
 
dmroeder's Avatar
 
Join Date: Apr 2006
Location: Vancouver, WA
Posts: 2,324
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.
  Reply With Quote
Old March 1st, 2019, 03:16 PM   #12
mikeav
Member
Russian Federation

mikeav is offline
 
Join Date: Mar 2019
Location: Kaluga
Posts: 20
Quote:
Originally Posted by SD_Scott View Post
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.
I also put text version, but it expanded.
  Reply With Quote
Old March 1st, 2019, 03:22 PM   #13
SD_Scott
Member
United States

SD_Scott is offline
 
SD_Scott's Avatar
 
Join Date: Feb 2006
Location: South Carolina
Posts: 168
Quote:
Originally Posted by dmroeder View Post
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.
  Reply With Quote
Old March 1st, 2019, 03:34 PM   #14
mikeav
Member
Russian Federation

mikeav is offline
 
Join Date: Mar 2019
Location: Kaluga
Posts: 20
Quote:
Originally Posted by Archie View Post
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/in...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.
  Reply With Quote
Old March 1st, 2019, 03:37 PM   #15
SD_Scott
Member
United States

SD_Scott is offline
 
SD_Scott's Avatar
 
Join Date: Feb 2006
Location: South Carolina
Posts: 168
Quote:
Originally Posted by mikeav View Post
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Citect Vs WinCC - Long Doug_Adam LIVE PLC Questions And Answers 22 October 3rd, 2014 12:56 PM
How can i read tags from odbc database buzgibi LIVE PLC Questions And Answers 0 January 13th, 2014 07:33 PM
Read and Write to Local IO Tags Within a FOR Loop WCD_BWDG LIVE PLC Questions And Answers 23 November 3rd, 2011 07:43 AM
MPI comunication Manuel Raposo LIVE PLC Questions And Answers 22 July 16th, 2007 06:24 AM
enable/disable nodes of RsLinx using RsView32 tags PLC Freak LIVE PLC Questions And Answers 3 June 9th, 2004 05:48 PM


All times are GMT -5. The time now is 04:25 AM.


.