This paper aims to present the mathematical foundation of so-called advance algorithms, developed to compensate for defects during acceleration and deacceleration of the print head in filament-based melt extrusion additive processes. It then investigates the validity of the mathematical foundation, its performance on a low-cost system and the effect of changing layer height on the algorithm’s associated process parameter.
This study starts with a compilation and review of literature associated with advance algorithms, then elaborates on its mathematical foundation and methods of implementation. Then an experiment displaying the performance of the algorithm implemented in Marlin machine firmware, Linear Advance 1.0, is performed using three different layer heights. The results are then compared with simulations of the system using Simulink.
Findings suggests that advance algorithms following the presented approach is capable of eliminating defects because of acceleration and deacceleration of the print head. The results indicate a layer height dependency on the associated process parameter, requiring higher compensation values for lower layer heights. It also shows higher compensation values for acceleration than deacceleration. Results from the simulated mathematical model correspond well with the experimental results but predict some rapid variations in flow rate that is not reflected in the experimental results.
As there are large variations in printer design and materials, deviation between different setups must be expected.
To the best of authors’ knowledge, this study is the first to describe and investigate advance algorithms in academic literature.
Tronvoll, S.A., Popp, S., Elverum, C.W. and Welo, T. (2019), "Investigating pressure advance algorithms for filament-based melt extrusion additive manufacturing: theory, practice and simulations", Rapid Prototyping Journal, Vol. 25 No. 5, pp. 830-839. https://doi.org/10.1108/RPJ-10-2018-0275
Emerald Publishing Limited
Copyright © 2019, Sigmund Arntsønn Tronvoll, Sebastian Popp, Christer Westum Elverum and Torgeir Welo.
Published by Emerald Publishing Limited. This article is published under the Creative Commons Attribution (CC BY 4.0) licence. Anyone may reproduce, distribute, translate and create derivative works of this article (for both commercial and non-commercial purposes), subject to full attribution to the original publication and authors. The full terms of this licence may be seen at http://creativecommons.org/licences/by/4.0/legalcode
= cross section of filament;
= cross section of annular section of nozzle;
= cross section of deposited material;
= diameter of annular section of nozzle;
= diameter of filament;
= forces exerted on the filament by the drive wheels;
= forces exerted on the filament by pressure loss in the nozzle;
= forces because of pressure loss caused by friction;
= forces because of pressure loss caused by acceleration of material;
= layer height;
= transfer function of input to output speed;
= compliance of system;
= lag factor of system;
= correction parameter for linear advance;
= length of filament inside extruder;
= length of nozzle outlet;
= friction coefficient;
= pressure loss in nozzle caused by acceleration of material;
= pressure loss in nozzle outlet caused by friction;
= ingoing material volume flow;
= outgoing material volume flow;
= flow rate ( );
= complex domain variable for Laplace transforms;
= ingoing extrusion speed;
= ingoing prescribed extrusion speed;
= Laplace transform of vin;
= outgoing extrusion speed;
= Laplace transform of ;
= printing speed;
= line width; and
= rotational speed of the drive wheels.
For the development of filament-based melt extrusion additive manufacturing, the activity level of the open source and practitioner community has resulted in a multitude of practical techniques and tools being available before they are described and analyzed in academic research. One such widely used aspect, yet less described, is the compensation of defects because of undesirable extrusion dynamics occurring while accelerating and deaccelerating the print head – known as advance algorithms. These algorithms have the potential to substantially enhance the print quality, but they can also impact the performance negatively if they are not correctly configured. There is also uncertainty about how these algorithms are affected by different process characteristics, such as layer height, material, temperature and nozzle geometry.
To be able to investigate these aspects thoroughly, we will first present the algorithms’ background and develop its theoretical foundation, both in terms of mathematical description and graphical block-system design. This would hopefully aid further research on the matter and ease the understanding of the algorithms for practitioners. As most of the work on this subject is conducted by the open source community, the previous work is rarely published and therefore consists of sources outside of the academic sphere.
As a start of investigating the algorithm’s dependency of process parameters, we will perform an experimental procedure focusing on the dependency of layer height and whether the acceleration is positive or negative. These results will then be compared with simulation results of the process using Simulink, which can determine the model validity.
Although trademarked by Stratasys Inc., filament-based melt extrusion additive manufacturing is commonly referred to as fused deposition modeling (FDM), which will be used throughout the article.
Background and objectives
A typical area for defects is in regions of high acceleration or deacceleration of the print head. The most common display of these effects is shown in terms of over-extrusions on corners when printing with a fast pace, as seen in Figure 1.
Generally, the extruder tends to extrude too much material while deaccelerating and too little while accelerating (referred to as over-extrusion and under-extrusion, respectively) as illustrated in Figure 2.
As these defects will severely impact the tolerances at corners, manufacturing fine tolerance clearances or press fits would often require post-processing of the parts by sanding or machining, for removing excess material.
There is a shortage of academic work on extrusion dynamics related to FDM, with the exception of Bellini et al. (2004) who made a thorough exploration of extrusion dynamics using Stratasys equipment, working toward strategies for flow control. They did however have a focus on the electronic circuit, assuming the heat transfer, rate and temperature dependent characteristics to be the root cause of the dynamics.
The first applied open source algorithm attempting to calibrate for the defects, as shown in Figure 1, was through an algorithm called Advance, developed by Matt Roberts (2019). This was later implemented in the widely used Marlin firmware. The algorithm assumed that the root cause of the error was the compression of filament in the extruder combined with the pressure loss in the nozzle due to acceleration of material. Influenced by this work, Bernard Kubicek pointed out that the pressure loss in the nozzle was dominated by friction forces rather than forces due to acceleration (Kubicek, 2019). An algorithm incorporating these ideas was then implemented in the Sailfish firmware by Jetty, Kubiceck and Newman, hence called JKN-advance (Jetty Firmware Manual, 2019). This progress led many firmware developers to develop their own version of this algorithm, and different versions are now implemented in many other firmware, for example, Marlin, RepRap and Klipper (“G-code,” 2019; Kevin, 2018; Sineos, 2018).
Building on the same physical principles of JKN-advance, the developers of Marlin created an algorithm named linear advance, which because of Marlin’s popularity is now possibly the most adopted version. The algorithm was developed and implemented by Sebastian Popp, improved by multiple GitHub users including Scott Latheine and documented by Sineos (2018). As there might be slight differences in the implementational details for different firmware, we will be referring to the Marlin implementation, if not stated otherwise.
Some of the most promising explanations for potential contributions to these deformities are:
deflection of the drive wheel position relative to the nozzle;
compression/deformation of the filament between the drive wheels and nozzle;
deflection/elongation of the guide tube (in case of Bowden-type extruders, using extruder drive wheel mechanism placed apart from the heating assembly, connected by a polymer tube); and
load-dependent phase lag in the extruder stepper motor.
Together with a pressure loss in the molten plastic throughout the nozzle, which increases with material velocity, any of these causes could possibly reproduce the same phenomena.
In the compensation procedure to be described here, the assumed root causes are all modeled as linearly dependent on the rate of the filament extrusion, and hence pooled into single system. The easiest way to describe the mechanism would be using the compression of filament analogy, as seen in Figure 3.
Based on Sineos (2018) and Kubicek (2019), the following procedure could describe a compensation procedure for this type of system. The system is assumed to be quasistatic, so that forces due to acceleration of solid material are assumed negligible. This means that the forces exerted by the drive wheel are equal to those arising from the pressure drop in the nozzle:
Explanation for the symbols are shown in Figure 3. Moreover, the compression or possibly buckling deformations of the filament inside the extruder is assumed to be linearly dependent on the forces in the following way:
As a rough estimate of magnitude of these forces, we would use an example of a standard E3D nozzle (Younge, 2014), with 0.4 mm diameter nozzle (dout), 0.6-mm outlet length (L), used for 1.75 mm filament diameter (din) and at an relatively high extrusion speed of 100 mm/s (vout). We would choose to use polylactic acid (PLA) data as it is the most common material for FDM. PLA is found to exhibit low shear thinning and is therefore assumed to be Newtonian. We assume a density of 1,250 kg/m3 ρ and a viscosity of approximately 200 to 1000 Pa.·s (μ) at 220°C-190°C (Zhou et al., 2006). The forces on the filament due to acceleration of material, named Fa, would be calculated as:
The older advance created by Matt Roberts assumed the Bernoulli pressure drop to be the dominant term, and hence defined:
As shown, there are many factors influencing the pressure loss, and results from one FDM printer setup (machine, material, temperature), might therefore not be the same in another setup.
The ratio between the extruder speed and printing speed is dictated by the slicer, based on the assumed geometry of the printed filament. To prescribe toolpaths, trying to match a sampled geometry outline, slicer software assumes that the cross section of the extruded filament is rectangular with semicircular ends, as seen in Figure 4, which is however only defined for width less than the layer height. Much work has been done on microgeometry of FDM parts, for relating the process parameters to surface roughness. Most notable is the elliptical cross-sections model by Ahn et al. (2009), and the parabolic model by Pandey et al. (2003). These have limitations in practical implementations, as these are based on experimental observations.
Relating the geometric measures to the output geometry gives (Gary et al., 2019):
For accelerating/deaccelerating, equation (3) gives:
Solving for gives:
In the advance algorithms, one simply corrects vin to be equal to , where is the required extrusion speed, as defined by the G-code. This gives:
which for K = KLA would give , as required for a correct extrusion width. The reason for having the 1/Ain factor is because of G-code conventions for most FDM firmware. For a printing move the G-code prescribes the required length of raw-filament needed to extract the correct amount of material as prescribed by the computer-aided manufacturing software, as illustrated in Figure 5.
As FDM printers are most often driven by stepper motors, which are advancing in discrete time/length intervals, this could be implemented in each of these intervals. Calculating the required length of filament at interval n, ΔDn, with time step Δtn, as a function of the requested extruded filament segment in each time step, can be done as follows:
The KLA-factor is in units of seconds, and its magnitude is found experimentally, typically seen in the range of 0.1-0.3 for direct drive extruders, and in the range of 2.0-3.0 for Bowden-type extruders (Sineos, 2018). The presented framework represents most advance algorithms, but some have a scaling factor for KLA, which for the Linear Advance 1.0 from the Marlin Firmware is 512.
It is debatable whether the volume flow is a valid independent variable for this compensation. The material from the nozzle is deposited on a bed perpendicular to the extrusion direction, and there is contact between the nozzle and melt both inside and outside of the nozzle, as seen in Figure 6. This would create a layer height-dependent pressure drop, but the magnitude is difficult to assess because of a complex flow pattern with combined open, moving and stationary boundaries. As lower layer heights are associated with a higher pressure loss (Coogan and Kazmer, 2017), it is expected that lower layer heights also require higher compensation parameters.
For simulation purposes, the solution of equation (7) could be found using Laplace transformation, where the solution of this first-order ordinary differential equation is:
And the transfer function H(S) would be written as:
Although less important for uncorrected flow, for special cases as, for example, overcompensation, might become negative. This would empty the nozzle for material instead of dragging material from the print bed into the nozzle again. During negative , the velocity-dependent friction is assumed neglectable, as no material is moving through the nozzle and the correction of the system for negative speeds in Figure 8 is therefore applied.
The combined system of the extruder and the pre-processing of the speeds using linear advance is as seen in Figure 9.
All these models assume that the mechanical/mechatronic system is flawless and that the method of discretization is irrelevant, and will be used in the Simulink simulation software.
Using an Original Prusa i3 MK2.5 desktop FDM printer, a controlled experimental test for different linear advance values and different layer heights was performed. The test was generated from the test template provided in the Marlin documentation (Marlin Firmware, 2018), which consists of an acceleration from low speed to high speed at values for KLA from 0 to 0.2. Key process parameters are listed in Table I and Figure 10, and simulated results are seen in Figures 11 and 12. The test is only performed for deposition onto the bed, and the geometry and stiffness of the substrate would possibly affect the result.
Figure 11 shows the simulated output extrusion speed for different K values of the system, when linear advance is not applied. Dividing v(K) by v(K = 0) would give the flow rate for the different positions along the test line, as shown in Figure 13. This would to some extent reflect the changes in extrusion width but neglect the geometry of the filament line and extrusion dynamics, after the melt leaves the nozzle. This implies that, for example, the peaks in the flow rate will not be reflected in the extrusion width, as they will be smoothened out by flow dynamics pushing material forward and backward from the nozzle, establishing the path of least resistance. To include these effects would possibly require highly non-linear simulations by, e.g., finite element analysis using mixed Eulerian–Lagrangian formulation and hard-to-obtain rheological properties, and is in this study omitted because of complexity. The implications of displaying flow rate compared to the cross-section model implemented in the slicers (Figure 4) are shown in Figure 12.
Results and discussion
First, we will present the combined results from the tests. Then the results from each layer height alongside a simulation will be presented. Figure 14 displays the results for all layer heights and all correction factors combined, along with a marking that shows the lines that are estimated to have the smallest defects, and hence the more optimal correction factor.
Table II summarizes the findings from the figure. The identification of this correction factor is done by visual estimation only, placing the ideal correction factor half way between the test lines displaying visible defects. As a quantitative result, an accuracy on ideal KLA of less than 0.01 s cannot be guaranteed. Owing to defects in the glued-on polyetherimide (PEI) print surface as well as tolerances of the filament cross section of about ±2 per cent, any higher accuracy would anyways be difficult to achieve.
As seen in Figure 14, the defects get smaller for increasing KLA until a value of around 0.04 to 0.95 for the different layer heights. Using a KLA value of more than twice the optimal one, will result in severe overcompensation to an extent that results in no extruded material when deaccelerating. The experimental study shows that there is approximately 0.01 s−1 in difference between the optimal K-values for acceleration and deacceleration. This is however within the range of the accuracy of our method. It must be emphasized that these values are only valid for our specific setup, as this will possibly be affected by many different parameters.
As hypothesized, there is also evidence for a layer dependency. The ideal compensation parameter is approximately twice as high for a layer height of 0.1 mm than for a layer height of 0.3 mm. This indicates that thin layers generate a significantly higher pressure-loss, which is suggested in literature (Coogan and Kazmer, 2017). However, because of the number of different nozzle geometries, it could be challenging to develop a universally valid layer height compensation function. As this test is quite easy to perform, the results could instead easily be implemented as tabular values in the slicer software.
Figures 15-17 show the full test lines, alongside a simulation using the system shown in Figure 9, applying the identified average optimal KLA value of the system for each layer height to display whether the proposed model can replicate the experimental results. The simulation results are only displayed in terms of extrusion flow rate, , and scaled so that the simulated flow rate is equal in width to the experimental results sampled between the start of the line and start of the acceleration phase, which indicates ideal flow rate (R = 100 per cent). Sample line for h = 0.2 and KLA = 0.06 is used as reference.
For 0.3-mm layer height, the model has a good fit to the experimental data with approximately the same variations in the acceleration zone and the same length of section where there is no extrusion of material. For the lower layer heights, the length of the section with no extrusion is less reflected in the experimental data, as there seems to be a difficulty to make the plastic stick to the print bed while restarting the extrusion.
Comparing the simulation results for flow rate with the experimental results for filament width, both are very similar when there are no large variations/spikes in flow rate. For large variations, the experimental results are smoothened out compared with the simulation results, as illustrated in Figure 18. This discrepancy could be from dynamics of the melt after it leaves the nozzle. It is also possible that this discrepancy is because of high stepper motor load, resulting in skipped steps, as this compensation uses large and discrete velocity jumps when it starts an acceleration. Another reason for the discrepancy could be deflection between the nozzle and print bed because of higher volume flow and hence higher pressure, increasing the layer height in those areas.
When the flow rate is relatively low, the experimental samples are somewhat wider, as illustrated in Figure 19. This is expected, as in this region the assumed extrusion width is less than the layer height. Having such a low flow rate would result in an uncertain shape of the extruded line, as they will not be sufficiently squeezed down onto the print bed.
Summary and further work
The mathematical framework for the so-called advance algorithms is presented, and its effectiveness in compensating for defects because of extrusion dynamics is demonstrated. The algorithm Linear Advance 1.0 from the Marlin Firmware is shown to effectively compensate for irregularities in extrusion widths during acceleration and deacceleration of the nozzle. As hypothesized, the required correction parameters are layer dependent and therefore will need to be tuned for each layer height used in a print. There is also possibly a small difference in optimal correction parameter for whether the acceleration is positive or negative. The mathematical model is, through simulations with Simulink and in comparison with the experimental data, shown to be quite accurate for smooth variations in flow rate. When there are rapid variations in flow rate, the extrusion width seems to be smoothened out in the experimental results compared with the simulations.
As the algorithm enables printing a sufficiently uniform extrusion width for practical purposes, and the mathematical model can replicate that, we believe further work should focus on three areas:
Investigate implications for printing 3D geometry:
non-linear extruder movements; and
substrate stiffness and geometry.
Investigate dependency of more process parameters, e.g.:
specified extrusion width; and
Develop solutions and standards for implementing the process parameter dependency in the printer firmware.
Typical printed shape while print acceleration/deacceleration. 1 – uniform extrusion at consistent slow speed, 2 – defects start during acceleration, 3 – returning to uniform extrusion at consistent high speed, 4 – defects start during deacceleration and 5 – returning to uniform extrusion at slow speed
Direct drive extruder assembly, together with simplified physical model. Forces at nozzle Fn, the length of the filament section inside extruder l, drive wheel forces Fdw and incoming/outgouing material volume flow, Qin and Qout, together with incoming/outgoing extrusion speed vin and vout, printing speed vprint and rotational speed of the extruder drive wheel ωdw
Process parameters for experimental tests
|Layer height (mm)||0.10, 0.20 and 0.30|
|KLA-values||0-0.2 s in 0.01-s increments|
|Line width (mm)||0.48 mm|
|Nozzle size (mm)||0.40|
Ideal correction factors for different layer heights
|Layer height||KLA for acceleration[s]||KLA for deacceleration[s]||Average[s]|
Ahn, D., Kweon, J.-H., Kwon, S., Song, J. and Lee, S. (2009), “Representation of surface roughness in fused deposition modeling”, Journal of Materials Processing Technology, Vol. 209 Nos 15/16, pp. 5593-5600, available at: https://doi.org/10.1016/j.jmatprotec.2009.05.016
Bellini, A., Güçeri, S. and Bertoldi, M. (2004), “Liquefier dynamics in fused deposition”, Journal of Manufacturing Science and Engineering, Vol. 126 No. 2, pp. 237.
Coogan, T.J. and Kazmer, D.O. (2017), “Bond and part strength in fused deposition modeling”, Rapid Prototyping Journal, Vol. 23 No. 2, pp. 414-422.
Gary, H., Ranellucci, A. and Moe, J. (2019), “Slic3r manual-flow math [WWW document]”, available at: http://manual.slic3r.org/advanced/flow-math (accessed 10 April 2018).
G-code [WWW Document] (2019), available at: https://reprap.org/wiki/G-code (accessed 12 September 2018).
Jetty Firmware Manual [WWW Document] (2019), available at: http://makerbot.wikidot.com/jetty-firmware#toc46 (accessed 14 June 2018).
Kevin, O.C. (2018), “Klipper firmware [WWW document]”, available at: https://github.com/KevinOConnor/klipper (accessed 12 September 2018).
Kubicek, B. (2019), “Another acceleration-extrusion compensation for repraps [WWW document]”, available at:http://bernhardkubicek.soup.io/post/168776124/Another-acceleration-extrusion-compensation-for-repraps (accessed 7 June 2018).
Marlin Firmware (2018), “Linear advance calibration pattern [WWW document]. marlin firmware”, available at: http://marlinfw.org/tools/lin_advance/k-factor.html (accessed 4 July 2018).
Mattroberts’ Firmware - RepRap (2019), available at: https://reprap.org/wiki/Mattroberts%27_Firmware (accessed 19 July 2018).
Pandey, P.M., Venkata Reddy, N. and Dhande, S.G. (2003), “Improvement of surface finish by staircase machining in fused deposition modeling”, Journal of Materials Processing Technology, Vol. 132 Nos 1/3, pp. 323-331, available at: https://doi.org/10.1016/S0924-0136(02)00953-6
Sineos, S. (2018), “Linear advance [WWW document]. marlin firmware”, available at: http://marlinfw.org//docs/features/lin_advance.html (accessed 7 March 2018).
Younge, R. (2014), “Drawing of E3D-v6 nozzle series rev.8. [WWW document]”, available at: https://e3d-online.dozuki.com/Document/rWuaQCQsJTlRdB1k/.pdf (accessed 12 October 2018).
Zhou, H., Green, T.B. and Joo, Y.L. (2006), “The thermal effects on electrospinning of polylactic acid melts”, Polymer, Vol. 47 No. 21, pp. 7497-7505.
The authors would like to thank Bernhard Kubicek for his valuable input to this paper. They would also like to thank the whole open source additive manufacturing community for designing quality software and hardware for free. This research is supported by The Research Council of Norway through Project No. 235410. The authors greatly acknowledge this support.
About the authors
Sigmund Arntsønn Tronvoll has MSc in Industrial Mechanics and is a Postgraduate Student in additive manufacturing at NTNU.
Sebastian Popp volunteers as a software developer in the Marlin Firmware community.
Christer Westum Elverum is an Associate Professor in Design and Manufacturing. Christer W. Elverum holds a PhD within prototyping and development strategies in the automotive industry, from the Department of Mechanical and Industrial Engineering at NTNU.
Torgeir Welo is a Professor in Design and Manufacturing at NTNU. Torgeir Welo holds a PhD in plastic bending behavior of aluminum alloy structures from the Department of Structural Engineering, NTH (now NTNU). Industry career includes SINTEF Production Engineering, SINTEF Materials Technology and Hydro Automotive Structures.