FUXA icon indicating copy to clipboard operation
FUXA copied to clipboard

Modbus RTU multiple devices per serial port.

Open T1bbY opened this issue 3 years ago • 11 comments

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 :)

T1bbY avatar Oct 28 '21 16:10 T1bbY

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.

unocelli avatar Oct 28 '21 20:10 unocelli

Hope to see this update!

zhang9591 avatar Apr 08 '22 16:04 zhang9591

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 avatar Apr 10 '23 16:04 rvbatista

@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 avatar Apr 10 '23 17:04 unocelli

@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 avatar Apr 10 '23 18:04 rvbatista

@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);

unocelli avatar Apr 10 '23 18:04 unocelli

@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

unocelli avatar Apr 10 '23 19:04 unocelli

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.

PaDaBooo avatar Sep 14 '23 16:09 PaDaBooo

By the way, sharedDevices in src don't seem to be useful image

PaDaBooo avatar Sep 14 '23 16:09 PaDaBooo

By the way, sharedDevices in src don't seem to be useful image

@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.

rvbatista avatar Sep 19 '23 16:09 rvbatista

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

Github-User-002 avatar Apr 04 '24 08:04 Github-User-002