Port 0x353 is out of range - pyads

32 Views Asked by At

I am trying to connect to PLC to read certain variables from my linux server. However,I encounter an error of "Port 0x353 is out of range". I am not able to solve this.

Additional details:

Ubuntu 20.04 LTS

Code:

import pyads 
CLIENT_NETID = <net_id>
CLIENT_IP = <client_ip>
TARGET_IP = <target_ip>
TARGET_USERNAME = <username>
TARGET_PASSWORD = <password>
ROUTE_NAME = "route-to-my-plc"

pyads.add_route_to_plc(
    CLIENT_NETID, CLIENT_IP, TARGET_IP, TARGET_USERNAME, TARGET_PASSWORD,
    route_name=ROUTE_NAME
)


plc = pyads.Connection(<net_id>, 851, <target_ip>)

plc.open()

i = plc.read_by_name("TransportOp_GVL.liftCurrentFloor")

Error print:

>>> i = plc.read_by_name("TransportOp_GVL.liftCurrentFloor")
2024-03-15T04:07:27+0000 Warning: Port 0x353 is out of range
2024-03-15T04:07:27+0000 Warning: No response pending
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyads/connection.py", line 537, in read_by_name
    plc_datatype = self._query_plc_datatype_from_name(data_name,
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyads/connection.py", line 181, in _query_plc_datatype_from_name
    info = adsGetSymbolInfo(self._port, self._adr, data_name)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyads/pyads_ex.py", line 912, in adsGetSymbolInfo
    symbol_info = adsSyncReadWriteReqEx2(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyads/pyads_ex.py", line 774, in adsSyncReadWriteReqEx2
    raise ADSError(err_code)
pyads.pyads_ex.ADSError: ADSError: timeout elapsed (1861). 

Troubleshooting steps taken:

Found a github issue tread on a similar issue. However, I dont not really understand how to troubleshoot. It is mentioned that TwinCAT3 Scope is sending data packets over TCP connection. Do I have to connect to the PLC and open up the TwinCAT3 software to turn off the Scope server? I am new to PLC programming so I am not sure about this aspect.

0

There are 0 best solutions below