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.

Calculate value to procent
#9
(11.06.2021, 08:27)Tokatubs Wrote:
(11.06.2021, 08:11)admin Wrote: If min/max is common for all objects then you can use the same percentage formula after calculating the average by dividing the sum by the total number of objects.
If min/max is different then you can convert each value to a percentage and then calculate the average value from that.

Example:
Supply Vav 1: 200 m3h
Supply Vav 2: 300 m3h
Supply Vav 3: 400 m3h

Total airflow 900 m3h.

The extract Vav has min 100 m3h and 1000 m3h max.
Calculation show that this gives an output 90 % to the extract vav which will then open to 900 m3h.

So my wish is that using the "sum", putting the "sum" into the Range between min/max. And then calculate a % ouput in that range.

Hello. See if this might help. I'm using this to sum up supply dampers for controlling one exctract damper
Code:
value1 = grp.getvalue('203_VAV_T_PV1')
value2 = grp.getvalue('202_VAV_T_PV1')

valueTot = value1+value2


function VAVsum(totalIN, Vmin, Vmax)
  local valueM3H = (totalIN * 3600)
  local value = ((valueM3H - Vmin)/(Vmax - Vmin))*100
  local result
      if value < 0 then
        result = 0
      elseif value > 100 then
        result = 100
      else
        result = math.floor(value)
        end
    return result
end
   


valueOut=VAVsum(valueTot, 190, 370)
log(valueOut)
grp.write('201_VAV_A_SP', valueOut)
Reply


Messages In This Thread
Calculate value to procent - by Tokatubs - 10.06.2021, 18:55
RE: Calculate value to procent - by Tokatubs - 11.06.2021, 08:05
RE: Calculate value to procent - by admin - 11.06.2021, 08:11
RE: Calculate value to procent - by Tokatubs - 11.06.2021, 08:27
RE: Calculate value to procent - by tomnord - 07.05.2022, 14:29
RE: Calculate value to procent - by admin - 02.05.2022, 13:08

Forum Jump: