Pressure_advance_smooth_time skews pressure_advance

I have been investigating a report from @dmbutyugin at Modification of Pressure Advance for high speed Bowden printers - #8 by dmbutyugin that reducing pressure_advance_smooth_time often results in a reduction in pressure_advance.

Using some simple modelling, it does seem like pressure_advance_smooth_time could have a systemic impact on the results of pressure_advance calibration.

To test this I modified the scripts/ tool. I modelled and graphed the results of a hotend that perfectly follows the theoretical pressure advance model. I used that to graph the impact of pressure_advance_smooth_time on the nozzle flow rate.

In this graph the yellow line represents the estimated nozzle flow rate when using smooth pressure advance. (The light pink line would be the nominal pressure advance amount, and the light green line is the commanded extruder movement after smoothing.) At first glance, this graph seems sane - the theoretical flow rate after smoothing is very similar to the desired flow rate - differing only for a few milliseconds during cornering.

One troubling part, however, is that the amount that the smoothing alters the flow rate is similar at both high and low toolhead speeds. However, the impact of over-extruding at low toolhead speeds is much more noticeable because all that over extrusion is in one spot - thus resulting in blobbing. It’s possible to estimate the amount of extrusion at each position.

The second graph shows the estimated extrusion at each toolhead position (modelled with a simple summation technique using buckets every 0.200mm). (The bottom graph does not vertically align with the top graph.) The start and the end of the move aren’t particularly interesting, however the cornering (100mm/s down to 5mm/s back up to 100mm/s) does show notable over-extrusion. The graph does seem to show how pressure_advance_smooth_time could result in “blobbing at the corners” due to how it smooths the extruder flow rate during speed changes.

The PA calibrations tests work by measuring blobbing at speed changes. Thus, if pressure_advance_smooth_time leads to “blobbing during speed changes” then it could result in a systemic bias to the test results. For example:

This graph models how a smoothed PA setting of 0.055 would behave on an extruder that actually follows PA=0.045. If one were to just look at the “blobbing during cornering” then a PA=0.055 would likely appear as a shaper corner.

Thus, it seems, even on an ideal extruder, pressure_advance_smooth_time is likely to lead to a bias in the observed pressure_advance during calibration.

Interestingly, the effect is heavily dependent on speeds.

If we use a toolhead speed of 200mm/s then PA=0.055 seems to show notable under-extrusion during cornering.

So, it seems that pressure_advance_smooth_time could skew the results of calibration, and the amount it skews is dependent on the specifics of the test.

It may be possible to come up with an alternative smoothing system to reduce the amount of over-extrusion during slow speeds. (Possibly by giving greater weight to the desired extruder position at low toolhead speeds.) It’s not immediately clear how to do that though.


EDIT: I temporarily uploaded my (very hacky) script to klipper-dev/scripts/ at work-pressure-20240123 · KevinOConnor/klipper-dev · GitHub in case anyone is curious.


Very interesting post!
Empirically I have to agree with @dmbutyugin as I noticed the same and lowered the pressure_advance_smooth_time down to 0.02 for my CoreXYs when printing at least a bit faster.
I did not perform any test series as this suites my needs so far.

Maybe if somebody here has time and some spare filament to run tests this would be great!

Thanks for sharing, Kevin. Indeed very interesting findings. I ran your script, and indeed in the example you provided with smooth_time = 0.04 arguably a good PA that one would find would be PA = 0.055 (+0.01 vs the ideal, or 22% higher).
However, with smooth_time = 0.02 a good PA one would determine from the test would be PA = 0.0475 (+0.0025 vs the ideal, or only 5.5% higher)

And increasing the maximum velocity to 200 alters apparent PA only slightly to PA=0.0465:

So, decreasing smooth_time to 0.02 results in very substantial improvements for the PA tuning and for the filament flow control in general.

I’ll also try to combine these calculations with the toolhead motion simulation to see how this plays together with the toolhead resonances and input shaping.

Actually, I went ahead and added this extrusion width calculation to the script that calculates the toolhead motion as well as the extruder PA. The results are pretty interesting, in my opinion:

The chart on the right shows the extrusion width how it would be if the extruder was following Smooth PA with a perfectly tuned PA value = 0.045 and smooth_time = 0.02 and the toolhead was following the ideal trajectory (red line), and the extruder following Smooth PA, but the toolhead following the trajectory after the input shaping is applied (green line). It is interesting to see that the results are very different, which suggests that the actual toolhead motion after the input shaping must be taken into account.

And here’s another interesting result with one of the input smoothers instead of input shapers:

The chart on the right shows the deceleration to 5 mm/s enlarged. The interesting part here is the blue-ish line: it shows the case when the extruder follows a PA with a special smoothing function specifically designed for the corresponding smooth_2hump_ei smoother and the toolhead follows the trajectory after that smoother is applied. This suggests that the shape of the smoothing function is crucial, and that at least in some cases it is possible to choose a smoothing function for the extruder such that the flow gets almost perfect during accelerations and decelerations. And this will also will hopefully help me better tune the extruder smoothing functions (many of them are, apparently, far from being perfect).


Yeah, it does seem that the default of pressure_advance_smooth_time=0.040 is too high. It’s not immediately clear to me what the default should be though (eg, 0.025, 0.020, 0.015, 0.010).

It seems an acceptable value is dependent on acceleration - the higher the acceleration the lower the smooth time should be in order to get acceptable results.

Interestingly, at least according to the simulations, higher pressure_advance values have similar problems with high smooth times. It seems likely that even on a bowden printer, a PA calibration test is likely to over estimate pressure_advance, which would reduce the benefits from that additional smoothing.

That is interesting. Oddly, though, I haven’t observed that behavior in real-world calibration tests. I tune PA after input_shaper and I haven’t observed a breakdown at the corners that the graph would seem to indicate.

In contrast, in retrospect, I do see a kind of under-over-under extrude pattern at the corners that is similar to what the basic PA simulation would predict.


Is the recommendation then for Bowden users that historically have needed high pressure advance values, to use a smaller smooth_time value? I have had significant issues as of late dialing in PA, and regardless of how high a value I assign it, my corners still bulge in the direction of travel. There are no mechanical issues in my CR6-SE and everything else is working as intended. Issues persists through all acceleration and velocity parameter changes. Tonight I will try disabling interpolation and stealthchop on my TMC2209 drivers (and increase micro steps from 16/32 to 64) and see if that makes a difference. If not, I will attempt smooth_time changes. Kind of at my wits end with this printer…

a smaller smooth_time stresses the motors even more, and the high PA values required for Bowden already put quite some strain on them.

The recommendation for Bowden users, AFAIK is not to use PA at all… unless you have 15 cm Bowden like old Ender 3 had from the vertical pole to the moving print head.