FB_BasicPID

FB_BasicPID 1:

The function block is a simple discretized PID element.

Transfer function:

FB_BasicPID 2:

 

Functional diagram:

FB_BasicPID 3:

 

VAR_INPUT

VAR_INPUT
    fSetpointValue  : REAL;
    fActualValue    : REAL; 
    bReset          : BOOL;
    fCtrlCycleTime  : REAL; 
    fKp             : REAL; 
    fTn             : REAL; 
    fTv             : REAL; 
    fTd             : REAL; 
END_VAR

fSetpointValue: setpoint of the controlled variable.

fActualValue: actual value of the controlled variable.

bReset: TRUE at this input resets the internal state variables and the controller output.

fCtrlCycleTime: cycle time with which the function block is called and with which the control loop is processed [s].

fKp : controller amplification / controller coefficient

fTn : integral action time [s]

fTv: derivative action time [s]

fTd : damping time [s]

 

VAR_OUTPUT

VAR_OUTPUT
    fCtrlOutput     : REAL;
    nErrorStatus    : UINT
END_VAR

fCtrlOutput         : output of the PID element.

nErrorStatus     : indicates the error number in the event of an error (nErrorStatus <> 0).

0 = nERR_NOERROR                           : no error.
1 = nERR_INVALIDPARAM                 : invalid parameters
2 = nERR_INVALIDCYCLETIME          : invalid cycle time.

 

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v2.8.0 Build > 747

TwinCAT v2.9.0 Build > 947

PC (i386)

TcUtilities.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically )

TwinCAT v2.7.0 Build > 522

TwinCAT v2.8.0 Build > 747

TwinCAT v2.9.0 Build > 947

BCxxxx (165)

Standard.Lb6, PlcSystemBC.Lb6, TcPlcUtilitiesBC.Lb6