3-point Control (GCL)

3-bodové ovládanie.

  • hranice MIN=0% , MAX=100%
  • v koncových polohách je trvalý povel

UK_Ventil = UK_PID
Call  Vlv3bod (UK_Ventil)


Sub Vlv3bod (Y As Real) // 3st VENTIL
  // AV121 Y        (0.1)- ziadana poloha < vystup z PID (AV121=UK_Ventil)
  // AV122 poloha (0.001)- vypocitana poloha             (AV122=UK_Ventil_BACK)
  // BO5   OPEN -
  // BO6   CLOSE -
  Variable OpPerZaSec
  Variable ClPerZaSec
  Variable PerZaSec
  Variable ZmenaPercent As Real
  Variable ZmenaCasu As Real
  DoEvery 1S
    OpPerZaSec = 100 / 120
    ClPerZaSec = 100 / 120
    ZmenaPercent = UK_Ventil - UK_Ventil_BACK
    If ZmenaPercent > 0 Then
      PerZaSec = OpPerZaSec
    Else
      PerZaSec = ClPerZaSec
    End If
    ZmenaCasu = ZmenaPercent / PerZaSec
    //OPEN
    If ZmenaCasu >= 1 Or UK_Ventil >= 99.9 Then
      Stop UK_Ventil_ZAT
      Start UK_Ventil_OTV
    End If
    //CLOSE
    If ZmenaCasu <= - 1 Or UK_Ventil <= 0.1 Then
      Stop UK_Ventil_OTV
      Start UK_Ventil_ZAT
    End If
    //STOP
    If UK_Ventil_OTV = 1 And ZmenaCasu < 2 And ZmenaCasu > 0 And UK_Ventil < 99.9 Then
      Stop UK_Ventil_OTV
    End If
    If UK_Ventil_ZAT = 1 And ZmenaCasu > - 2 And ZmenaCasu < 0 And UK_Ventil > 0.1 Then
      Stop UK_Ventil_ZAT
    End If
    //POLOHA
    If UK_Ventil_OTV = 1 Then
      UK_Ventil_BACK = Min (100, UK_Ventil_BACK + 1 * OpPerZaSec)
    End If
    If UK_Ventil_ZAT = 1 Then
      UK_Ventil_BACK = Max (0, UK_Ventil_BACK - 1 * ClPerZaSec)
    End If
    UK_Ventil_BACK = Max (Min (UK_Ventil_BACK, 100), 0)
  End Do
End Sub