我有一个问题,我通过 Modbus TCP 进行通信测试,每个请求大约需要 200 毫秒,是否可以改善这些时间?
这是我用于测试的代码:
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
import time
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
t1= time.time()
client = ModbusClient(method='rtu', port='COM7', baudrate=9600, timeout=1,
parity='N')
response = client.read_holding_registers(address=13313, count=12, unit=0x02)
respuesta=response.registers[0:12]
client.close()
print(time.time()-t1)