Calculate value to procent - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Calculate value to procent (/showthread.php?tid=3416) |
Calculate value to procent - Tokatubs - 10.06.2021 I'm trying to figure out the calculation for finding the percentage between two values that a third value is.
Usage of this is i have calculated three Vav. And then i need the sum of these to give me back a procent value to give the regulator.Example: The range is 46 to 195 m3h. The value 46 would 0%, and the value 195 would be 100% of the range. What percentage of this range is the value 65? rangeMin=46 rangeMax=195 inputValue=65 inputPercentage = ? Found this code on different site. But i think that this is missing something Code: function rangePercentage (input, range_min, range_max, range_2ndMax){ RE: Calculate value to procent - benanderson_475 - 11.06.2021 Looks like the above function you posted is javascript... are you running this in the custom javascript scripting part of lm? if not and assuming you want lua try the below. Code: function rangePercentage (input, range_min, range_max, range_2ndMax) RE: Calculate value to procent - Tokatubs - 11.06.2021 (11.06.2021, 02:51)benanderson_475 Wrote: Looks like the above function you posted is javascript... are you running this in the custom javascript scripting part of lm? Just to clearify. I picked this script up site describing the calculation, so i was sure i was missing something I am using this script to sum the Supply air vav. Code: function tag_sum(tag) Since i only have one central extract vav. I then want to convert the supply sum to an control value 0-100 % to control the Extract vav. Given that i know the Min/Max flow values of the Vav. Been searching forum, but have not seen anything. RE: Calculate value to procent - admin - 11.06.2021 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. RE: Calculate value to procent - Tokatubs - 11.06.2021 (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. 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. RE: Calculate value to procent - davidchispas - 26.04.2022 Hello, I have a resident script to calculate the average between two values in percentage, but the value is sent continuously. How can it be corrected? Code: Value= (grp.getvalue(ValueA) + grp.getvalue(ValueB)) / 2 RE: Calculate value to procent - admin - 02.05.2022 Set send delta to 1 and see if it helps. Code: grp.checkwrite(Output, Value, 1) RE: Calculate value to procent - davidchispas - 04.05.2022 (02.05.2022, 13:08)admin Wrote: Set send delta to 1 and see if it helps. Thanks, that has worked. RE: Calculate value to procent - tomnord - 07.05.2022 (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. 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') |