senrust / pymcprotocol

MC Protocol(MELSEC Communication Protocol) implementation by Python
MIT License
80 stars 22 forks source link

Connection via Ethernet Module QJ71E71-100 #6

Closed mes20a42 closed 2 years ago

mes20a42 commented 2 years ago

Hi there!

May I check with you regarding setup I'm facing some issue to communicate with Python

So the current setup now is there is ethernet 1, 2 and 3 (All Ethernet) as follows setup-2

setup )

May I check with you what did I do wrong over here?

For my Python side, pymc3e = pymcprotocol.Type3E() pymc3e.setaccessopt(commtype="binary",network=3) pymc3e.connect("192.168.4.2",7000)

Always encounter WinError 10060

Thanks in advance

senrust commented 2 years ago

Thank you very much for using pymcprotocol. In fact, I have never connected to PLC via Ethernet Module. So my answer would be just assumption.

Did you assigned 192.168.4.2 to Ethernet Module? Can you show me what WinError 10060 says?

Best regards,

mes20a42 commented 2 years ago

Oh the ethernet module itself ip is 192.168.4.1 and for the rest you can refer to the image attached below setup-3 setup-4

I've exhausted all means to test out... I've checked the manual that if connecting via ethernet module is possible if we follow the header such as setting the network no. and pc no. but i didn't have any luck achieving any outcome

senrust commented 2 years ago

In your code, you are trying to access 192.168.4.2, but Ethernet module is assigned 192.168.4.1. Can you check this problem. I think this problem is not MCProtocol settings but IP address. Please use ping command and confirm Ethernet module responses.

mes20a42 commented 2 years ago

192.168.4.1 is occupied by the ethernet module I'm able to ping it and confirm it response. Furthermore, because it is occupied by the PLC itself if I try to connect it, it will deny my access so my only luck is to try to setup a secondary connection within it to access it

An Connection Refused Error [WinError 10061] stating no connection could be made because the target machine actively refused it

After reviewing the Melsec Communication Protocol https://dl.mitsubishielectric.com/dl/fa/document/manual/plc/sh080008/sh080008aa.pdf I think it is possible to connect via Ethernet Module since it is possible to construct a suitable header and access it just like how your library has written. I'll try again if I have any luck in my success I'll let you know

mes20a42 commented 2 years ago

I guess it is not possible to connect via Ethernet module since once it is handshake with the PLC it will be always occupied and can only accept socket connection from other device. Hence, it is concluded that the its only possible via CPU. Thanks for assistance.