This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scale factor on a modbus address
#1
Hello,

I have a device with some data that need to be scaled but the scale changes dinamically, there is a modbus address that gave me the correct scale factor, is there a way apart from making a lua script to dinamically use the scale factor when it changes?

Thank you
Reply
#2
See address_scale field in docs: https://openrb.com/docs/modbus.htm
Reply
#3
Thanks,

The problem is that it's not so rapid so if the value keep bouncing from a scale factor to another it could show wrong data before the scale factor reload.

I even thought about scheduling a script that read all the data, make the right conversion and then updates the group address with the final value but it didn't work so well for the same reason plus sometimes it says that I attempted to make math operation with a nil value, maybe because there are some reading errors in modbus.

UPDATE:
Thank you, I'll try this
Reply
#4
Which Modbus device model are you using?
Reply
#5
Wiser for KNX updated to the last firmware

(05.02.2021, 09:44)admin Wrote: See address_scale field in docs: https://openrb.com/docs/modbus.htm

I tried something like that:

Code:
{    "name": "AC power value",
            "bus_datatype": "uint16",
            "address": 40083,
            "address_scale": 40084,
            "type": "register",
            "units": " W",
            "datatype": "uint16"
        },
        {    "name": "AC power scale factor",
            "bus_datatype": "int16",
            "address": 40084,
            "type": "register",
            "datatype": "int16"
        },


But it gives me no results.

Am I doing something wrong?

Attached Files Thumbnail(s)
   
Reply
#6
Try adding "internal":true to the scaling register entry. Keep in mind that you have to create modbus device from scratch if profile is changed.
Example from a working profile:
Code:
{
  "address_scale":140,
  "bus_datatype":14,
  "address":28,
  "value_nan":[
    65535,
    65535
  ],
  "type":"register",
  "units":"VArh",
  "value_multiplier":1000,
  "name":"Reactive Energy",
  "datatype":"uint32"
},
{
  "internal":true,
  "bus_datatype":13,
  "address":140,
  "value_nan":[
    32768
  ],
  "type":"register",
  "name":"Scale Factor for Energy",
  "datatype":"int16"
},
Reply
#7
(05.02.2021, 13:00)admin Wrote: Try adding "internal":true to the scaling register entry. Keep in mind that you have to create modbus device from scratch if profile is changed.
Example from a working profile:
Code:
{
  "address_scale":140,
  "bus_datatype":14,
  "address":28,
  "value_nan":[
    65535,
    65535
  ],
  "type":"register",
  "units":"VArh",
  "value_multiplier":1000,
  "name":"Reactive Energy",
  "datatype":"uint32"
},
{
  "internal":true,
  "bus_datatype":13,
  "address":140,
  "value_nan":[
    32768
  ],
  "type":"register",
  "name":"Scale Factor for Energy",
  "datatype":"int16"
},

It works! Thanks a lot!
Reply


Forum Jump: