Compare commits

..

7 Commits

@ -1 +1 @@
bzz1xqqO5MZvQYYyXqwqI0i12cMGpU4IRYFBabSvKdLfJgAZxyiCOmY7d_JZsr63b4SKQOB_ptyDV1X1MmsxDw==
CqVFdMGoG3esTzQAK6YgB1PvmFenxgAxoOsXE9AlWybUFYDq3SZbVLUk0xcLtjeJe_I269EzXzrnSQeBxRLcBQ==

@ -48,7 +48,7 @@ class MainTop(QtWidgets.QWidget):
self.closeBtn.setObjectName("closeBtn")
self.iconLabol.setPixmap(QPixmap(':/static/zhjt.png').scaled(50,50))
self.titleLabel.setText("信号发生装置")
self.titleLabel.setText(" 中国核电工程有限公司 龙仪ModBus测试工具")
self.closeBtn.clicked.connect(self.MainWindow.close)
self.minBtn.clicked.connect(self.MainWindow.showMinimized)

@ -340,8 +340,7 @@ class ProTypeBoxDelegate(ProjectButtonDelegate):
setattr(self, comboBox, QComboBox(self.parent()))
cmBox = getattr(self, comboBox)
item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式','HART', 'TCRTD', 'AO/DO/PI', 'FF', 'FF模拟', 'HART模拟']
# item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式']
item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式']
cmBox.addItems(item)
cmBox.index = [index.row(), index.column()]
if self.parent().model.datas[index.row()][index.column()] in range(10):

@ -95,22 +95,19 @@ class MessageWidget(QWidget):
self.reButton.setText('停止刷新')
def addText(self):
try:
self.recvEdit.clear()
self.sendEdit.clear()
if self.decima == 16:
for x in app.backend.client.lrange("16R" , 0 , -1):
text = str(x)[2:-1]
self.recvEdit.append(text)
for x in app.backend.client.lrange("16S" , 0 , -1):
text = str(x)[2:-1]
self.sendEdit.append(text)
elif self.decima == 10:
for x in app.backend.client.lrange("10R" , 0 , -1):
text = str(x)[2:-1]
self.recvEdit.append(text)
for x in app.backend.client.lrange("10S" , 0 , -1):
text = str(x)[2:-1]
self.sendEdit.append(text)
except:
pass
self.recvEdit.clear()
self.sendEdit.clear()
if self.decima == 16:
for x in app.backend.client.lrange("16R" , 0 , -1):
text = str(x)[2:-1]
self.recvEdit.append(text)
for x in app.backend.client.lrange("16S" , 0 , -1):
text = str(x)[2:-1]
self.sendEdit.append(text)
elif self.decima == 10:
for x in app.backend.client.lrange("10R" , 0 , -1):
text = str(x)[2:-1]
self.recvEdit.append(text)
for x in app.backend.client.lrange("10S" , 0 , -1):
text = str(x)[2:-1]
self.sendEdit.append(text)

@ -7,8 +7,8 @@ from protocol.Celery.MBRTUSlave import app
def afterRecv(args):
request16 = ' '.join([hex(value)[2:].zfill(2) if index not in [0, 1] else str(int(hex(value), 16)).zfill(2) for index, value in enumerate(args[-1])])
request10 = ' '.join(str(int(hex(value), 16)).zfill(2) for index, value in enumerate(args[-1]))
request16 = ' '.join(hex(x) for x in args[-1])
request10 = ' '.join(str(int(x, 16)) for x in request16.split(' '))
app.backend.client.rpush("16R", request16)
app.backend.client.rpush("10R", request10)
if app.backend.client.llen('16R') == 81:
@ -21,8 +21,8 @@ def afterRecv(args):
# print(request10)
def afterSend(args):
request16 = ' '.join([hex(value)[2:].zfill(2) if index not in [0, 1] else str(int(hex(value), 16)).zfill(2) for index, value in enumerate(args[-1])])
request10 = ' '.join(str(int(hex(value), 16)).zfill(2) for index, value in enumerate(args[-1]))
request16 = ' '.join(hex(x) for x in args[-1])
request10 = ' '.join(str(int(x, 16)) for x in request16.split(' '))
app.backend.client.rpush("16S", request16)
app.backend.client.rpush("10S", request10)
if app.backend.client.llen('16S') == 81:

@ -18,8 +18,8 @@ class RTUSlave():
self.server = modbus_rtu.RtuServer(serial.Serial(port = port, baudrate = baudrate, bytesize = bytesize, parity = parity, stopbits = stopbits, xonxoff = xonxoff))
except Exception as e:
return
hooks.install_hook('modbus.Server.before_handle_request', afterRecv)
hooks.install_hook("modbus.Server.after_handle_request", afterSend)
hooks.install_hook("modbus_rtu.RtuServer.after_recv", afterRecv)
hooks.install_hook("modbus_rtu.RtuServer.after_send", afterSend)
# self.server.set_timeout(5.0)
# self.server.set_verbose(True)

@ -17,7 +17,7 @@ class TcpMaster():
pass
hooks.install_hook("modbus_tcp.TcpMaster.after_recv", afterRecv)
hooks.install_hook("modbus_tcp.TcpMaster.before_send", afterSend)
hooks.install_hook("modbus_tcp.TcpMaster.after_send", afterSend)
def writeSingleRegister(self, slaveId, address, outputValue, order = 'ABCD'):
try:

@ -17,8 +17,8 @@ class TCPSlave():
except Exception as e:
pass
hooks.install_hook('modbus.Server.before_handle_request', afterRecv)
hooks.install_hook("modbus.Server.after_handle_request", afterSend)
hooks.install_hook("modbus_tcp.TcpServer.after_recv", afterRecv)
hooks.install_hook("modbus_tcp.TcpServer.after_send", afterSend)
# 创建从站
# 添加存储区

@ -13,7 +13,4 @@ redis
msgpack-python
pythonnet
influxdb_client
PyQtWebEngine
pythonnet
pyecharts
pyDes
PyQtWebEngine

@ -77,6 +77,7 @@ class ModBusVar(BaseModel):
except:
return False
# 删除变量
@classmethod
def deleteVar(cls, name):

@ -3,7 +3,7 @@ def _init():#初始化
_globalDict = {}
_globalDict['ModBusTcp'] = 0
_globalDict['ModBusRtu'] = 1
_globalDict['currentPro'] = -1 # 当前工程名
_globalDict['currentPro'] = 0 # 当前工程名
_globalDict['currentProDB'] = 0 # 当前工程的数据库连接
_globalDict['varTable'] = 0 # 变量表
_globalDict['userTable'] = 0 # 用户表

Loading…
Cancel
Save