Add PID functional range setting. With high powered heaters the current functional range of 10 degrees causes high overshoots as the PID needs to kick in before the temperature hits 10 degrees below target.

2.0.x
daid303 12 years ago
parent 5ff5cee8ce
commit 55ba90ac19

@ -113,9 +113,11 @@
#ifdef PIDTEMP #ifdef PIDTEMP
//#define PID_DEBUG // Sends debug data to the serial port. //#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term #define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
#define K1 0.95 //smoothing factor withing the PID #define K1 0.95 //smoothing factor withing the PID
#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
// If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
// Ultimaker // Ultimaker

@ -319,11 +319,11 @@ void manage_heater()
#ifndef PID_OPENLOOP #ifndef PID_OPENLOOP
pid_error[e] = target_temperature[e] - pid_input; pid_error[e] = target_temperature[e] - pid_input;
if(pid_error[e] > 10) { if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
pid_output = PID_MAX; pid_output = PID_MAX;
pid_reset[e] = true; pid_reset[e] = true;
} }
else if(pid_error[e] < -10) { else if(pid_error[e] < -PID_FUNCTIONAL_RANGE) {
pid_output = 0; pid_output = 0;
pid_reset[e] = true; pid_reset[e] = true;
} }

Loading…
Cancel
Save