FUXA
FUXA copied to clipboard
Modbus RTU multiple devices per serial port.
Hello,
when i create multiple device's as ModbusRTU and want to use the same serial port, it does not work. That make sense as it try's to open a new connection to the serial port.
But i habe a ModbusRTU with multiple devise's and all different ID's and i can only access one at a time.
Would be nice to add the possibility to communicate with multiple ID's on the same RTU connection.
Kindly regards :)
Hi, Thanks for the report. I understand what you mean, I could try to share the connection with other devices and manage the flow and set the ID.
Hope to see this update!
I studied the code a little bit and seems that need another layer for the physical connection (serial port) above the device layer, or assumes that the device is the serial port and each tag have the modbus unit id property. The same will apply to issue #755.
@rvbatista Hi, I have not yet examined it well, but I think it might be sufficient to map all tags of all devices configured as RTUs to one device by grouping them by Id.
@unocelli this will be faster to do, but will break the timeout and connect logic. I'm not experienced in node and zero experience in angular, but it's I'm interested in trying to implement this modification.
@rvbatista polling waits for the response with await and before reading you can sets the respective deviceId, after correct mapping you extend _readMemory with the deviceId parameter and before reading it you sets the id client.setID(deviceId);
@rvbatista thinking back, maybe it is simpler to share the client component (ModbusRTU) between the different devices and define a main device (the first one) that handles the connection, in this case you don't have to make a new mapping but to synchronize the communication
I implemented the function of multiple SlaveID under ModbusRTU by adding a SlaveID property to each Tag. Do you have a better solution? If not, I will submit the server code tomorrow.
By the way, sharedDevices in src don't seem to be useful
By the way, sharedDevices in src don't seem to be useful
@PaDaBooo this sharedDevices was the beginning of development and really does nothing at this moment. I didn't had much time to work with this issue. The solution that you implemented is not the best, but better to have something as work around than wait for the best solution. Thank you.
Hi there I have over 4 modbus RTU devices and only 2 com ports on my pi4 screen I have no opportunities to add one com port for every device on my modbus Modbus is a bus that supports 16 bits of devices and not a point to point protocol supporting only 1 device on a bus is a big failure and must be resolved