如何在两台PC之间连接Twincats?
测试连接时,我遇到了一个错误:
target pc
- 运行Windows
- 运行Windows和PLC
- target_pc_id =“ 144.214.174.72”和target_ams_id =“ 169.254.42.168.1.1.1”
>
运行Windows
运行twincat3
client_pc_id =“ 144.214.174.69”和client_ams_net_id =“ 144.214.174.69.1.1”
我已经使用twincat在目标PC上设置了路由。这是我在客户端PC上的Python脚本:
import pyads
TARGET_AMS_ID = "169.254.42.168.1.1"
TARGET_PC_ID = "144.214.174.72"
plc = pyads.Connection(TARGET_AMS_ID, 851, TARGET_PC_ID)
plc.open()
print("state",plc.read_state())
但是发生了错误:
Traceback (most recent call last):
File "C:/Users/xxwan/Desktop/py_keypoint/test_plc.py", line 14, in <module>
print("state",plc.read_state())
File "C:\Users\xxwan\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\pyads\connection.py", line 237, in read_state
return adsSyncReadStateReqEx(self._port, self._adr)
File "C:\Users\xxwan\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\pyads\pyads_ex.py", line 510, in adsSyncReadStateReqEx
raise ADSError(error_code)
pyads.pyads_ex.ADSError: ADSError: target machine not found Missing ADS routes (7).
我是否需要在客户端PC上添加路由(类似于目标PC上的路由)?顺便说一句,如何在目标PC上获取实际端口号?
I met an error when I test the connection:
Target PC
- runs windows
- runs Twincat3 and plc
- TARGET_PC_ID = "144.214.174.72" and TARGET_AMS_ID = "169.254.42.168.1.1"
Client PC
runs windows
runs Twincat3
Client_PC_ID = "144.214.174.69" and CLIENT_AMS_NET_ID = "144.214.174.69.1.1"
I have set the route on the target PC using Twincat. Here is my python script on Client PC:
import pyads
TARGET_AMS_ID = "169.254.42.168.1.1"
TARGET_PC_ID = "144.214.174.72"
plc = pyads.Connection(TARGET_AMS_ID, 851, TARGET_PC_ID)
plc.open()
print("state",plc.read_state())
But an error happened:
Traceback (most recent call last):
File "C:/Users/xxwan/Desktop/py_keypoint/test_plc.py", line 14, in <module>
print("state",plc.read_state())
File "C:\Users\xxwan\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\pyads\connection.py", line 237, in read_state
return adsSyncReadStateReqEx(self._port, self._adr)
File "C:\Users\xxwan\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\pyads\pyads_ex.py", line 510, in adsSyncReadStateReqEx
raise ADSError(error_code)
pyads.pyads_ex.ADSError: ADSError: target machine not found Missing ADS routes (7).
Whether I need to add route on my client PC (Similar to that on the target PC)? BTW, how to get the real port number on the target PC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论