Это старая версия документа!


PID управление 3х клапаном

Ниже приведу пример текущей настройки для управления 3-х ходовым клапаном с помощью PID регулятора в моей конфигурации openHAB.
Из оборудования установлен 3-х ходовой актуатор ESBE на контуре теплых полов.
Управлением открытия/закрытия занимается контроллер MegaD, задействованы 2 релейных выхода. Для них созданы соответствующие Items.

1. Установлен Add-on PID Controller, который соответственно рассчитывает выходное значение в зависимости от температуры уставки и текущей температуры подачи и записывает его в Item tp_pid. Настройки по коэффициентами пока выбраны следующие: P=10, I=0.5, D=80, D-T1=300

Код правила для расчета PID:

configuration: {}
triggers:
  - id: 09519cc5-516c-42a4-857f-e3ed9eacec19
    label: PID Controller Trigger
    configuration:
      input: tp_flowpipe
      setpoint: tp_setpoint
      kp: 10
      kd: 80
      kdTimeConstant: 300
      ki: 0.5
      loopTime: 120000
    type: pidcontroller.trigger
conditions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: boiler_flame
      state: ON
      operator: =
    type: core.ItemStateCondition
  - inputs: {}
    id: "3"
    configuration:
      itemName: boiler_status
      state: ON
      operator: =
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: tp_pid
    type: core.ItemCommandAction

2. Следующее правило запускается по cron каждые 3 минуты, и в зависимости от текущего значения PID управляет 3-х ходовым клапаном.

configuration: {}
triggers:
  - id: "1"
    configuration:
      cronExpression: 0 0/3 * * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >-
        /*


        Items to control 3p Actuator

        three_way_close - close relay

        three_way_open - open relay


        */


        function rotateActuator (pidValue) {
          
          var actionTimerCorrection = 2 // Maybe 1 to any reasonable value, decreasing rotation time 
          var actionTimerMax = 15000 // milliseconds, maximum 15 sec
          var actionTimerMin = 1000 // milliseconds, minimum 1 sec
          
          console.log('PID: ' + pidValue)
          
          var actionItem3pActuator = null
          var action = null
          var actionTimer = 0
          
          action = (pidValue > 0) ? 'open' : 'close';
          
          action3pActuator = items.getItem('three_way_' + action)
          actionTimer = Math.round( Math.abs( pidValue ) / actionTimerCorrection ) * 500

          // Limit to actionTimerMax if it more
          actionTimer = (actionTimer > actionTimerMax) ? actionTimerMax : actionTimer;
          
          if (actionTimer >= actionTimerMin) 
          {
            console.log ('Actuator action: ' + action3pActuator.name + ' for ' + actionTimer + ' (' + actionTimer/1000 + ' sec)')
            
            console.info(action3pActuator.name + ' send command ON')
            action3pActuator.sendCommand('ON')
            
            setTimeout(() => {
              console.info(action3pActuator.name + ' send command OFF')
              action3pActuator.sendCommand('OFF')
            }, actionTimer);  
          
          } 
          else 
          {
            console.info('actionTimer: ' + actionTimer/1000 + ' < ' + actionTimerMin/1000 + ' sec - nothing to do with 3p actuator')    
          }

        }


        rotateActuator(items.tp_pid.state)
    type: script.ScriptAction

  • sw/openhab/examples/heating/3pa.1703601995.txt.gz
  • Последнее изменение: 2023/12/26 17:46
  • lazygatto