20.02.2024, 10:08
(20.02.2024, 09:46)admin Wrote: You can use an event script attached to a tag if input/output group addresses follow the same structure.
Code:id = event.dst:split('/')[3]
addr = '10/0/' .. id
val = event.getvalue() / 1000
ffi = require('ffi')
dst = ffi.new('unsigned char[8]')
src = ffi.new('double[1]')
src[ 0 ] = tonumber(val) or 0
ffi.copy(dst, src, 8)
res = ffi.string(dst, 8)
grp.write(addr, res, dt.raw)
Although this is a very clean, quick and smart solution, unfortunately the standard energy objects are having a different pattern than just changing the last part. The raw data objects will be created according to a table I would say in the range of 30/3/1->58 or something. I have to use 30 because the visu server cannot receive virtual addresses 32+/*/*.
I have attached all 58 objects to be processed. This is the reason why I would prefer in my application to use a table.