SCADA-LTS / Scada-LTS

Scada-LTS is an Open Source, web-based, multi-platform solution for building your own SCADA (Supervisory Control and Data Acquisition) system.
GNU General Public License v2.0
730 stars 292 forks source link

Allow modbus tcp slave id to be zero #2799

Open nichokap opened 10 months ago

nichokap commented 10 months ago

When using some Allen Brandley devices, for example the Powermonitor 3000, and request data over Modbus TCP the device ignores the modbus slave id sent through the requests and replies with the slave id section as zero. Thus, in order to accept the responses you must

Limraj commented 9 months ago

Hi @nichokap, Could you send us the configuration of this Modbus IP (Data Source and Data Point) in Scada-LTS? We will try to recreate it on our simulator.

Regards, Kamil Jarmusik

nichokap commented 9 months ago

Hello @Limraj,

Thanks for looking that quickly the case. Sorry but i didn't understand your request. I cannot apply the configuration needed because when I write slave id 0 I get an error that the slave id should be between 1 and 255. Thus, saving the configuration and creating a data point is not possible.

If I choose modbus slave id 1, I get an error message that no reply received from this slave id (there is a reply actually, but the modbus tcp response packet has replaced slave id with 0).

Happy to support with anything more you may need.

Limraj commented 9 months ago

Okej @nichokap, I think I now understand what the problem is, you cannot set the slave id to 0, although a physical device is available with such an id, we will try to expand the possibility of entering 0.

nichokap commented 9 months ago

Thank you once again @Limraj . Sorry if I didn't describe it corrently in the first place!

Patrykb0802 commented 2 months ago

Hi @nichokap,

The issue you're experiencing with slave ID = 0 is because this ID is reserved for broadcast communication in the Modbus protocol. When using Modbus TCP, setting the slave ID to 0 allows a master to send a message to all devices on the network. This means any device receiving a message with slave ID = 0 will process the request but typically will not send a response to avoid network congestion and collisions.

Here’s a reference to this behavior:

Fernhill Software - Modbus Protocol Overview: "A master can broadcast a message to all devices using address 0 (zero)."

I hope this clarifies why the device is responding with slave ID = 0 and helps you understand the reserved usage for broadcast communication.

Best regards, @Patrykb0802