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.

Is it possible to tag/untag an object with a digital value?
#1
Hi.

I have about 100 1-byte scaling values that I want to calculate maximum of by tagging them all with i.e "Max_value".

But if I for some reason there are object(s) that NOT should be included in the calculation temporarily, is it possible to toggle them off if I have digital value(s) for each in my visu?
Or is the only solution to go into scada-main and remove the tag for the desired value(s) ?
Reply
#2
Which script are you using for maximum calculation? Do you have a separate binary on/off object for each 1-byte value?
Reply
#3
(02.06.2022, 05:42)admin Wrote: Which script are you using for maximum calculation? Do you have a separate binary on/off object for each 1-byte value?

Hi.
I'm using a script like this:

Code:
1234567891011121314
-- Enter tag here knxTable = grp.tag('Maxvalue') -- Outputadress MAX = '32/1/4' -- Don't change below -- newTable = {} for i, v in ipairs(knxTable) do   table.insert(newTable, v.value) end table.sort(newTable) grp.checkwrite(MAX, newTable[#newTable], 0.5)

Let's say I have the %-values from 1/1/1 to 1/1/50 where everyone is tagged "Maxvalue", (in real project they are not next to eachother)
I think will have to create separate 1-bit enablesignals for the corresponding 1/2/1 to 1/2/50.

Is there any possibility to "untag" 1/1/10 with setting 1/2/10 to off?

Plan B is making a script to push 1/1/1 into another GA if 1/2/1 is true, else set to 0 and tag the new GA instead of the one I have now.
Reply
#4
Instead of changing tags you can simply tag on/off objects with a different tag. The number of tagged objects for both max and status tags must be the same. It also makes sense to map this script to both value and status objects. A different common tag can be be used for this.
Code:
12345678910111213141516171819
function sortbyid(a, b)   return a.id < b.id end objs = grp.tag('max') table.sort(objs, sortbyid) stat = grp.tag('status') table.sort(stat, sortbyid) max = -math.huge for i, obj in ipairs(objs) do   if stat[ i ].value then     max = math.max(obj.value, max)   end end log(max)
Reply


Forum Jump: