Browse Source

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.

daid303 12 years ago
parent
commit
55ba90ac19
2 changed files with 5 additions and 3 deletions
  1. 3
    1
      Marlin/Configuration.h
  2. 2
    2
      Marlin/temperature.cpp

+ 3
- 1
Marlin/Configuration.h View File

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

+ 2
- 2
Marlin/temperature.cpp View File

319
 
319
 
320
     #ifndef PID_OPENLOOP
320
     #ifndef PID_OPENLOOP
321
         pid_error[e] = target_temperature[e] - pid_input;
321
         pid_error[e] = target_temperature[e] - pid_input;
322
-        if(pid_error[e] > 10) {
322
+        if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
323
           pid_output = PID_MAX;
323
           pid_output = PID_MAX;
324
           pid_reset[e] = true;
324
           pid_reset[e] = true;
325
         }
325
         }
326
-        else if(pid_error[e] < -10) {
326
+        else if(pid_error[e] < -PID_FUNCTIONAL_RANGE) {
327
           pid_output = 0;
327
           pid_output = 0;
328
           pid_reset[e] = true;
328
           pid_reset[e] = true;
329
         }
329
         }

Loading…
Cancel
Save