AB CompactLogix L36ERM - Socket Programming small help needed

bharat.desh

Member
Join Date
Aug 2009
Location
Leine
Posts
2
Hello Gents,

I am currently using AB CompactLogix Processor L36 ERM (Mid Range Controller) in an application. One of the device on the network is a Loadcell with built-in RS232 to Ethernet Converter (Model ad4212c and AD-8526 from A&D, Japan). This device is supporting TCP/IP Protocol, so I have used Sample Program from RA Knowledgebase ID 32962 and also referred Manual enet-at002_-en-p.pdf.

The End Device (A&D) is continuously outputting data on the ethernet (e.g. say 20 times a second)- which I can read on Hyperterminal correctly.


In my Application, I set up PLC as Client, Did sequence as
a) Delete ALL socket (once at power on with delay)
b) Create Socket
c) Connection Request
d) Read Socket
e) Write Socket.

My EWEB PATH Is SET CORRECTLY to (1,0 - as for All 5370 controllers)

Problem Description :
My all above sequences take place correctly, DN bit of each MSG comes up correctly. I am able to read data from A&D Device in the Read_Response.READ_BUFF. However, this data comes with some delay of about 8-10 seconds in PLC (Pls. note that this delay does not appear when reading it on Hyperterminal). Apparently, data from A&D gets stored somewhere in the Ethernet Port Buffer (inside PLC that is not accessible by the user) and when the length of buffer is full, then it's outputted via READ_SOCKET MSG. There is no loss of data, only data is available after delay to PLC program. I verified this by putting some weight on loadcell and checking it;s value on FIRST Hyperterminal and then on PLC one by one. In case of Hyperterminal, weight value reflects as soon as I put weight / remove weight - whereas in case of PLC (i.e. read_socket msg created as per above sequence), the value change gets reflected after 8-10 seconds.

Some important points in addition :
a) I refered program "EWEB_SOCK_TCP_CLIENT_VER2_1.ACD" from KB ID-TN_32962.
b) A&D Device Data Length is 17 bytes
c) I tried putting Task/Program as continuous / periodic task @ 100ms.
d) Read_socket MSG is executed every 20ms.


ANY HELP FROM GIANTS ON RESOLVING THIS ISSUE WOULD BE GREATLY APPRCIATED.
Thanks in Advance to All,

B.D
 
I usually don't respond to the posters if they send me a PM, this is not private consulting service, post here and patiently wait until somebody responds
But this is a such common question on open sockets that I thought it will be beneficial for people to read.

First off, it is very unusual that device sends data unsolicited via TCP, but I've seen this before.
But the sample code you are using is not written for this.

Second, look at your timing:
- device sends data at ~50ms
- you scan program at ~100ms but it takes at least two scans to process message, may be more, so you are already behind
- you trigger message at 20ms while you scan is 100ms - does it make any sense?

And last thing - you have to remember that TCP is a stream, all incoming data piles up in Read buffer until you get it.
if your device sends 17 bytes, and you read 17 bytes per message then you will be always behind, you must read much higher number of bytes.

Saying this:
- execute periodic task at 10ms,
- set read MSG timeout to 0 (in UDT) and execute it with "not Enabled" condition
- set read message buffer to 170 or higher number, recreate the data stream on PLC side and parse this data then.
Remember that you can have more than one data packet in this buffer and you can have partial packet as well, so you must parse this data using a known delimiter or length
There are many application samples in the Knowledgebase that properly read incoming stream.
I don't have KB access at this moment, but there are some examples how to do automatic read and parse data.

There is also technote that has AOIs that handles client operations correctly.

If you still having issues, then post you ACD file here - we can't troubleshoot words or pictures.

And watch upcoming April 2014 Rockwell Genius Webinar that will cover Open Sockets for beginners.
 
Last edited:
AB CompactLogix L36ERM - Socket Programming

Hello Mr. Contr_Conn,

Apology for direct PM, I corrected my mistake and posted my query in common thread.

Thnx for your reply.

I could grab the timings and would surely follow the advise given by you.
I believe this should be manageable, probably would need to stretch a bit on 3rd point i.e. "recreate the data stream on PLC side and parse this data then"


Unfortunately, I will be able to test this only after a week due to site conditions, but Will certainly implement your valuable advise and post results.http://www.plctalk.net/qanda/images/icons/icon7.gif

Thanking you once again for your valuable time......
 
The UW Professor of Practice program is specifically set up to have working professionals provide that perspective to the students. UW realized that they have all these brilliant PhDs, but most of them have never actually built anything. Since about 85% of the students go right into industry the faculty decided that some non-academic perspective would be a good thing.
 
bharat.desh

You can see parsing read data example is in the technote 33672.
Basically this sample is for Server and you are running client as I understand it.
But data parsing will remain the same.
See Packet Processing routine.
it techinally collects data from the MSG Read in one big string
Then it removes 8 bytes at the time.
this number may be different in your application.
Also if your device sends variable length packets, then you will need to look for a delimiter instead.
 

Similar Topics

Hi there, Just a quick question. I have CompactLogix controller L36ERM that gives me energy storage fault. Controller is running fine. However...
Replies
6
Views
444
Hi All, Fairly new to PLCs and in particular communications between processors. I'll explain the problem best as I can. I have a new water...
Replies
7
Views
2,050
Hi guys, I have taken on a project to migrate a ML1500 project to a CompactLogix L36ERM. I have tried using the RSLogix Project Migrator and...
Replies
2
Views
3,364
I have a new L36ERM PLC and the download is taking forever. I'm talking upwards of 3-4 minutes download, which normally takes ~10 seconds? All...
Replies
7
Views
2,625
Hello all, I am doing a project where I need to use a 1769-L36ERM. I am developing offline as I am waiting for my hardware to arrive. I have a...
Replies
21
Views
11,397
Back
Top Bottom