yarf 0.1
Yet Another RepRap Firmware
|
Extruder advance pressure management system. More...
Go to the source code of this file.
Extruder advance pressure management system.
The displacement to apply to the spring to achieve a certain desired flow rate (mm/sec of extruded material) can be calculated using Hooke's law and Bernoulli's principle of incompressible fluids: Hooke's law: F = kx (eq. 1) Where F = the force exerted by the spring in N or kg*m/s² k = the spring constant of the specific spring used in N/m or kg/s² x = the displacement of the spring's end from its equilibrium position in m Bernoulli's principle: V²/2 + g.z + P/r = constant (eq. 2) Where V = desired flow rate in m/s g = acceleration due to gravity in m/s² z = height above 'ground' in m P = pressure in N/m² or kg/(m*s²) r = density in kg/m³ We also know that the total volume of material going into the extruder must come out of the extruder at the bottom. This allows us to relate the ingoing material speed Vin to the outgoing material speed Vout: Vin * Ain = Vout * Aout (eq. 3) Where Ain = surface area of the material going in (material area) Aout = surface area of the material going out (nozzle area) Model: | | | Pa + Ps: atmospheric pressure + pressure by spring | || \|/ | Vin: flow rate of material going in (mm/min) | || ' | |_____||_____| | | | | | | |____ ____| | | Pa: atmospheric pressure Vout: flow rate of material going out Simplifications and assumptions: * We ignore the difference in height above ground at the top of the extruder and at the bottom near the nozzle. * We assume the density of the extruded material is constant at all points in the extruder. This leads to the following derivation: Vin²/2 + g.h + (Pa + Ps)/r = Vout²/2 + g.h + Pa/r /\ || (by eq. 3) \/ (Vout * Aout/Ain)²/2 + (Pa + Ps)/r = Vout²/2 + Pa/r /\ || \/ (Vout² * Aout²/Ain² - Vout²)/2 = (Pa - Pa - Ps)/r /\ || \/ (Aout²/Ain² - 1)/2 * Vout² = -Ps/r /\ || \/ Vout² = 2/(r * (1 - Aout²/Ain²)) * Ps So the square of the outgoing flow rate is proportional to the pressure applied on the material by the spring (which is what we would expect). Now we can use Hooke's law to write Ps in terms of the spring displacement: Ps = k * x / Ain Which leads to: Vout² = c * x With c = (2 * Ain * k)/(r * (Ain² - Aout²)) in m/s² Which can be rewritten to: x = Vout²/c Where we can view x as the 'advance' distance needed to obtain the flow rate Vout. Now, all of the above calculations assumed we are given the desired _output_ flow rate from the host. However, since Skeinforge 40, the popular Dimension plugin specifies the desired _input_ flow rate. Luckily, we can easily convert between the two using equation 3: x = (Vin * Ain/Aout)² / c Which simplifies to: x = Vin² * c' With c' = r * Ain * (Ain² - Aout²) / (2 * k * Aout²) in s²/m Vin is the instant extruder feed rate, which changes during acceleration and deceleration. We can get the 'overall' instant output feed rate based on the number of timer ticks between two steps: f = TICKS_PER_MIN/timer_ticks_per_step * mm_per_step in mm/min Normally, the instant extruder output feed rate is equal to the 'overall' instant feed rate, because the extruder should extrude exactly the length of filament that it travels above the build platform. However, the host software might want to pull some tricks by extruding more or less filament. To support this, we can calculate the instant input extruder feed rate by multiplying f by the block's direction vector e-component: Vin = f * direction[E_AXIS] = TICKS_PER_MIN/timer_ticks_per_step * mm_per_step * direction[E_AXIS] in mm/min Unfortunately, using the instant input extruder feed rate to calculate the advance steps seems to give some problems due to the limited precision of the input g-code commands. This can cause some strange behaviour where filament is extruded and retracted for no apparent reason. Therefore, it might be prefered to base the advance calculations on the overall instant input feed rate afterall, which can be calculated as follows: Vin' = f * (FILAMENT_OUTPUT_AREA / FILAMENT_INPUT_AREA) = TICKS_PER_MIN/timer_ticks_per_step * mm_per_step * (FILAMENT_OUTPUT_AREA / FILAMENT_INPUT_AREA) in mm/min By setting the ADVANCE_BASE_FEEDRATE_E configuration option, the instant input extruder feed rate Vin will be used. By disabling the ADVANCE_BASE_FEEDRATE_E configuration option, the overall instant input feed rate Vin' will be used instead.
Definition in file advance.h.