Pressure Advance: How does S values compare to K values?



  • Prusa Research just released a new Release Candidate firmware that includes Linear Advance. Long story short, I am getting incredible results on my Prusa MK2S with my K value set to 25 or 30, retraction set to 0.8 at 40mm/sec.

    Before that I spent much of last week experimenting with Pressure Advance on my Hypercube with my Duet Wifi. I have gotten some good results with my S value set to 0.6. But what I want to know is, how do Pressure Advance S values relate to Linear Advance K values? Is an S value of 0.25 equal to a K value of 25?

    Also, Prusa recommends changing the K value based on the type of filament used. So, I have placed that GCode in my slicer's Starting Script. Can we also add the M572 command to our slicer's Starting Script?

    According to my K Factor test print, my Hypercube's K value would be similar to Prusa's recommended 25, which is why I'd like to know how to convert between K and S.



  • I only know the answer to some of your questions.

    Yes you can add the M572 in your start gcode. So if you want to set it for a given filament you can. It has to be filament specific as pressure advance is there, to compensate for "elasticity" in the filament which you notice most with flexibles in a bowden tube, and least with for example 3mm PLA with a direct drive extruder.

    You'd have to look at Prusa's code to see how they use their K value to see if you can directly convert to an S value, but you could experiment with it. Print a 1 perimeter thick circular object like a cylinder, (not on vase mode), make sure you have seams aligned not random, print it and observe the effect of changing the S value as you print, see if you start getting a thin area at the start or end of each layer. Too little pressure advance and you get a thin area at the start, too much and you get a thin area at the end. I don't know if Prusa's firmware allows changing the K value as you print, but if it does print the same object and see if you can replicate the same effect. Which it seems you have done.


  • administrators

    The difference is this. RepRapFirmware calculates:

    advance_distance = rrf_K * extrusion_speed

    Marlin calculates:

    advance_steps = K * extrusion_speed

    So the connection should be:

    marlin_K = extruder_steps_per_mm * rrf_K

    In RRF the value of K needed is independent of the extruder steps/mm, unlike Marlin. The optimum value of K will depend on the filament, extrusion temperature, and even to a small extent on the extruder stepper motor current.



  • Thank you for the replies! Obviously I cannot use the exact same settings between my direct drive Prusa and my bowden Hypercube. But, I did want to use the K Factor Test.gcode described on Matt's Hub as a guide to calibrate my S code. I will do some experiments when I get time and report back in a few days.


    Source: https://mattshub.com/2017/10/02/linear-advance/



  • @dc42:

    The difference is this. RepRapFirmware calculates:
    So the connection should be:

    marlin_K = extruder_steps_per_mm * rrf_K

    [[math]]
    25 = 98.75 * rrf_K
    
    
    25 / 98.75 = 0.253164557
    
    

    OK, so according to my K Factor Test.gcode results, somewhere between 20-30 appears to be ideal with this PLA filament. Applying dc42's formula, I rounded my K value to 0.25. I have added the following code to my slicer's starting script.

    [[gcode]]
    M572 D0 S0.25
    
    

    As I write this my printer is 75% through my test cube and it is looking just as good as the previous print done at 0.15. I feel like this has have given 3D Printing an evolutionary step forward! Finally we have a way to get rid of those disappointing line change blobs! ๐Ÿ™‚

    P.S. For my current printer โ€“ since my extruder's steps per mm is nearly 100 -- the math ends up being as simple as moving the decimal point. For anyone that happens upon this post in the future though, please calibrate your extruder's steps per minute before attempting this math. ๐Ÿ˜‰



  • It just occured to me that if RepRapFirmware doesn't support M900, then any results I get by printing K Factor Test.gcode are invalid! The gcode simply draws lines back and forth, with each new parallel line increasing the K valueโ€ฆ except using M900 instead of M572. Would it be wise to adjust the gcode for RRF, replacing M900 K10 with M572 S0.10 for example? Or does M900 work?

    [[gcode]]
    M900 K10
    G1 X80 Y30 E0.37418 F1200 ;Travel to next testline
    G1 X60 Y30 E0.74835 F1200 ;Slow part
    G1 X30 Y30 E1.12253 F4200 ;Accelerate - cruise - decelerate
    G1 X10 Y30 E0.74835 F1200 ;Slow part
    M900 K20
    G1 X10 Y40 E0.37418 F1200 ;Travel to next testline
    G1 X30 Y40 E0.74835 F1200 ;Slow part
    G1 X60 Y40 E1.12253 F4200 ;Accelerate - cruise - decelerate
    G1 X80 Y40 E0.74835 F1200 ;Slow part
    
    

    Full source: https://gist.github.com/anonymous/988a04f4454cbcdec78ae7342894fdd6



  • My understanding is that pressure advance is applied to the acceleration and deceleration phases of the extruder move. So whatever gcode file you print will have pressure advance applied if it is enabled. You can even change the M572 value "on the fly" during a print to evaluate the effect of any changes. M900 commands that are embedded in the gcode file will just be ignored.


  • administrators

    RRF doesn't currently support M900. Sadly the Marlin devs did their own thing (as they often do) instead of using a gcode that already existed to configure pressure advance. So re-running the code using M572 would be wise.

    However, a word of warning. In RRF, changes to pressure advance do not take place exactly at the point in the gcode file where you specify them. In fact they may happen a few moves earlier. The same is likely to be the case in Marlin. So I suggest you either print several zigzags at each setting, or use M400 immediately before or after M572. M400 will cause the machine to come to a standstill briefly, so ignore the print quality at that point.

    PS - one problem with implementing M900 in RRF is that M900 doesn't have the facility to specify which extruder(s) you want to change. If you are printing with 2 different filaments, you may need different values of pressure advance for each of them.



  • @dc42:

    The difference is this. RepRapFirmware calculates:

    advance_distance = rrf_K * extrusion_speed

    Marlin calculates:

    advance_steps = K * extrusion_speed

    So the connection should be:

    marlin_K = extruder_steps_per_mm * rrf_K

    In RRF the value of K needed is independent of the extruder steps/mm, unlike Marlin. The optimum value of K will depend on the filament, extrusion temperature, and even to a small extent on the extruder stepper motor current.

    It should be more like

    marlin_K = extruder_steps_per_mm * rrf_K / 10

    To calculate your RepRap K factor from a known Marlin K factor it is

    rrf_K = marlin_K / 1000



  • Be advised that a significant change to Marlin Linear Advance is in the works. Once that is released, these comparison between Marlin K values and RRF PA S values will change.

    https://github.com/MarlinFirmware/Marlin/pull/9700



  • Hi
    After reading this post it becomes clear to me that a great feature on the wiki is a list of features that the senior members of this forum recommend us less senior to implement. This is a great feature I never heard of before.

    Thanks!


  • administrators

    @JohnOCFII:

    Be advised that a significant change to Marlin Linear Advance is in the works. Once that is released, these comparison between Marlin K values and RRF PA S values will change.

    https://github.com/MarlinFirmware/Marlin/pull/9700

    So Marlin will behave as RRF has always done!



  • @dc42:

    @JohnOCFII:

    Be advised that a significant change to Marlin Linear Advance is in the works. Once that is released, these comparison between Marlin K values and RRF PA S values will change.

    https://github.com/MarlinFirmware/Marlin/pull/9700

    So Marlin will behave as RRF has always done!

    That is what I thought I was reading in that PR - thanks for confirming!


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.