|
|
@ -142,7 +142,7 @@ class DevicesManange():
|
|
|
|
self.paSlaveDevices = collections.OrderedDict()
|
|
|
|
self.paSlaveDevices = collections.OrderedDict()
|
|
|
|
self.dpSlaveModbus = TcpMaster(host = '192.168.2.10', port = 502)
|
|
|
|
self.dpSlaveModbus = TcpMaster(host = '192.168.2.10', port = 502)
|
|
|
|
self.paSlaveModbus = TcpMaster(host = '192.168.4.10', port = 502)
|
|
|
|
self.paSlaveModbus = TcpMaster(host = '192.168.4.10', port = 502)
|
|
|
|
self.dpMasterModbus = TcpMaster(host = '192.168.1.10', port = 502)
|
|
|
|
self.dpMasterModbus = TcpMaster(host = '192.168.0.40', port = 502)
|
|
|
|
self.paMasterModbus = TcpMaster(host = '192.168.3.10', port = 502)
|
|
|
|
self.paMasterModbus = TcpMaster(host = '192.168.3.10', port = 502)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -226,7 +226,9 @@ class DevicesManange():
|
|
|
|
# print(values)
|
|
|
|
# print(values)
|
|
|
|
for area, value in zip(areas, values):
|
|
|
|
for area, value in zip(areas, values):
|
|
|
|
area.forceValue = value
|
|
|
|
area.forceValue = value
|
|
|
|
if area.type in ['DI', 'DO']:
|
|
|
|
if area.type in ['DO', 'DI'] and device.type == 'PA':
|
|
|
|
|
|
|
|
area.forceValue = value[8:] + value[:8]
|
|
|
|
|
|
|
|
elif area.type in ['DO', 'DI'] and device.type == 'DP' and device.masterOrSlave == "主站":
|
|
|
|
area.forceValue = value[8:] + value[:8]
|
|
|
|
area.forceValue = value[8:] + value[:8]
|
|
|
|
|
|
|
|
|
|
|
|
for device in curProDict.values():
|
|
|
|
for device in curProDict.values():
|
|
|
@ -296,6 +298,9 @@ class DevicesManange():
|
|
|
|
area.currentValue[i] = round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4)
|
|
|
|
area.currentValue[i] = round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4)
|
|
|
|
# print(round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4))
|
|
|
|
# print(round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4))
|
|
|
|
elif area.type in ['DI', 'DO']:
|
|
|
|
elif area.type in ['DI', 'DO']:
|
|
|
|
|
|
|
|
if device.masterOrSlave == '主站' and device.type == 'DP':
|
|
|
|
|
|
|
|
bytes = bytes
|
|
|
|
|
|
|
|
else:
|
|
|
|
bytes = bytes[::-1]
|
|
|
|
bytes = bytes[::-1]
|
|
|
|
area.currentValue = bytesToCoils(bytes)
|
|
|
|
area.currentValue = bytesToCoils(bytes)
|
|
|
|
# print(area.currentValue)
|
|
|
|
# print(area.currentValue)
|
|
|
|