Pressure Advance Calibration
-
A g-code question...
Will these produce a different result for calibrating pressure advance, if so, which of them is best?
G1 X0 Y0 F12000
G1 F4200
G1 X0 Y30 Ex.xx
G1 X0 Y60 Ex.xx F1200
G1 X0 Y90 Ex.xx F4200or
G1 X0 Y0 F12000
G1 F4200
G1 X0 Y30 Ex.xx F4200
G1 F1200
G1 X0 Y60 Ex.xx
G1 F4200
G1 X0 Y90 Ex.xxWill the top one be interpreted as a linear interpolation of the feedrate between the start and end point and the second one be a more instant acceleration?
-
They should both be treated exactly the same.
-
@dc42 That's a little bit contradictory to what's written in the feedrate part of G0/G1 documentation: https://duet3d.dozuki.com/Wiki/Gcode#Section_G0_G1_Move
G1 F1500
G1 X50 Y25.3 E22.4
In the above example, we set the feedrate to 1500mm/minute on line 1, then move to 50mm on the X axis and 25.3mm on the Y axis while extruding 22.4mm of filament between the two points.
G1 F1500
G1 X50 Y25.3 E22.4 F3000
However, in the above example, we set a feedrate of 1500mm/minute on line 1, then do the move described above accelerating to a feedrate of 3000 mm/minute as it does so. The extrusion will accelerate along with the X and Y movement, so everything stays synchronized.
Feedrate is treated as simply another variable (like X, Y, Z, and E) to be linearly interpolated. This gives complete control over the acceleration and deceleration of the printer head in such a way that ensures that everything moves smoothly together, and the right volume of material is extruded at all points. The feedrate specified may not be reached due to a lower feedrate limit being configured, or the move being too short for the axis to accelerate and decelerate in time. -
@dc42 Why doesn’t RRF use jerk in those cases?
-
@rcarlyle said in Pressure Advance Calibration:
@dc42 Why doesn’t RRF use jerk in those cases?
The reason for having jerk is so that if you print a curve made up form short line segments, the print head can maintain a constant speed. Without jerk it would have to stop at the boundaries between segments, to avoid an instantaneous change in X or Y speed due to the small change in direction. Jerk is not required in other cases.
-
@dc42 If jerk benefits you on extrusion-extrusion corners, it will also benefit you on starts, stops, travel-extrusion changes, and extrusion-travel changes. From a speed standpoint at least, if not so much blobbing. I could see it affecting performance of coast, as well, if you slow to a stop between the last print segment and the start of the first coast segment. What’s the downside of doing it?
Another question if you don’t mind, since we’re talking about it... does RRF ever use different entry/exit speeds at the same corner? For example, if two colinear segments have different feedrates, will RRF decel all the way to the new speed, or will it jerk at the corner?
-
@rcarlyle said in Pressure Advance Calibration:
@dc42 If jerk benefits you on extrusion-extrusion corners, .....................
But does it offer a benefit? My take on it is that "jerk" or instantaneous speed change is just horrible (as it's name implies). As David has pointed out, it is necessary for segmented curves otherwise the print head would have to decelerate to a complete stop at the end of every segment, before starting the next so the time to complete a segmented arc move would be just too long. The same could be said for any situation where there are a series of very small moves. The only "benefit" is that it saves time in those situations but in terms of motion control, it's just horrible. I just think of "jerk" as a necessary evil that we have to put up with.
-
Using XY jerk on starts/stops etc. would require intentional extruder jerk too. In order to apply pressure advance to a move that requires extruder jerk, it would be necessary to instantaneously advance or retract the filament by the appropriate amount (the amount of extruder jerk required multiplied by the pressure advance time). That's even more impossible than changing the speed instantaneously.
-
@deckingman said in Pressure Advance Calibration:
I just think of "jerk" as a necessary evil that we have to put up with.
Based on some experimentation I theorize that some "jerk" might actually be advantageous and make the motion smoother. Consider the motion platform a dynamic system (difference in actual vs commanded nozzle position). This can be modeled as a spring-damper system, which models e.g. ringing artifacts. "jerk" effectively puts some pre-tension on the spring in this system which in some of my tests seems to lead to a more faithful adherence to a linear acceleration profile, and in turn make the assumption pressure advance is based on more accurate.
-
@dc42 other firmwares use extruder jerk with no issues. High E jerk is commonly used to improve retraction performance with geared 3mm filament extruders. Sailfish even allows small instant position jumps with E axis pressure advance. It works great!
Remember, there’s a “torsion spring” torque/error relationship between the stepper driver’s coil energization angle and the physical rotor angle. A position jump of a few microsteps just rapidly changes the instantaneous torque on the rotor. There’s absolutely nothing wrong with doing that on an extruder which is highly damped. In fact, I would say it’s highly desirable since it lets you unload the built-up pressure/compression a lot faster.
Imagine an extruder pushing right up near stall (one full step of load angle) and you want to retract. Why would you gradually accelerate through the ”dead travel” of >1 full step of coil energization angle between peak forward torque and applying reverse torque?
-
@RCarlyle, I understand what you are saying, especially in regard to using extruder jerk or position jump to increase initial retraction speed. Maybe I will implement that. However, the movement in 3D printer firmware seems to be in the opposite direction, towards using S-curve acceleration. Once we have S-curve acceleration it becomes possible to compensate for elasticity in the motion system.
-
After going from rods to lineat Hiwin guides I tried your test print. This is the results I get.
I'm no expert so I would like to know what could be done to better the print.
Thanks for the info and any help
-
@dc42 what’s the thinking on how you improve elasticity compensation with S-curve motion? (Not disagreeing; just don’t know what the approach is)
-
@synapsis, it's a bit hard to see from that photo, but here's roughly what I think you see:
It's a bit weird that the four different bands look so different from each other. What are your jerk and acceleration settings? What type of extruder?
For the right setting here, I'd try the orange arrow location. Above it pressure advance is too aggressive leading to under-extrusion during deceleration.
-
@rcarlyle said in Pressure Advance Calibration:
@dc42 what’s the thinking on how you improve elasticity compensation with S-curve motion? (Not disagreeing; just don’t know what the approach is)
My thinking is this. Let's assume a Cartesian printer for now. In order to accelerate (say) the X axis, the motor and belt have to impart a force to the head given by F=ma. But the belt and the motor are springy, so in order to really impart force F to the mass of the print carriage, the motor must move by an additional amount S=ma/k where k is the spring constant. If the acceleration changes abruptly, then this requires instantaneous changes in motor position, which are impossible; but if we use S-curve acceleration then the required changes in motor position are gradual and should be achievable.
-
Thanks for the reply. my setting at the moment are
M92 X160 Y160 Z3200 E837 ; Set axis steps/mm Set extruder steps/mm
M350 X16 Y16 Z16 E16 I1 ; Set 16x microstepping with interpolation
M566 X500 Y500 Z150 E500 ; Maximum jerk speeds mm/minute
M201 X1200 Y1200 Z18 E800 ; Accelerations (mm/s^2)
M203 X12000 Y12000 Z120 E12000 ; Maximum speeds (mm/min)
M906 X1200 Y1200 Z1800 E1200 I30 ; Set motor currents (mA)extruder current just enough will click not stripI have a Titan Aero and have set my pressure advance to the settings that are in the first post. Opps just seen that in fact there are 0 and not 0.074 I try and take a better picture in day light.
-
Here are measurements from three different step functions in extrusion rates:
And here they are individually:
I'd not completely trust these measurements. There is some hysteresis in the measurement jig that makes these values not perfectly repeatable (probably varies by up to ±5 % when remeasured), and the lower speed extrusions suffer from some extrusion pulsing that makes a width measurement more questionable. That being said – the general shape and trends should be fairly accurately captured.
Let's try to create a simple model: Assume there is a property p that roughly corresponds to what one could call 'pressure' inside of the hot end, and let's assume the rate of change of this property with time corresponds to
p'(t) = i(t) - o(t),
where i is the input rate (feed rate) of filament into the hot end, and o is the output or extrusion rate of molten plastic from the nozzle. We then assume that the extrusion rate is a function of this property p: o = f(p). The simplest possible function is a simple linear correspondence:
o = k*p
for some k. Substituting this function into the change rate p'(t) gives:
p'(t) = i(t) - k*p(t),
Which gives a simple differential equation. Fitting this to the data to find the model parameter k yields the following results:
The optimal model parameter found was k = 6.507 (the unit for i and o is mm^3/s). While this extremely simple model is obviously not a perfect fit (there seems to be some second order lagging extrusion), it still seems to explain most of the observed behavior.
@dc42, would this model be similar or even identical to the one currently used?
-
Yes, that's the same model as assumed by the pressure advance algorithm.
Have you tried repeating the measurements with pressure advance of about 0.2sec applied?
-
@dc42 said in Pressure Advance Calibration:
Yes, that's the same model as assumed by the pressure advance algorithm.
Cool. Thanks for confirming!
Have you tried repeating the measurements with pressure advance of about 0.2sec applied?
Yes, but in short it doesn't work. Pressure advance doesn't seem to be applied when doing extruder feedrate-only changes like I do here. E.g.
G1 X40.000 Y100.000 G1 X140.000 Y100.000 E2.4945 F3600 G1 X200.000 Y100.000 E3.4923 F3600 G1 X260.000 Y100.000 E1.4967 F3600
Outside of this test – running pressure advance with a time constant of 0.2 leads to severe under-extrusion during deceleration moves. It is a direct drive non-bowden extruder where I get best results with pressure advance of around 0.08s.
Here's another more precise measurement with a corresponding linear model fit.
The lagging extrusion compared to the model on the last positive impulse is curious and consistently repeatable. My only hypothesis so far is that the extruder melt pool cools down during the high rate impulses sufficiently to increase the viscosity and slow down the response – but that's far fetched. It shouldn't be related to deceleration since the acceleration ramp should be much much shorter (0.03 s) than the scale here.
-
I'm sorry, I forgot that pressure advance won't be applied to changing extrusion feed rates, if the change in feed rate is within the extruder jerk setting so no deceleration and acceleration is needed. This is because applying pressure advance would need an instantaneous movement of the extruder stepper motor. Changes in extrusion per unit travel without a speed change are fortunately not usual when 3D printing.
Can you do a similar test with the extrusion amount per XY distance moved kept constant but the speed changed? That will cause normal acceleration/deceleration profiles to be used and pressure advance to be applied.
I am surprised that your model appears to show an extruder time constant of about 0.2sec, when 0.08sec works better with your printer (and is a more reasonable value to use with a non-Bowden extruder). Are you sure you have computed the time scale correctly?