Logic Machine Forum
Modbus profile 32float - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus profile 32float (/showthread.php?tid=5460)



Modbus profile 32float - jmir - 11.06.2024

Hi, I'm having some troubles trying to read float32 values from modbus, setting the profile as below, read value on KNX is always 0. When I try to read using "read test" as 32float it seems to work...

 "mapping": [
{"name": "SETPOINT_csp1_[R/W]",
"bus_datatype": "float32",
"type": "register",
"datatype": "float32",
"address": 900,
"read_offset": 0,
"read_count": 2,
"writable": true,
"value_delta": 0.1,
"value_multiplier": 1,
"units": "ºC"
}


RE: Modbus profile 32float - Daniel - 11.06.2024

Delete the read_offset and read_count. Drop a screenshot of correct settings from Read test.


RE: Modbus profile 32float - jmir - 11.06.2024

(11.06.2024, 13:02)Daniel Wrote: Delete the read_offset and read_count. Drop a screenshot of correct settings from Read test.


I've tried deletting but it doesn't work
The screenshot:




RE: Modbus profile 32float - Daniel - 11.06.2024

you are missing the read_swap n


RE: Modbus profile 32float - jmir - 11.06.2024

(11.06.2024, 13:14)Daniel Wrote: you are missing the read_swap n

I've it here:

{
  "manufacturer": "test",
  "description": "test",
  "read_swap": "n",
  "mapping": [
{"name": "SETPOINT_csp1_[R/W]",
"bus_datatype": "float32",
"type": "register",
"datatype": "float32",
"address": 900,
"writable": true,
"value_delta": 0.1,
"value_multiplier": 1,
"units": "ºC"
}
  ]
}


RE: Modbus profile 32float - Daniel - 11.06.2024

Do you have any errors under Modbus-Error log?


RE: Modbus profile 32float - jmir - 11.06.2024

(11.06.2024, 14:24)Daniel Wrote: Do you have any errors under Modbus-Error log?

No...


RE: Modbus profile 32float - admin - 11.06.2024

Try setting both data types to uint32. What value is ready then?


RE: Modbus profile 32float - jmir - 11.06.2024

(11.06.2024, 14:37)admin Wrote: Try setting both data types to uint32. What value is ready then?

It reads 1093664768


RE: Modbus profile 32float - jmir - 11.06.2024

Maybe not related to above but i've noticed other things when using latest firmware.
  1. When I set two slaves on the same port (RS485) and both have the same poll time, in each poll the second device has timeouts... If I set different poll times, for example 30s and 60s when they match timeout appears on second device...
  2. Have you changed minimum value delta to 0.2? For example when reading heat meters where energy values are in Mwh is too much...



RE: Modbus profile 32float - admin - 12.06.2024

TCP implementation on certain Modbus devices is very buggy. Usually only a limited amount of connections can be created and it takes some time for the device to detect disconnect and free up a used connection. Sometimes this can be fixed by enabling the "Persistent connection" mode.

At the moment value delta minimum is 0.2. This had to be done because a lot of installations are overloaded by not setting the delta properly.


RE: Modbus profile 32float - jmir - 12.06.2024

(12.06.2024, 09:39)admin Wrote: TCP implementation on certain Modbus devices is very buggy. Usually only a limited amount of connections can be created and it takes some time for the device to detect disconnect and free up a used connection. Sometimes this can be fixed by enabling the "Persistent connection" mode.

At the moment value delta minimum is 0.2. This had to be done because a lot of installations are overloaded by not setting the delta properly.

Ok, but timeouts are on RS485 line not on modbus TCP connections (at least in my case...) and I've not noticed it in previous firmwares...

Have you seen someting on float32 values in profiles? The value read as uint32 (1093664768 ) correponds to the value in float32 format (11.0) so It seems that's a conversion issue, isn't it?

Thanks.


RE: Modbus profile 32float - admin - 12.06.2024

Some RS485 devices need an extra delay between reads: https://kb.logicmachine.net/misc/modbus-profile/#read_delay

I've tested your profile and reading the exact same float32 value (0x41300000) works as expected.


RE: Modbus profile 32float - jmir - 12.06.2024

(12.06.2024, 10:49)admin Wrote: Some RS485 devices need an extra delay between reads: https://kb.logicmachine.net/misc/modbus-profile/#read_delay

I've tested your profile and reading the exact same float32 value (0x41300000) works as expected.

I don't understand why using read test works and using profile not...


RE: Modbus profile 32float - admin - 12.06.2024

In you read test screenshot you are using TCP connection. Have you tried enabling Persistent connection mode? Try rebooting your Modbus device as well.


RE: Modbus profile 32float - jmir - 12.06.2024

(12.06.2024, 10:53)admin Wrote: In you read test screenshot you are using TCP connection. Have you tried enabling Persistent connection mode? Try rebooting your Modbus device as well.

Ok using persistent connection it works!!

In RS485 line I've two devices (both are the same model) and always timeouts are in the second one (the higher slave address). If I read only one device (no matter which one) there aren't timeouts...


RE: Modbus profile 32float - admin - 12.06.2024

See my previous post about adding read_delay to the profile for RS485 devices.


RE: Modbus profile 32float - jmir - 12.06.2024

(12.06.2024, 11:19)admin Wrote: See my previous post about adding read_delay to the profile for RS485 devices.

I've read it but if I understand it, delay is between read requests (on the same device) isn't it? So if I've no delay and only one device there should be timeouts...
We've other installations where we use the same meters (but using older firmwares) and I've not seen this behavour...


RE: Modbus profile 32float - admin - 12.06.2024

Might be some edge case. Just add read_delay and see if it helps. Another option to try is using a lower baud rate if possible.


RE: Modbus profile 32float - jmir - 12.06.2024

(12.06.2024, 11:44)admin Wrote: Might be some edge case. Just add read_delay and see if it helps. Another option to try is using a lower baud rate if possible.

Hi I've added read_delay=0.2 and it seems that works.
Thanks!