tombrazier před 2 roky
rodič
revize
6ecf52f196
No account linked to committer's email address

+ 3
- 3
Marlin/Configuration.h Zobrazit soubor

@@ -688,15 +688,15 @@
688 688
     //#define MPC_FAN_0_ACTIVE_HOTEND
689 689
   #endif
690 690
 
691
-  #define FILAMENT_HEAT_CAPACITY_PERMM 5.6e-3f        // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA).
692
-  //#define FILAMENT_HEAT_CAPACITY_PERMM 3.6e-3f      // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG).
691
+  #define FILAMENT_HEAT_CAPACITY_PERMM { 5.6e-3f }    // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA).
692
+  //#define FILAMENT_HEAT_CAPACITY_PERMM { 3.6e-3f }  // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG).
693 693
 
694 694
   // Advanced options
695 695
   #define MPC_SMOOTHING_FACTOR 0.5f                   // (0.0...1.0) Noisy temperature sensors may need a lower value for stabilization.
696 696
   #define MPC_MIN_AMBIENT_CHANGE 1.0f                 // (K/s) Modeled ambient temperature rate of change, when correcting model inaccuracies.
697 697
   #define MPC_STEADYSTATE 0.5f                        // (K/s) Temperature change rate for steady state logic to be enforced.
698 698
 
699
-  #define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center just above the surface.
699
+  #define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center at first layer height.
700 700
   #define MPC_TUNING_END_Z 10.0f                      // (mm) M306 Autotuning final Z position.
701 701
 #endif
702 702
 

+ 6
- 2
Marlin/src/gcode/temp/M306.cpp Zobrazit soubor

@@ -36,6 +36,7 @@
36 36
  *  C<joules/kelvin>          Block heat capacity.
37 37
  *  E<extruder>               Extruder number to set. (Default: E0)
38 38
  *  F<watts/kelvin>           Ambient heat transfer coefficient (fan on full).
39
+ *  H<joules/kelvin/mm>       Filament heat capacity per mm.
39 40
  *  P<watts>                  Heater power.
40 41
  *  R<kelvin/second/kelvin>   Sensor responsiveness (= transfer coefficient / heat capcity).
41 42
  */
@@ -43,7 +44,7 @@
43 44
 void GcodeSuite::M306() {
44 45
   if (parser.seen_test('T')) { thermalManager.MPC_autotune(); return; }
45 46
 
46
-  if (parser.seen("ACFPR")) {
47
+  if (parser.seen("ACFPRH")) {
47 48
     const heater_id_t hid = (heater_id_t)parser.intval('E', 0);
48 49
     MPC_t &constants = thermalManager.temp_hotend[hid].constants;
49 50
     if (parser.seenval('P')) constants.heater_power = parser.value_float();
@@ -53,6 +54,7 @@ void GcodeSuite::M306() {
53 54
     #if ENABLED(MPC_INCLUDE_FAN)
54 55
       if (parser.seenval('F')) constants.fan255_adjustment = parser.value_float() - constants.ambient_xfer_coeff_fan0;
55 56
     #endif
57
+    if (parser.seenval('H')) constants.filament_heat_capacity_permm = parser.value_float();
56 58
     return;
57 59
   }
58 60
 
@@ -70,8 +72,10 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) {
70 72
     SERIAL_ECHOPAIR_F(" R", constants.sensor_responsiveness, 4);
71 73
     SERIAL_ECHOPAIR_F(" A", constants.ambient_xfer_coeff_fan0, 4);
72 74
     #if ENABLED(MPC_INCLUDE_FAN)
73
-      SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
75
+      SERIAL_ECHOPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
74 76
     #endif
77
+    SERIAL_ECHOPAIR_F(" M", constants.filament_heat_capacity_permm, 4);
78
+    SERIAL_EOL();
75 79
   }
76 80
 }
77 81
 

+ 3
- 0
Marlin/src/module/settings.cpp Zobrazit soubor

@@ -3319,6 +3319,7 @@ void MarlinSettings::reset() {
3319 3319
     #if ENABLED(MPC_INCLUDE_FAN)
3320 3320
       constexpr float _mpc_ambient_xfer_coeff_fan255[] = MPC_AMBIENT_XFER_COEFF_FAN255;
3321 3321
     #endif
3322
+    constexpr float _filament_heat_capacity_permm[] = FILAMENT_HEAT_CAPACITY_PERMM;
3322 3323
 
3323 3324
     static_assert(COUNT(_mpc_heater_power) == HOTENDS, "MPC_HEATER_POWER must have HOTENDS items.");
3324 3325
     static_assert(COUNT(_mpc_block_heat_capacity) == HOTENDS, "MPC_BLOCK_HEAT_CAPACITY must have HOTENDS items.");
@@ -3327,6 +3328,7 @@ void MarlinSettings::reset() {
3327 3328
     #if ENABLED(MPC_INCLUDE_FAN)
3328 3329
       static_assert(COUNT(_mpc_ambient_xfer_coeff_fan255) == HOTENDS, "MPC_AMBIENT_XFER_COEFF_FAN255 must have HOTENDS items.");
3329 3330
     #endif
3331
+    static_assert(COUNT(_filament_heat_capacity_permm) == HOTENDS, "FILAMENT_HEAT_CAPACITY_PERMM must have HOTENDS items.");
3330 3332
 
3331 3333
     HOTEND_LOOP() {
3332 3334
       thermalManager.temp_hotend[e].constants.heater_power = _mpc_heater_power[e];
@@ -3336,6 +3338,7 @@ void MarlinSettings::reset() {
3336 3338
       #if ENABLED(MPC_INCLUDE_FAN)
3337 3339
         thermalManager.temp_hotend[e].constants.fan255_adjustment = _mpc_ambient_xfer_coeff_fan255[e] - _mpc_ambient_xfer_coeff[e];
3338 3340
       #endif
3341
+      thermalManager.temp_hotend[e].constants.filament_heat_capacity_permm = _filament_heat_capacity_permm[e];
3339 3342
     }
3340 3343
   #endif
3341 3344
 

+ 3
- 3
Marlin/src/module/temperature.cpp Zobrazit soubor

@@ -994,7 +994,7 @@ volatile bool Temperature::raw_temps_ready = false;
994 994
     float asymp_temp = (t2 * t2 - t1 * t3) / (2 * t2 - t1 - t3),
995 995
           block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1));
996 996
 
997
-    constants.ambient_xfer_coeff_fan0 = constants.heater_power * MPC_MAX / 255 / (asymp_temp - ambient_temp);
997
+    constants.ambient_xfer_coeff_fan0 = constants.heater_power * (MPC_MAX) / 255 / (asymp_temp - ambient_temp);
998 998
     constants.fan255_adjustment = 0.0f;
999 999
     constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness;
1000 1000
     constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp));
@@ -1058,7 +1058,7 @@ volatile bool Temperature::raw_temps_ready = false;
1058 1058
     #endif
1059 1059
 
1060 1060
     // Calculate a new and better asymptotic temperature and re-evaluate the other constants
1061
-    asymp_temp = ambient_temp + constants.heater_power / constants.ambient_xfer_coeff_fan0;
1061
+    asymp_temp = ambient_temp + constants.heater_power * (MPC_MAX) / 255 / constants.ambient_xfer_coeff_fan0;
1062 1062
     block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1));
1063 1063
     constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness;
1064 1064
     constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp));
@@ -1442,7 +1442,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
1442 1442
         if (fabs(e_speed) > planner.settings.max_feedrate_mm_s[E_AXIS])
1443 1443
           mpc_e_position = e_position;
1444 1444
         else if (e_speed > 0.0f) {  // Ignore retract/recover moves
1445
-          ambient_xfer_coeff += e_speed * FILAMENT_HEAT_CAPACITY_PERMM;
1445
+          ambient_xfer_coeff += e_speed * constants.filament_heat_capacity_permm;
1446 1446
           mpc_e_position = e_position;
1447 1447
         }
1448 1448
       }

+ 6
- 5
Marlin/src/module/temperature.h Zobrazit soubor

@@ -96,13 +96,14 @@ hotend_pid_t;
96 96
 
97 97
 #if ENABLED(MPCTEMP)
98 98
   typedef struct {
99
-    float heater_power;             // M306 P
100
-    float block_heat_capacity;      // M306 C
101
-    float sensor_responsiveness;    // M306 R
102
-    float ambient_xfer_coeff_fan0;  // M306 A
99
+    float heater_power;                 // M306 P
100
+    float block_heat_capacity;          // M306 C
101
+    float sensor_responsiveness;        // M306 R
102
+    float ambient_xfer_coeff_fan0;      // M306 A
103 103
     #if ENABLED(MPC_INCLUDE_FAN)
104
-      float fan255_adjustment;      // M306 F
104
+      float fan255_adjustment;          // M306 F
105 105
     #endif
106
+    float filament_heat_capacity_permm; // M306 M
106 107
   } MPC_t;
107 108
 #endif
108 109
 

+ 2
- 1
buildroot/tests/BIGTREE_GTR_V1_0 Zobrazit soubor

@@ -37,7 +37,8 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
37 37
         MPC_BLOCK_HEAT_CAPACITY '{ 16.7f, 16.7f, 16.7f }' \
38 38
         MPC_SENSOR_RESPONSIVENESS '{ 0.22f, 0.22f, 0.22f }' \
39 39
         MPC_AMBIENT_XFER_COEFF '{ 0.068f, 0.068f, 0.068f }' \
40
-        MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }'
40
+        MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }' \
41
+        FILAMENT_HEAT_CAPACITY_PERMM '{ 5.6e-3f, 3.6e-3f, 5.6e-3f }'
41 42
 opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE_MENU
42 43
 opt_disable PIDTEMP
43 44
 exec_test $1 $2 "BigTreeTech GTR | MPC | Switching Toolhead | Tool Sensors" "$3"

Loading…
Zrušit
Uložit