07.05.2022, 14:29
(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)