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.

OR LOGIC VIA TAG
#8
(07.04.2022, 06:53)admin Wrote: The 0..100 range is only needed when binary and scale objects are used together. This way binary ON is considered 100%.

For general average use this:
Code:
  -- AVERAGE value
  calc['avg'] = function(group)
    local result, count, value = 0, 0

    for _, address in ipairs(group.objects) do
      value = values[ address ]

      if type(value) == 'number' then
        result = result + value
        count = count + 1
      end
    end

    if count > 0 then
      grp.checkwrite(group.output, result / count)
    end
  end


Thank you for the great support as usual!!! Smile
Reply


Messages In This Thread
OR LOGIC VIA TAG - by RafalBor - 26.06.2021, 13:23
RE: OR LOGIC VIA TAG - by admin - 26.06.2021, 13:26
RE: OR LOGIC VIA TAG - by RafalBor - 26.06.2021, 13:45
RE: OR LOGIC VIA TAG - by RafalBor - 26.06.2021, 14:46
RE: OR LOGIC VIA TAG - by admin - 28.06.2021, 06:28
RE: OR LOGIC VIA TAG - by manos@dynamitec - 06.04.2022, 20:49
RE: OR LOGIC VIA TAG - by admin - 07.04.2022, 06:53
RE: OR LOGIC VIA TAG - by manos@dynamitec - 07.04.2022, 13:12

Forum Jump: