From 1d05a34cd701e5e282e59da5ef7f0404cbbbc255 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 13 Dec 2019 16:51:45 -0500 Subject: docs: Update Kinematics.md document with "smooth pressure advance" Signed-off-by: Kevin O'Connor --- docs/Kinematics.md | 47 ++++---- docs/img/pressure-advance.svg | 207 ------------------------------------ docs/img/pressure-advance.svg.png | Bin 12986 -> 0 bytes docs/img/pressure-cornering.svg | 180 ------------------------------- docs/img/pressure-cornering.svg.png | Bin 9837 -> 0 bytes docs/img/pressure-velocity.png | Bin 0 -> 24301 bytes 6 files changed, 24 insertions(+), 410 deletions(-) delete mode 100644 docs/img/pressure-advance.svg delete mode 100644 docs/img/pressure-advance.svg.png delete mode 100644 docs/img/pressure-cornering.svg delete mode 100644 docs/img/pressure-cornering.svg.png create mode 100644 docs/img/pressure-velocity.png (limited to 'docs') diff --git a/docs/Kinematics.md b/docs/Kinematics.md index 548076d7..f4b84550 100644 --- a/docs/Kinematics.md +++ b/docs/Kinematics.md @@ -264,35 +264,36 @@ through the nozzle orifice (as in key idea is that the relationship between filament, pressure, and flow rate can be modeled using a linear coefficient: ``` -stepper_position = requested_e_position + pressure_advance_coefficient * nominal_extruder_velocity +pa_position = nominal_position + pressure_advance_coefficient * nominal_velocity ``` See the [pressure advance](Pressure_Advance.md) document for information on how to find this pressure advance coefficient. -Once configured, Klipper will push in an additional amount of filament -during acceleration. The higher the desired filament flow rate, the -more filament must be pushed in during acceleration to account for -pressure. During head deceleration the extra filament is retracted -(the extruder will have a negative velocity). +The basic pressure advance formula can cause the extruder motor to +make sudden velocity changes. Klipper implements "smoothing" of the +extruder movement to avoid this. -![pressure-advance](img/pressure-advance.svg.png) +![pressure-advance](img/pressure-velocity.png) -One may notice that the pressure advance algorithm can cause the -extruder motor to make sudden velocity changes. This is tolerated -based on the idea that the majority of the inertia in the system is in -changing the extruder pressure. As long as the extruder pressure does -not change rapidly the sudden changes in extruder motor velocity are -tolerated. +The above graph shows an example of two extrusion moves with a +non-zero cornering velocity between them. Note that the pressure +advance system causes additional filament to be pushed into the +extruder during acceleration. The higher the desired filament flow +rate, the more filament must be pushed in during acceleration to +account for pressure. During head deceleration the extra filament is +retracted (the extruder will have a negative velocity). -One area where sudden velocity changes become problematic is during -small changes in head speed due to cornering. +The "smoothing" is implemented by averaging the extruder position over +a small time period (as specified by the +`pressure_advance_smooth_time` config parameter). This averaging can +span multiple g-code moves. Note how the extruder motor will start +moving prior to the nominal start of the first extrusion move and will +continue to move after the nominal end of the last extrusion move. -![pressure-cornering](img/pressure-cornering.svg.png) - -To prevent this, the Klipper pressure advance code utilizes the move -look-ahead queue to detect intermittent speed changes. During a -deceleration event the code finds the maximum upcoming head speed -within a configurable time window. The pressure is then only adjusted -to this found maximum. This can greatly reduce (or even completely -eliminate) pressure changes during cornering. +Key formula for "smoothed pressure advance": +``` +smooth_pa_position(t) = + ( definitive_integral(pa_position, from=t-smooth_time/2, to=t+smooth_time/2) + / smooth_time ) +``` diff --git a/docs/img/pressure-advance.svg b/docs/img/pressure-advance.svg deleted file mode 100644 index 79bd4674..00000000 --- a/docs/img/pressure-advance.svg +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - extrudervelocity - - - - head velocity - - - - extrude move - non-extrude move - - extruderpressure - - - time - - diff --git a/docs/img/pressure-advance.svg.png b/docs/img/pressure-advance.svg.png deleted file mode 100644 index fa2c6667..00000000 Binary files a/docs/img/pressure-advance.svg.png and /dev/null differ diff --git a/docs/img/pressure-cornering.svg b/docs/img/pressure-cornering.svg deleted file mode 100644 index 908d7eb7..00000000 --- a/docs/img/pressure-cornering.svg +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - extrudervelocity - - - - head velocity - - - - first extrude - second extrude - - time - - diff --git a/docs/img/pressure-cornering.svg.png b/docs/img/pressure-cornering.svg.png deleted file mode 100644 index 183411d5..00000000 Binary files a/docs/img/pressure-cornering.svg.png and /dev/null differ diff --git a/docs/img/pressure-velocity.png b/docs/img/pressure-velocity.png new file mode 100644 index 00000000..89e91ab4 Binary files /dev/null and b/docs/img/pressure-velocity.png differ -- cgit v1.2.3-70-g09d2