frangoteam / FUXA

Web-based Process Visualization (SCADA/HMI/Dashboard) software
https://frangoteam.org
MIT License
2.49k stars 744 forks source link

Modbus RTU multiple devices per serial port. #211

Open T1bbY opened 2 years ago

T1bbY commented 2 years ago

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

unocelli commented 2 years ago

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.

zhang9591 commented 2 years ago

Hope to see this update!

rvbatista commented 1 year ago

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.

unocelli commented 1 year ago

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

rvbatista commented 1 year ago

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

unocelli commented 1 year ago

@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 commented 1 year ago

@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

PaDaBooo commented 9 months ago

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 commented 9 months ago

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

rvbatista commented 9 months ago

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.

Github-User-002 commented 3 months ago

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