PID

PLCopen motion icon

 Function Block - PID loop.

See Regulation for more information.

Inputs

Input

Data Type

Range

Unit

Default

Description

AUTO

BOOL

 

 

 

  • TRUE = normal mode
  • FALSE = manual mode

DEADB_ERR

REAL

 

 

 

Hysteresis on PV. PV is considered as unchanged if it is both:

  • Greater than (PVprev - DEADBAND_W).
  • Less than (PRprev + DEADBAND_W).

FFD

REAL

 

 

 

Disturbance value on output.

I_ITL_ON

BOOL

 

 

 

If TRUE, the integrated value is reset to I_ITLVAL.

I_ITLVAL

REAL

 

 

 

Reset value for integration when I_ITL_ON is TRUE.

I_SEL

BOOL

     

If FALSE, the integrated value is ignored.

INT_HOLD

BOOL

     

If TRUE, the integrated value is frozen.

KP

REAL

     

Gain.

PV

REAL

     

Process value.

SP

REAL

     

Set point.

TD

REAL

     

Derivation factor.

TI

REAL

     

Integration factor.

TS

TIME

     

Sampling period.

XMAX

REAL

     

Maximum output value.

XMIN

REAL

     

Minimum allowed output value.

Xout_Manu

REAL

     

Output value in manual mode.

Outputs

Output

Data Type

Range

Unit

Description

ER

REAL

 

 

Last calculated error.

Xout

REAL

 

 

Output command value.

Xout_D

REAL

 

 

Last calculated derivated value.

Xout_HLM

BOOL

 

 

TRUE if the output value is saturated to XMAX.

Xout_I

REAL

 

 

Last calculated integrated value.

Xout_LLM

BOOL

 

 

TRUE if the output value is saturated to XMIN.

Xout_P

REAL

 

 

Last calculated proportional value.

Remarks

  • It is important for the stability of the control that the TS sampling period is much bigger than the cycle time.
  • Output of the PID block always starts with zero.
    • The value varies per the inputs provided upon further cycle executions.

Diagram

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the output rung has the same value as the AUTO input, corresponding to the input rung.
  • ENO has the same state as the input rung.

IL Language Example

(* MyPID is a declared instance of PID function block. *)
Op1: CAL MyPID (AUTO, PV, SP, XOUT_MANU, KP, TI, TD, TS, XMIN, XMAX, I_SEL, I_ITL_ON, I_ITLVAL, DEADB_ERR, FFD)
FFLD  MyPID.XOUT
ST  XOUT
FFLD  MyPID.ER
ST  ER
FFLD  MyPID.XOUT_P
ST  XOUT_P
FFLD  MyPID.XOUT_I
ST  XOUT_I
FFLD  MyPID.XOUT_D
ST  XOUT_D
FFLD  MyPID.XOUT_HLM
ST  XOUT_HLM
FFLD  MyPID.XOUT_LLM
ST  XOUT_LLM

ST Language Example

(* MyPID is a declared instance of PID function block. *)
MyPID (AUTO, PV, SP, XOUT_MANU, KP, TI, TD, TS, XMIN, XMAX, I_SEL, I_ITL_ON, I_ITLVAL, DEADB_ERR, FFD);
XOUT := MyPID.XOUT;
ER := MyPID.ER;
XOUT_P := MyPID.XOUT_P;
XOUT_I := MyPID.XOUT_I;
XOUT_D := MyPID.XOUT_D;
XOUT_HLM := MyPID.XOUT_HLM;
XOUT_LLM := MyPID.XOUT_LLM;