# What is the difference between Linear Advance and Pressure Advance?

I've been trying to do some research on Linear Advance (LA) on Marlin and Pressure Advance (PA) on Klipper, and from my understanding the technology behind each is different, although also similar. If I understand what I have read correctly, then:

LA will alter the extruder acceleration movements so that the extruder can keep relatively the same pressure while printing. The effect of this would be prettier corners and z-seams

PA also seems to alter the extruder flow rate based on the movements. This should also prevent under/over extrusion in the print similar to LA, but where does it differ from LA?

Is my understanding of these correct? I currently have an Ender3v2 with a direct drive setup and am curious if LA or PA would be considered better today (2022)? From what I understand, my 4.2.7 motherboard is not compatible with LA due to its stepper drivers, and I am trying to determine if I should move from Marlin to Klipper and use PA, or whether I should upgrade my motherboard and use LA in Marlin. I may need to upgrade my motherboard anyways as I was also wanting to add some additional temperature sensors and fan controls for a heated enclosure I plan to build down the road.

Any thoughts/advice or reviews and/or current comparisons of the two technologies would be appreciated.

## 1 Answer

Both are implementations of exactly the same concept, even up to the units of the tuning constant being seconds (mm/(mm/s)). The difference is in the implementation details, and particularly how they deal with a mathematically and physically nasty/demanding part of the concept.

In order to compensate for pressure making the filament/filament-path behave like a spring, LA/PA offset the E-axis position by a fraction (K) of the pre-LA/PA E-axis velocity. Mathematically, as an operator acting on the function that's the E-axis position at time t, the basic LA/PA transformation is:

I + K*D

where I is the identity, K is the spring constant, and D is the (time) derivative.

Anyone with a mathematical background in functional analysis or PDEs will recognize this as an unbounded linear operator (at least with respect to most norms, due to the derivative term). Casually speaking, it shifts bad behavior of a particular derivative "down one level". Instantaneous changes of acceleration (starting to accel/decel) become isntantaneous changes of velocity. Instantaneous changes of velocity ("jerk"/junctions) become instantaneous changes of position. (Insert horrified face here.) In short, the result is not physically realizable.

There are two ways to deal with this impossibility:

• The Marlin way (Linear Advance): E-axis acceleration and jerk limits are applied in such a manner that the result of the LA transformation is still within those constraints. This makes printing a lot slower. Essentially there's no longer any E-jerk, and E-acceleration is limited by K time E-velocity.

• The Klipper way (Pressure Advance): No changes are made whatsoever to the kinematic timing. Print speed is exactly what it would be without PA. Instead, a smoothing convolution with a triangle wave is applied on top of the result of the PA transformation (I + K*D) to make the E-axis position function back into something physically realizable. This introduces a new type of error into the extrusion, but if the time window of the smoothing can be kept narrow enough, the error is expected to be small enough not to matter. Unfortunately, the more extreme your print acceleration, the longer the window needed to keep the result of PA physically realizable, so there are still limits. If you don't tune them right, the extruder will just start skipping.

In my opinion, the Marlin behavior is easier to get started with, but hopelessly slow to actually use unless you start cranking up your acceleration and jerk limits. And this ends up being comparable to the manual tuning you have to do with the Klipper PA smooth time window. But in the end, Klipper's approach will always win on print performance, because the smoothing lets you cheat and do moves that wouldn't be possible with Marlin.

• Thank you for the detailed explanation and breakdown of the differences, this helps a lot. It gives me some ideas why I may have had some issues with LA on my custom Marlin firmware (perhaps making some excessive demands on my BIQU H2 pancake stepper). I think I'm going to take the dive and try out Klipper. Jan 6, 2022 at 5:34
• This a good quality answer like you don't see everyday... well done. I would add a mention of RRF firmware, to see whether it fits in one or the other techniques.
– FarO
Jan 6, 2022 at 12:53