Logic Machine Forum
Mod_bus problem - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Mod_bus problem (/showthread.php?tid=1190)



Mod_bus problem - tormod@hoyemweb.no - 23.01.2018

Hi, I'm trying to add a device with modbus but result is not as expected.

Problem 1:
value_custom is not added to objects.

Code:
{
 "manufacturer": "xxx",
 "description": "xxx",
 "mapping":[
 
   { "name": "320000 - SV - Varme System Anleggs modus", "bus_datatype": "int16", "type": "register", "address": 1651, "datatype": "int16",
     "bus_address": "32/0/40", "value_custom": { "0": "Stoppet", "1": "Startet" } }

 ]
}


Problem 2:

When trying to get value_bitmask i get 1 on all objects. The hexvalue is 0003 and should give value 1 in first 2 objects. 

Code:
{
 "manufacturer": "xxx",
 "description": "xxx",
 "mapping":[
   { "name": "370000.JP401 Start", "bus_datatype": "bool", "type": "register", "address": 1530, "datatype":"int16", "bus_address": "32/0/0",
      "value_bitmask": "0x00"},
   { "name": "370000.JP401 Drift", "bus_datatype": "bool", "type": "register", "address": 1530, "datatype":"int16", "bus_address": "32/0/1",
      "value_bitmask": "0x01"},
   { "name": "370000.JP401 Feil", "bus_datatype": "bool", "type": "register", "address": 1530, "datatype":"int16", "bus_address": "32/0/2",
      "value_bitmask": "0x02"},
   { "name": "370000.JP401 Kritisk alarm", "bus_datatype": "bool", "type": "register", "address": 1530, "datatype":"int16", "bus_address": "32/0/3",
      "value_bitmask": "0x03"}
  ]
}



RE: Mod_bus problem - admin - 23.01.2018

1. Custom values are not used when bus_address is specified directly, it will only be used when creating object mapping manually from UI

2. Bitmask cannot be zero, correct bitmask should be 1, 2, 4 and 8 for each bit starting from lowest one:
0001b = 1
0010b = 2
0100b = 4
1000b = 8


RE: Mod_bus problem - tormod@hoyemweb.no - 23.01.2018

(23.01.2018, 10:48)admin Wrote: 1. Custom values are not used when bus_address is specified directly, it will only be used when creating object mapping manually from UI

2. Bitmask cannot be zero, correct bitmask should be 1, 2, 4 and 8 for each bit starting from lowest one:
0001b = 1
0010b = 2
0100b = 4
1000b = 8

Thanks!


RE: Mod_bus problem - tormod@hoyemweb.no - 23.01.2018

Problem 3:
I have an int32 value that is split up into two int16 and i can't get the value i need. I have tried read_offset 0 and 1 and value_nan but i don't realy get it.... Is there an other method?


Code:
{
  "manufacturer": "xxx",
  "description": "xxx",
  "mapping":[
   
    { "address": 1005, "name": "320000.IE001.PV1", "read_offset": 1, "bus_datatype": "float16", "datatype": "float32",
      "value_multiplier": 0.1, "units": " kW"},
    { "address": 1006, "name": "320000.IE001.PV2", "read_offset": 1, "bus_datatype": "float16", "datatype": "float32",
      "value_multiplier": 0.1, "units": " °C"},
    { "address": 1007, "name": "320000.IE001.PV3", "read_offset": 1, "bus_datatype": "float16", "datatype": "float32",
      "value_multiplier": 0.1, "units": " °C"}

  ]
}



RE: Mod_bus problem - admin - 24.01.2018

Do not use read_offset and set datatype to int32. You might need to set read_swap depending on byte/word order of your Modbus device. The easiest way to check it is to use RTU read test in Modbus tab. Also consider using float32 for bus_datatype since float16 has limited precision range and does not work well for large values.