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.

BACnet address mapping
#1
Hello,
Is there a way to map BACnet addresses to KNX addresses, thereby avoiding redundant work? 
For example, if I have the same device across five projects, I aim to utilize a single address mapping table for increased efficiency.
Currently, I employ a BACnet app for mapping but am seeking a more effective approach.
Reply
#2
Another option is to use scripts. Then you can backup/restore scripts on all LMs.
Reply
#3
(12.12.2023, 10:57)admin Wrote: Another option is to use scripts. Then you can backup/restore scripts on all LMs.

Thank you. Smile
Reply
#4
Hello Admin,

I have to read 173 Analog Inputs (energy monitoring) from a BACnet server and I am looking to do it with a scheduled script that runs every 15'. 
I tested this and got a nice table in the log. 
Code:
    require('bacnet')
    device, objects = bacnet.scandevice(1)
 
    log(objects)

Trigger HVAC BACnet Polling (32/0/1) 08.05.2024 13:53:13
* table:
[1]
  * table:
  ["present-value"]
    * string: 59932.000000
  ["id"]
    * number: 1
  ["out-of-service"]
    * bool: false
  ["overridden"]
    * bool: false
  ["identifier"]
    * number: 118
  ["description"]
    * string: Mtr - Watervoeding ZKW 15F.. - Cumulated volume
  ["type"]
    * string: analog input
  ["name"]
    * string: B_02'S_EBHVAC'Plt'MtrWa(14)'CumVlm
  ["fault"]
    * bool: false
  ["in-alarm"]
    * bool: false
[2]
  * table:
  ["present-value"]
    * string: 5490.000000
  ["id"]
    * number: 2
  ["out-of-service"]
    * bool: false
  ["overridden"]
    * bool: false
  ["identifier"]
    * number: 119
  ["description"]
    * string: Mtr - Voeding verzacht labowater - Cumulated volume
  ["type"]
    * string: analog input
  ["name"]
    * string: B_02'S_EBHVAC'Plt'MtrWa(20)'CumVlm
  ["fault"]
    * bool: false
  ["in-alarm"]
    * bool: false


What I want to achieve is to access only the analog input objects and write the value to a knx group address.
  • Could you provide a nice example of how can I access only the objects with ["type"] analog input and get then the ["present-value"] and write it to the knx bus on the object with the same name as the ["description"] filed?
  • Is there a way to use this nice table data and create automatically all KNX objects based on the  ["description"] so copy the string and set as name to the knx object? In most cases Units are kWh and l (liters) but I have also °C (temperature) which I would like to recieve as 2byte float in the KNX.

Regards
Reply
#5
Seen this?
https://kb.logicmachine.net/libraries/bacnet-client/
Use last example with direct connection mode.
------------------------------
Ctrl+F5
Reply
#6
Using bacnet.scandevice() can be more convenient for reading many objects at once.

Code:
require('bacnet')
device, objects = bacnet.scandevice(1)

for _, obj in ipairs(objects) do
  if obj.type == 'analog input' then
    name = obj.description
    value = tonumber(obj['present-value'])

    grp.checkupdate(name, value)
    os.sleep(0.1)
  end
end

This script can be modified to create objects automatically using grp.create(). But if you need different data types you will need some extra logic to guess the data type from the name (description).
Reply
#7
(08.05.2024, 13:50)admin Wrote: Using bacnet.scandevice() can be more convenient for reading many objects at once.

Code:
require('bacnet')
device, objects = bacnet.scandevice(1)

for _, obj in ipairs(objects) do
  if obj.type == 'analog input' then
    name = obj.description
    value = tonumber(obj['present-value'])

    grp.checkupdate(name, value)
    os.sleep(0.1)
  end
end

This script can be modified to create objects automatically using grp.create(). But if you need different data types you will need some extra logic to guess the data type from the name (description).

Thank you Admin. Always glad to have you around for support.  Smile

Here the final script which worked nicely. I didn't mind to set datapoints for the temperature objects later manualy using mass edit as this was very easy.
in this script the part which creates the group addresses is commented because we only need this to run one time. 
Code:
require('bacnet')
--HVAC BACnet Server Name:AS219, IP: xxx.xxx.xxx.xxx, Device ID:1
device, objects = bacnet.scandevice(1)

for _, obj in ipairs(objects) do
  if obj.type == 'analog input' then
    index = obj.id
    name = obj.description
    value = tonumber(obj['present-value'])
   
      --Automaticaly create group addresses based on name and index
      --[[
      grp.create({name = name, address = '23/0/' .. index, datatype = dt.int32})
      ]]--
     
    grp.checkwrite(name, value)
    os.sleep(0.5)
  end
end
Reply


Forum Jump: