T3 VAR precision at large values – float32 internally?

Hi Maurice,

I am currently developing MODBHub, a generic Modbus TCP integration for the Hubitat home automation platform. It allows Hubitat to read and write PLC/device points directly through Modbus TCP, with the Modbus data type, register address, scaling, etc. defined in a configuration file.

I have been testing the new 32-bit integer support against a T3 controller, and I noticed an interesting precision behavior that I wanted to check with you.

For the T3 VARs, I am reading/writing two consecutive Modbus registers as a signed 32-bit integer, with a 0.001 scale. The Modbus round-trip itself is consistent: when MODBHub writes a raw INT32 value, it reads back exactly the same 32 bits.

At normal values, T3000 and MODBHub also agree exactly. For example:

111.222 in T3000 → Modbus raw 111222 → 111.222 in MODBHub.

However, with larger values I sometimes see a small difference between the value represented through Modbus and the value displayed by T3000. For example:

112233.111 written through MODBHub → T3000 displays 112233.109

And in the opposite direction:

106599.367 entered in T3000 → MODBHub reads 106599.368

Interestingly, not every large value shows a difference. By pure chance, I also tested:

1065599.875

and both T3000 and MODBHub showed exactly 1065599.875.

Another test was:

1132233.111 written through MODBHub → T3000 displays 1132233.125, while the Modbus INT32 readback still corresponds exactly to 1132233.111.

This made me wonder whether T3 VAR values are internally represented or processed as IEEE-754 single-precision (float32), while the Modbus interface exposes them as the two-register INT32 × 1000 representation.

That would seem to explain the observations quite well: .875 is exactly representable in binary, while at larger magnitudes a float32 progressively loses enough resolution that every 0.001 increment can no longer be represented.

Is this how VAR values are represented internally in the T3 firmware? If so, is there a documented precision/resolution limit that should be taken into account when accessing VARs through Modbus?

Thanks,
Michel

T3 VAR is not stored in float32. It is multiplied by 1000 and saved as INT32.

Thanks Chelsea. We did some more detailed testing following your explanation that a T3 VAR is multiplied by 1000 and stored as an INT32.

We now understand our Modbus side much better. We instrumented our driver to monitor the raw INT32 value before any scaling or processing, and our INT32 read/write conversion appears to be working correctly and consistently.

For example:

Raw INT32 112233000 → scale 0.001 → 112233.000
Raw INT32 112233109 → scale 0.001 → 112233.109
Raw INT32 112233111 → scale 0.001 → 112233.111

We repeated these values several times and the conversion remained exact.

However, we are seeing two unusual behaviors when changing a VAR directly from the Temco software.

1. Some values are displayed differently from the underlying INT32

For example, when we successfully enter:

112233.111

Temco can display the VAR as:

112233.109

while a Modbus read gives the raw INT32:

112233111

Our application therefore correctly displays 112233.111.

If we enter 112233.109, the raw INT32 is 112233109 and our application correctly displays 112233.109.

So we can clearly distinguish the two underlying INT32 values through Modbus, even though the Temco software may display 112233.109 for both.

Could you please try entering 112233.111 directly into a T3 VAR on your side and see whether you observe the same behavior?

2. Temco can report a successful VAR change even though the VAR was not actually changed

We discovered another behavior which initially looked like a simple display refresh issue, but it appears to be more than that.

Starting with VAR24 at:

112233.000

we entered:

112233.111

The Temco status line reported:

Write Variable List Item24. Changed to “112233.111” Success!

However:

the VAR table remained at 112233.000, and, more importantly, our subsequent Modbus polls also continued to read the raw INT32 value 112233000.

So in this case the issue is not simply that the VAR table failed to refresh. The underlying value itself appears not to have changed, despite Temco reporting the write as successful.

We have attached a screenshot showing the Temco table still displaying 112233.000 while the status line reports that the change to 112233.111 was successful.

Is this a known behavior or issue in the Temco software?

At this point our testing indicates that the actual MODBHub INT32 conversion is behaving correctly: whenever the T3 Modbus registers contain 112233111, we read 112233.111; when they contain 112233109, we read 112233.109; and when they contain 112233000, we read 112233.000.

We are therefore trying to understand these two behaviors on the T3/Temco side:

  1. Why can 112233.111 be represented/displayed as 112233.109?

  2. Why can Temco report “Changed to 112233.111 Success!” while the underlying VAR/INT32 actually remains at 112233.000?

We have reproduced the issue you encountered. This is a display error on the T3000. Our software engineer will fix it in the next T3000 release. The values in your Modbus registers remain correct.

1 Like