Forum Home › Forums › Runtime Bugs › Communicator Bugs › Communication consistency error
- This topic has 3 replies, 2 voices, and was last updated 7 years, 1 month ago by Mikhail.
-
AuthorPosts
-
February 3, 2017 at 11:27 am #1926MohanadOdemaParticipant
Hello,
I have a Modbus server running on a Raspberry Pi that communicates with a Modbus client on a desktop computer. Everything is working fine but I have a consistency problem. There is a repeated communication error [1] [2] when communicating with the server that ultimately nulls the current device data [3] in the device data section in the communicator.
I need to optimize my system so I would really appreciate it if you advise me on how to deal with this bug. I’m posting some screenshots as well to give you insight of what I mean.
[1] https://www.dropbox.com/s/rwuusx2abt4vczp/1.jpg?dl=0
[2] https://www.dropbox.com/s/f3btf1u13db9vox/2.jpg?dl=0
[3] https://www.dropbox.com/s/oyzu62a9ocihnpj/3.jpg?dl=0February 3, 2017 at 3:15 pm #1927MikhailModeratorHello,
The communication log “says” that RPi drops the connection. Do you develop the Modbus server by yourself or use 3rd party software? Is there any logs of the Modbus server?
February 4, 2017 at 11:35 pm #1928MohanadOdemaParticipantNo I developed it by myself using the pymodbus library on the RPi. Unfortunately there are no logs for the Modbus server as I only run a Python code prompting it to act as a server. I can post to you the main loop though where I suspect the problem of communication lies since the values are never actually nullified in the server’s registers.
from pymodbus.server.async import StartTcpServer
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer
from twisted.internet.task import LoopingCalldef main()
global pi# main loop
try:
while True:
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [0]*100),
co = ModbusSequentialDataBlock(0, [0]*100),
hr = ModbusSequentialDataBlock(0, [0]*100),
ir = ModbusSequentialDataBlock(0, [0]*100))
context = ModbusServerContext(slaves=store, single=True)identity = ModbusDeviceIdentification()
identity.VendorName = ‘pymodbus’
identity.ProductCode = ‘PM’
identity.VendorUrl = ‘http://github.com/bashwork/pymodbus/’
identity.ProductName = ‘pymodbus Server’
identity.ModelName = ‘pymodbus Server’
identity.MajorMinorRevision = ‘1.0’delaytime = AtlasI2C.long_timeout
pi = Temp()
pi.start()
time = 5 # 5 seconds delaytime = 5 # 5 seconds delay
writer = LoopingCall(read_context,a=(context,))
loop = LoopingCall(f=updating_writer, a=(context,))
loop.start(8) # initially delay by time
writer.start(12)StartTcpServer(context, identity=identity, address=(“192.168.1.64”, 5022))
except KeyboardInterrupt:
p.stop()
loop.stop()
writer.stop()
GPIO.cleanup()if __name__ == ‘__main__’:
main()February 5, 2017 at 1:34 pm #1929MikhailModeratorTo find a cause, debug and log needed. The source code is not enough.
There is a new possibility recently developed: you can install Rapid SCADA on your RPi and pass data from RPi to PC using Rapid SCADA internal protocol. This functionality is implemented by Rapid Gate module. You can download it by this link. In case of follow up questions, be free to ask.
Send me a letter to receive a trial key for Rapid Gate.
-
AuthorPosts
- You must be logged in to reply to this topic.