When I'm reading PLC (Siemens S7-1500) data using Profinet protocol in Python, it's getting 'Unreachable peer' and enter image description here'Address out of range' errors. So, I can't read the values. Why is this?
Here I'm adding a part of the Python code. I'm not revealing my IP address but it is accessible.
import snap7
from snap7.exceptions import Snap7Exception
rack = 0
slot = 1
def profinet(plc_ip_address, rack, slot, r_db_number, Plant, Packet):
while True:
try:
# Connect to the PLC
plc = snap7.client.Client()
plc.connect(plc_ip_address, rack, slot, 102)
I did the same process for Siemens S7-300 PLC and read the values. I just changed the IP, Rack=0, Slot=1 in the program. But its continuously giving these errors.
Snap7 is just simple S7-protocol connection via TCP/IP (it is not Profinet tool).
Those two are important: