FB_BA_Loop

FB_BA_Loop 1:

The function block FB_BA_Loop represents a PID controller within the project structure of TF8040.

Functional diagram

The controller can be operated either in parallel structure or with upstream P part. This is specified by the input eOpMode.

Upstream P part:

eOpMode := E_BA_PIDMode. eP1ID

FB_BA_Loop 2:

Parallel structure:

eOpMode := E_BA_PIDMode. ePID

FB_BA_Loop 3:

Inheritance hierarchy

FB_BA_Base

    FB_BA_BasePublisher

        FB_BA_Object

Syntax

FUNCTION_BLOCK FB_BA_Loop EXTENDS FB_BA_Object IMPLEMENTS I_BA_Loop
VAR_INPUT
  bEn                        : BOOL;
  fSetpoint                  : REAL;
  fCtrlVal                   : REAL;
  eActionPgm                 : E_BA_Action;
  fMinOutputPgm              : REAL;
  fMaxOutputPgm              : REAL;
  bEnSync                    : BOOL;
  fValSync                   : REAL;
  bHold                      : BOOL;
END_VAR
VAR_OUTPUT
  fPresentValue              : REAL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
{region 'Variable Parameters'}
  {attribute 'parameterCategory':='General'}
    eOutputUnit              : E_BA_Unit := E_BA_Unit.eOther_Percent;
  {attribute 'parameterCategory':='General'}
    fCOVIncrement            : REAL := XBA_Param.fDefCOVIncrement;

  {attribute 'parameterCategory':='Config'}
    eOpMode                  : E_BA_PIDMode := XBA_Param.nLoop_DefOpMode;
  {attribute 'parameterCategory':='Config'}
    eActionRm                : E_BA_Action := E_BA_Action.eDirect;
  {attribute 'parameterCategory':='Config'}
    fNeutralZone             : REAL := 0;
  {attribute 'parameterCategory':='Config'}
    fMinOutputRm             : REAL := 0;
  {attribute 'parameterCategory':='Config'}
    fMaxOutputRm             : REAL := 100;
  {attribute 'parameterCategory':='Config'}
    fProportionalConstant    : REAL;
  {attribute 'parameterCategory':='Config'}
  {attribute 'parameterUnit':= 's'}
    fIntegralConstant        : REAL;
  {attribute 'parameterCategory':='Config'}
  {attribute 'parameterUnit':= 's'}
    fDerivativeConstant      : REAL := 0;
  {attribute 'parameterCategory':='Config'}
    nDampConstant            : UDINT;
{endregion}
END_VAR

FB_BA_Loop 4: Inputs

Name

Type

Description

bEn

BOOL

Activation of the function block.

fSetpoint

REAL

Setpoint.

fCtrlVal

REAL

Feedback of the control value for calculating the control deviation from the setpoint.

eActionPgm

E_BA_Action

Setting the control direction.

fMinOutputPgm

REAL

Lower controller output limit.

fMaxOutputPgm

REAL

Upper controller output limit.

bEnSync

BOOL

Enable synchronization.

fValSync

REAL

Synchronization value. After a positive edge at bEnSync this value is written to fPresentValue.

bHold

BOOL

By applying a TRUE signal to the bHold input, the controller interrupts its internal P, I and D part calculation. This freezes the fPresentValue output as long as bHold is TRUE.

FB_BA_Loop 5: Outputs

Name

Type

Description

fPresentValue

REAL

Current analog output value of the object.

FB_BA_Loop 6: Inputs CONSTANT PERSISTENT

Name

Type

Description

eOutputUnit

E_BA_Unit

Output unit.

fCOVIncrement

REAL

Step size of the Present Value that triggers a COV Notification.

eOpMode

E_BA_PIDMode

Pre- or parallel-set P part.

eActionRm

E_BA_Action

Control direction.

fNeutralZone

REAL

Neutral zone.

fMinOutputRm

REAL

Minimum output value due to external override.

fMaxOutputRm

REAL

Maximum output value due to external override.

fProportionalConstant

REAL

Proportional constant.

fIntegralConstant

REAL

Integral constant.

fDerivativeConstant

REAL

Derivative constant.

nDampConstant

UDINT

Damping constant.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.35

Tc3_XBA from v5.3.0.0