mikeav-soft / LogixTool

Tool for working with Allen-Bradley PLC (ControlLogix, CompactLogix) via EthernetIP connection
GNU General Public License v3.0
24 stars 11 forks source link

Is this program Allen Bradley 800 series compatible ? #2

Closed ffoliveira closed 3 years ago

ffoliveira commented 3 years ago

I tested this application with 800 series and didn't work.

I used the pylogix library, and found that the have a .Micro800 flag that works when put to true;

Inside the code it says some points like this :

if self.Micro800: temp = pack('<B', len(string)).decode(self.StringEncoding) else: temp = pack('<I', len(string)).decode(self.StringEncoding)

https://github.com/dmroeder/pylogix

Is there any chanche to implement it to micro 800 series in this program ?

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira!

At the moment I finish tests only with ControlLogix and CompactLogix PLCs till to V32. Unfortunately, works was not tested with MocroLogix PLC, but I going to check it during this month, and I already have PLC for it. Could you try to connect to your PLC using "Simple Method" in tags Grid? image

Do you have any errors in Message List of application? Thank you for advance!

ffoliveira commented 3 years ago

Sure. I'm going to test it tomorrow. thank you

ffoliveira commented 3 years ago

Do you have any errors in Message List of application?

Hello, yes, it gave the following error. even with Simple method.

image

ffoliveira commented 3 years ago

if self.Micro800: temp = pack('<B', len(string)).decode(self.StringEncoding) else: temp = pack('<I', len(string)).decode(self.StringEncoding)

https://github.com/dmroeder/pylogix

I found that pack code means: '<B' -> convert string to array using unsigned char (integer) size 1 '<I' -> convert string to array using unsigned int size 4

https://docs.python.org/3/library/struct.html#struct-format-strings

mikeav-soft commented 3 years ago

Thank you so much for information! I started to develop support of MicroLogix, as i said it takes month. My own library is different compare to pylogix. And at first I complete sopport Compact/Control logix series of PLC.

ffoliveira commented 3 years ago

You'r welcome.

I just start to work in a integration processo for our own ERP and the first Micrologix series 800.

Our most systems integratios are implemented in csharp, what turn using python library a little complicated.

Analysing some your library codes and python code, I think the problem might be something with the packed size.

in pylogix library, when the m800 flag is not true, it's fixed the string packet with size of 84 bytes, filling the right spaces with 0x00 byte.

84 in this format would means 4 bytes for each character in packet. meaning 21.

in python used in Micro800

pack('<III', 1,2,3) b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'

other devices

pack('<BBB', 1,2,3) b'\x01\x02\x03'

the packet for your library use the size 21 bytes ? maybe to work with m800 would have to use the packet size 84 and each character using 4 bytes.

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira!

Thank you for your interest to my project! Ywsterday I borrow some MicroLogix PLC, and Im going to study completely all. During three days I will answer completely on your questions!

P.S. Im not thought that is project will be interested to somebody.

ffoliveira commented 3 years ago

Thank you.

If you need to do tests just mention it.

I think that you library to communicate to PLCs is the only one in csharp. Threre is one in C++ with csharp wrapper, but not pure C#.

mikeav-soft commented 3 years ago

Thank you.

If you need to do tests just mention it.

I think that you library to communicate to PLCs is the only one in csharp. Threre is one in C++ with csharp wrapper, but not pure C#.

Thank you so much! Also, I started to translate all comments of library to English.

ffoliveira commented 3 years ago

Thank you so much! Also, I started to translate all comments of library to English.

Great. I was translating using google. Russian language is very interesting also. :)

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira!

I need you help at this moment. Could you try to read tag value by pylogix, for example and get Wireshark capture? Also need information what is names of tags whitch was have readed. This information could be very valuable for me!

Thank you for advance!

ffoliveira commented 3 years ago

Just did it. the variable name is "RECE_REDE_TEMPE"

micro800.zip

mikeav-soft commented 3 years ago

Thank you so much! In capture I see that PLC answer "Connection Failure" during Forward Open method - is it right connection path? And this capture was performed used my software or pylogix? Thank you so much!

ffoliveira commented 3 years ago

Thank you so much! In capture I see that PLC answer "Connection Failure" during Forward Open method - is it right connection path? And this capture was performed used my software or pylogix? Thank you

yes, it is using your software.

image

the connection path is only ip number, right ? or what should it be ?

in the libplctag library (c++) have some propeties for PLC_MLGX800 : ` tag->byte_order = &logix_tag_byte_order;

    tag->use_connected_msg = 1;
    tag->allow_packing = 0;

`

This have some meaning for you ?

mikeav-soft commented 3 years ago

Just one more request! Could you clone new version from repository and repeat connection with Wireshark capture? I found some mistake with Forward Open Segment Path. Thank you so much!

ffoliveira commented 3 years ago

Today i cant do it. tomorrow i try it again. thank you

mikeav-soft commented 3 years ago

Thank you so much! I will solve this issue, your information is very valuable!

ffoliveira commented 3 years ago

Just tested and still giving an error.

micro800-2.zip

image

mikeav-soft commented 3 years ago

Thank you so much for a test! I have analyzed Wireshark capture and I found that Path for connection is wrong, because Micro800 has not a Backplane like Control/CompactLogix PLCs. I have some questions and requests:

  1. Could you make a picture of RSLinx tree structure where current Micro800 is?
  2. Do you have Visual Studio for tests? Im going to make some simple Application for works with my EIP library for tests,
  3. Do you have any working libraries which works well (reading tag) from Micro800 (c++, python....)? If yes, I need Wireshark capture with success communication and reading!
ffoliveira commented 3 years ago

You welcome.

I dont have the RSLinx installed. I just access it using the opc.tcp IP number.

Yes, I have visual studio, I can compile your code to test it.

I just captured with wireshark for the pylogix library.

pylogix-m800.zip

from pylogix import PLC

with PLC() as comm: comm.IPAddress = '192.168.12.113' comm.Micro800 = True ret = comm.Read('RECE_REDE_TEMPE')

print(ret.TagName, ret.Value, ret.Status)

comm.Close()
mikeav-soft commented 3 years ago

Great! I see all! Give me 2-3 days for preparation code, please!

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira!

Could you try new version of application (with Wireshark capture)? I just added checkbox for disabling of Slot Number. For Micro800 it must be disable! For current connection application will try to get datatypes, but I dont know works it in Micro800 or not, I need to check it!

Thank you for advance!

ffoliveira commented 3 years ago

Hi

Just tried to capture for RECE_REDE_TEMPE tag pylogix-m800-3.zip and TEMPO_FORNO_EXEC tag

pylogix-m800-4.zip

one of them gave error trying to get datatypes, and another one object not found

strangely that because the tags weren't changed, and using OPC Client I was able to read the RECE_REDE_TEMPE tag

TEMPO_FORNO_EXEC i tried because it was in the captured packets.

mikeav-soft commented 3 years ago

Very good! It is valuable information for me, brcause I dont have yet Micro800 PLC and dont have any documentation! But, is enought informtaion for me for creating compatible logic for Micro800. In my code there is LogixDevice class - is collection with methods for working with Control or Compact Logix device, but to use it not so convinient, because need to call many information from PLC (if you dont know data types of tags). Therefore Was created class LogixTask which perform all action. In input Tag Name, in output all data for tags. As a result if something for tags wrong - there is error. LogixTask perform:

  1. Creating of TCP connection.
  2. Register Session.
  3. Forward Open.
  4. Getting of all tags from PLC.
  5. Getting of all datatypes from PLC. (Class 0x6C - in Micro800 not exist).
  6. Analyze if tag by name.
  7. Creating request for tag value with reuired period.

PS: during 3 days I will update code! Thank you for help!!!

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira! Tomorrow I will update repository for tests, I will write here when is will be done.

mikeav-soft commented 3 years ago

Hello Dear, Fernando Oliveira! Please, could you try new version. Was added Device family option. For Micro800 should choose like that image Please, check it with two methods "Simple" and "Table". Also very useful to do Wireshark Captures and some screens of application messages.

Thank you so much!

ffoliveira commented 3 years ago

Ya ! You have done a amazing work.

It's working as spected.

image

The packets. [Uploading micro800-packets.zip…]()

How to set to write a new value ?

mikeav-soft commented 3 years ago

Good!!! For writing value need to do this: image

Do you need to explain how to use EIP library in your application and how it works? PS: I started to translate EIP to English!