FB_BasicPID
The function block is a simple discretized PID element.
Transfer function:
Functional diagram:
Inputs
VAR_INPUT
fSetpointValue : LREAL; (* setpoint value *)
fActualValue : LREAL; (* actual value *)
bReset : BOOL;
fCtrlCycleTime : LREAL; (* controller cycle time in seconds [s] *)
fKp : LREAL; (* proportional gain Kp (P) *)
fTn : LREAL; (* integral gain Tn (I) [s] *)
fTv : LREAL; (* derivative gain Tv (D-T1) [s] *)
fTd : LREAL; (* derivative damping time Td (D-T1) [s] *)
END_VAR
Name | Type | Description |
---|---|---|
fSetpointValue | LREAL | Setpoint of the controlled variable |
fActualValue | LREAL | Actual value of the controlled variable |
bReset | BOOL | TRUE at this input resets the internal state variables and the controller output. |
fCtrlCycleTime | LREAL | Cycle time with which the function block is called and with which the control loop is processed [s]. The cycle time of the PLC task must be specified here if the function block is called in every PLC cycle, otherwise the corresponding multiple of the PLC cycle time. |
fKp | LREAL | Controller amplification / controller coefficient |
fTn | LREAL | Integral action time [s] |
fTv | LREAL | Derivative action time [s] |
fTd | LREAL | Damping time [s] |
Outputs
VAR_OUTPUT
fCtrlOutput : LREAL;
nErrorStatus : UINT
END_VAR
Name | Type | Description |
---|---|---|
fCtrlOutput | LREAL | Output of the PID-element |
nErrorStatus | UINT | Indicates the error number in the event of an error (nErrorStatus <> 0). |
Error Codes:
Value | Constant | Error description |
---|---|---|
0 | nERR_NOERROR | No error |
1 | nERR_INVALIDPARAM | Invalid parameter |
2 | nERR_INVALIDCYCLETIME | Invalid cycle time. |
Requirements
Development environment |
Target platform |
PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_Utilities (System) |