Add PID_FAN_SCALING option (#15585)
This commit is contained in:
		| @@ -197,6 +197,56 @@ | ||||
|     #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) | ||||
|     #define LPQ_MAX_LEN 50 | ||||
|   #endif | ||||
|  | ||||
|   /** | ||||
|    * Add an experimental additional term to the heater power, proportional to the fan speed. | ||||
|    * A well-chosen Kf value should add just enough power to compensate for power-loss from the cooling fan. | ||||
|    * You can either just add a constant compensation with the DEFAULT_Kf value | ||||
|    * or follow the instruction below to get speed-dependent compensation. | ||||
|    * | ||||
|    * Constant compensation (use only with fanspeeds of 0% and 100%) | ||||
|    * --------------------------------------------------------------------- | ||||
|    * A good starting point for the Kf-value comes from the calculation: | ||||
|    *   kf = (power_fan * eff_fan) / power_heater * 255 | ||||
|    * where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater. | ||||
|    * | ||||
|    * Example: | ||||
|    *   Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8 | ||||
|    *   Kf = (2.4W * 0.8) / 40W * 255 = 12.24 | ||||
|    * | ||||
|    * Fan-speed dependent compensation | ||||
|    * -------------------------------- | ||||
|    * 1. To find a good Kf value, set the hotend temperature, wait for it to settle, and enable the fan (100%). | ||||
|    *    Make sure PID_FAN_SCALING_LIN_FACTOR is 0 and PID_FAN_SCALING_ALTERNATIVE_DEFINITION is not enabled. | ||||
|    *    If you see the temperature drop repeat the test, increasing the Kf value slowly, until the temperature | ||||
|    *    drop goes away. If the temperature overshoots after enabling the fan, the Kf value is too big. | ||||
|    * 2. Note the Kf-value for fan-speed at 100% | ||||
|    * 3. Determine a good value for PID_FAN_SCALING_MIN_SPEED, which is around the speed, where the fan starts moving. | ||||
|    * 4. Repeat step 1. and 2. for this fan speed. | ||||
|    * 5. Enable PID_FAN_SCALING_ALTERNATIVE_DEFINITION and enter the two identified Kf-values in | ||||
|    *    PID_FAN_SCALING_AT_FULL_SPEED and PID_FAN_SCALING_AT_MIN_SPEED. Enter the minimum speed in PID_FAN_SCALING_MIN_SPEED | ||||
|    */ | ||||
|   //#define PID_FAN_SCALING | ||||
|   #if ENABLED(PID_FAN_SCALING) | ||||
|     //#define PID_FAN_SCALING_ALTERNATIVE_DEFINITION | ||||
|     #if ENABLED(PID_FAN_SCALING_ALTERNATIVE_DEFINITION) | ||||
|       // The alternative definition is used for an easier configuration. | ||||
|       // Just figure out Kf at fullspeed (255) and PID_FAN_SCALING_MIN_SPEED. | ||||
|       // DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly. | ||||
|  | ||||
|       #define PID_FAN_SCALING_AT_FULL_SPEED 13.0        //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf | ||||
|       #define PID_FAN_SCALING_AT_MIN_SPEED 6.0          //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf | ||||
|       #define PID_FAN_SCALING_MIN_SPEED 10.0            // Minimum fan speed at which to enable PID_FAN_SCALING | ||||
|  | ||||
|       #define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED) | ||||
|       #define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0 | ||||
|  | ||||
|     #else | ||||
|       #define PID_FAN_SCALING_LIN_FACTOR (0)             // Power loss due to cooling = Kf * (fan_speed) | ||||
|       #define DEFAULT_Kf 10                              // A constant value added to the PID-tuner | ||||
|       #define PID_FAN_SCALING_MIN_SPEED 10               // Minimum fan speed at which to enable PID_FAN_SCALING | ||||
|     #endif | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user