PIDLogic

PIDLogic 1:

This method enables the implementation of the logic of the PID controller.

Syntax

METHOD PIDLogic : BOOL

Call Beckhoff PID controller (Tc2_ControllerToolbox is required)

//Set PID Params
PIDParams.tCtrlCycleTime   := LREAL_TO_TIME(fCycleTime * 1000);
PIDParams.tTaskCycleTime   := LREAL_TO_TIME(fCycleTime * 1000);
PIDParams.fKp              := P;
PIDParams.tTn              := REAL_TO_TIME(TI * 1000);
PIDParams.tTv              := REAL_TO_TIME(TD * 1000);
PIDParams.fOutMaxLimit     := MVMax;
PIDParams.fOutMinLimit     := MVMin;
PIDParams.bARWOnIPartOnly  := TRUE;

//Call Controller Toolbox PID function block
CTRL_PID(
   fSetpointValue := SP,
   fActualValue   := PV,
   eMode          := eCTRL_MODE_ACTIVE,
   stParams       := PIDParams);

//Write resulting Manipulated Value to MTP function block
MV:= LREAL_TO_REAL(CTRL_PID.fOut);

PIDLogic 2: Return value

Name

Type

Description

PIDLogic

BOOL