Logic Machine Forum
Scale factor on a modbus address - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Scale factor on a modbus address (/showthread.php?tid=3149)



Scale factor on a modbus address - Kilogica - 05.02.2021

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


RE: Scale factor on a modbus address - admin - 05.02.2021

See address_scale field in docs: https://openrb.com/docs/modbus.htm


RE: Scale factor on a modbus address - Kilogica - 05.02.2021

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


RE: Scale factor on a modbus address - admin - 05.02.2021

Which Modbus device model are you using?


RE: Scale factor on a modbus address - Kilogica - 05.02.2021

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?


RE: Scale factor on a modbus address - admin - 05.02.2021

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"
},



RE: Scale factor on a modbus address - Kilogica - 05.02.2021

(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!