Logic Machine Forum
VAV logic - 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: VAV logic (/showthread.php?tid=6031)



VAV logic - Haug1 - 20.06.2025

Hi. 
I need some help to make this script:
Fist i need a  ga/ input that chenges between summer and winter mode.
 
I have 4 g/a with cooling command 0-100%. 
I need to make a sum based on of the cooling modes are activ. The cooling is activ if the avlue is more than 0 (1-100)
This sum is the setpoint of the ventilation system that i need to send to on g/a

Summertime:
If not activ:                       
cooling cmd 1: 250
cooling cmd 2: 390
cooling cmd 3: 500
cooling cmd 4: 180
If activ:                       
cooling cmd 1: 250
cooling cmd 2: 650
cooling cmd 3: 850
cooling cmd 4: 250

Wintertime:
If not activ:                       
cooling cmd 1: 250
cooling cmd 2: 250
cooling cmd 3: 250
cooling cmd 4: 120
If activ:                       
cooling cmd 1: 250
cooling cmd 2: 250
cooling cmd 3: 250
cooling cmd 4: 120

I Also need a new g/a output ff the colling command is not 0 (1-100) to controll some vav dampers
 summer time i want the following:
cooling cmd 1: if 0 =0%, if 1-100 =100%
cooling cmd 2: if 0 =35%, if 1-100 =100%
cooling cmd 3: if 0 =42%, if 1-100 =100% 
cooling cmd 4: if 0 =46%, if 1-100 =100%
in  winter time i want the following:
cooling cmd 1: if 0 =0%, if 1-100 =0%
cooling cmd 2: if 0 =0%, if 1-100 =0%
cooling cmd 3: if 0 =0%, if 1-100 =0% 
cooling cmd 4: if 0 =0%, if 1-100 =0%


RE: VAV logic - admin - 20.06.2025

Provide some examples how the final value is calculated. Two commands have the same output value for both active and inactive states.

To what value is 70% applied?


RE: VAV logic - Haug1 - 21.06.2025

I have 8 VAV dampers (2 per floor) that are controlled using a 0–100% command, corresponding to vMin–vMax.
Currently, some of the VAV dampers have the same vMin and vMax values, but this may change later.

When there is a cooling command, the corresponding VAV damper should switch to vMax = 100% in summer mode.
When this change to vMax occurs, I also need to increase the setpoint of the ventilation system accordingly.

Example – Setpoint Airflow Calculation:
Cooling Command Status Value
Cooling Cmd 1 Not active 250
Cooling Cmd 2 Active 650
Cooling Cmd 3 Active 850
Cooling Cmd 4 Not active 180

Resulting ventilation system setpoint = 1930

The 70% that i first decribe i see was wrong. I have change that part now i the main topic.


RE: VAV logic - admin - 25.06.2025

Add a common tag to all cooling cmd input group addresses and summer/winter group address. Attach an event script to this tag. Modify group addresses, value presets and setpoints as needed.
Code:
value = grp.getvalue('0/0/1')
mode = value and 'summer' or 'winter'

items = {
  {
    input = '0/0/21', -- command value
    output = '0/0/22', -- damper control
    summer = {
      on_value = 100,
      off_value = 35,
      on_setpoint = 650,
      off_setpoint = 390,
    },
    winter = {
      on_value = 70,
      off_value = 0,
      on_setpoint = 450,
      off_setpoint = 250,
    },
  },
  {
    input = '0/0/23', -- command value
    output = '0/0/24', -- damper control
    summer = {
      on_value = 100,
      off_value = 35,
      on_setpoint = 650,
      off_setpoint = 390,
    },
    winter = {
      on_value = 70,
      off_value = 0,
      on_setpoint = 450,
      off_setpoint = 250,
    },
  },
  {
    input = '0/0/25', -- command value
    output = '0/0/26', -- damper control
    summer = {
      on_value = 100,
      off_value = 35,
      on_setpoint = 650,
      off_setpoint = 390,
    },
    winter = {
      on_value = 70,
      off_value = 0,
      on_setpoint = 450,
      off_setpoint = 250,
    },
  },
  {
    input = '0/0/27', -- command value
    output = '0/0/28', -- damper control
    summer = {
      on_value = 100,
      off_value = 35,
      on_setpoint = 650,
      off_setpoint = 390,
    },
    winter = {
      on_value = 70,
      off_value = 0,
      on_setpoint = 450,
      off_setpoint = 250,
    },
  },
}

setpoint = 0

for _, item in ipairs(items) do
  conf = item[ mode ]
  value = grp.getvalue(item.input)
  key = toboolean(value) and 'on' or 'off'

  grp.checkwrite(item.output, conf[key .. '_value'])
  setpoint = setpoint + conf[key .. '_setpoint']
end

grp.checkupdate('0/0/3', setpoint)