FB_TemperaturePIDThis function block provides PID"Proportional-Integral-Derivative" A PID controller is a generic control-loop feedback mechanism widely used in industrial control systems. An "error" occurs when an event or a disturbance triggers off a change in the process variable. A PID controller attempts to correct the error between a measured process variable and a desired setpoint by calculating and then outputting a corrective action that can adjust the process accordingly temperature control with auto tuning.
Figure 11-201: The TemperaturePID user-defined function block
| iEN | BOOL | EnableEnable signal for the drive, Hardware-Enable with 24V signal to X8, Software-Enable command by setup Software, fieldbus or permanently set. Both are required for enabling the drive. function |
| iREFTEMP | LREAL | Reference temperature [°C] |
| iTEMP | LREAL | Actual temperature [°C] |
| iSTART | BOOL | Start PID or auto tuning |
| iMODE | BOOL | FALSE-automatic, TRUE-tuning |
| iKP | LREAL | PID Proportional Gain |
| iKI | LREAL | PID Integral Gain |
| iKD | LREAL | PID Derivative Gain |
| iTC1S | BOOL | Sampling Time is 1s |
| iTC5S | BOOL | Sampling Time is 5s |
| iPROGCYCLE | LREAL | Execution time of the function [ms] |
| oOK | BOOL | FunctionA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. enabled |
| oCHECKSTABLE | BOOL | TRUE when checking if ambient temperature is stable |
| oTUNESTART | BOOL | Tuning is started |
| oTUNEOK | BOOL | Tuning is completed |
| oTAU | LREAL | System Time Constant[s] |
| oPWM | BOOL | PWM command for heater |
| oERR | BOOL | Function error |
| oERRID | INT | Function ID error (in case of oERR=TRUE) |
| oPOWER | LREAL | % of power requested from heater (100%=full power) |
| oTICK | BOOL | PulseWhen the step gets activated, the action is activated for a single execution, and possibly once again when the step is deactivated every sampling time |
Tuning consists of three steps.
10*iTC5s or 10*iTC1s).oERR=TRUE, oERRID=1) if the ambient temperature is greater than 0.1*Tmax, otherwise Tamb=(Tmax+Tmin)/2.[(iREFTEMP/2-Tamb)*0.368+Tamb].After, PID gains are calculated as:
KpProportional gain of a control loop=10
Ki=0.14
delta_time = time to complete Phase2 Kd=SQRT(delta_time)*7
The tuning is completed.
oTAU may be useful for setting the proper sampling time (1s or 5s).
Upon starting the PID controller, the output oPWM is modulated 5 times within the sampling time (blue line is oTICK, green line is oPWM) and each pulse length depends on output oPOWER (100%=full length).
//Run PID function with determined proportional, integral, and derivative gains
//send PWM output to command heater
udfbThPID( TRUE, 90, Temp_mes, TRUE, FALSE, KP, KI, KD, FALSE, TRUE, 1);
Tau_Calculated := udfbThPID.oTAU;
PWM_CMD := udfbThPID.oPWM;
Power := udfbThPID.oPOWER;
Tick := udfbThPID.oTICK;
|
Copyright © 2015 Kollmorgen™ |
|