-
-
Notifications
You must be signed in to change notification settings - Fork 968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Adaptive Pressure advance #5609
Enhancement: Adaptive Pressure advance #5609
Conversation
Reduce the frequency of requested PA changes by introducing a "state" variable. Implement user toggle for adapting PA for external walls for overhangs
Awesome |
Want to see how it performs. I have 2 use cases for this:
Number (2) has been disproven as a benefit as klipper has a micro stutter when changing PA, causing the reverse effect. I am now testing (1) as the micro stutter shouldn't matter when transitioning features anyway as you're starting to print from a stand still anyway. Hopeful that this will be the major use case but will see following testing. If (1) is also disproven then I will shelve the feature as not needed and having an approximate PA being good enough for most cases. I'll be updating the original post with my test results, but always welcome community testing as I only have 2 printers :P |
This is awesome! Do you use same accel for all the features in your tests? |
I wonder if this would also improve performance for scarf seams due to the change in speed and flow rate. Does the changes in this PR affect scarf seams? If so, I'll try some tests targeting scarf seams :) |
So... Digging a little more: https://klipper.discourse.group/t/pressure-advance-smooth-time-skews-pressure-advance/ From Kevin: "It may be possible to come up with an alternative smoothing system [the smooth time approach] to reduce the amount of over-extrusion during slow speeds. (Possibly by giving greater weight to the desired extruder position at low toolhead speeds.) It’s not immediately clear how to do that though." "It seems an acceptable (smooth time) value is dependent on acceleration - the higher the acceleration the lower the smooth time should be in order to get acceptable results." So it appears we actually have a double whammy and this (the effect of smooth time) is what we are compensating for. I may extend the feature to also consume an acceleration profile for a specific speed value and use the two curves to interpolate between. For reference I have the smooth time set to 0.01 on my printer and this may be the reason why the curve is not ridiculously steep or not as visible as variations between different feature accelerations More research is necessary..... |
No it won't as we must not be changing PA during a feature being printed as this causes proven scaring. So its a no go for this. |
I'm also thinking it might make more sense to use volumetric speed instead of print speed here. At the end of the day, it's all about predicting and compensating for the pressure inside the nozzle. Wouldn't volumetric speed be more precise? If it works, it could make line width, layer height, and even nozzle size agnostic! |
For volumetric speed I need to do PA tests for the same speed and acceleration using different layer heights - that should keep the time dimension constant (speed/acceleration) while only looking at the flow rate. To be honest I'm still trying to triangulate where that non linearity is happening from - if we understand that then we can model it. So far candidates are: For number (2) this is interesting. I would expect that
However from my experience with a 0.25 nozzle, I use a PA value there of 0.048 compared to the avg. of 0.030 or so for the 0.4 nozzle. Which makes sense as higher inherent pressure needs higher PA. However look at this part of the curve here: Maybe the reason it is flattening is because of the increase in pressure reducing the effect of smooth time on the needed PA compensation.... And maybe the reason the curve isn't flattening as much for higher accelerations is because the smooth time effect is larger than the pressure non linearity? What I can tell for sure using experimental data so far:
We need more tests and I need more brains for this!! |
So I’ve run a set of PA tests with varying flows (using different layer heights, keeping speed and acceleration constant) and there definitely is a correlation - lower flow needs higher PA or it looks that way. It’s getting a bit late here so I’ll post results tomorrow |
I ran a quick and dirty test, even though my printer is probably not the main audience for this feature as its a slightly modded ender 3, and I can see some marginal but promising results. My inner and outer walls have smaller/thiner gaps in between each other, there are smaller pinholes for my internal solid infill, and my initial layer is more consistent and no longer has a flattened out edge for the circle that makes the hole of the orca cube. I did also notice slightly worse overhang performance like you already mentioned. |
You shouldn’t have a difference in overhang performance as I’ve disabled the code that was causing the Pa to change before and after an overhang. Curious to what you’ve seen so I can fix it - any chance of a before/after pic for the overhang region? |
Good morning everyone! A bit of an update on flow vs PA. Below is a graph plotting the different PA values as a function of flow rate. Volumetric flow speed based changed using variable layer height: A couple of observations:
Community ask: It would be great if someone with a 0.6 nozzle could verify that their PA is correlated to nozzle size inversely. ie do you use a lower PA for a larger nozzle (with similar geometry) or not? What has the community observed? PS. the only reference I've found related to PA and nozzle size scaling was here: https://www.reddit.com/r/klippers/comments/14dhj2y/comment/joq929v/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button and the user does indeed say that there is an inverse relationship -> larger nozzle -> lower PA which would validate the above results. Converting the code to base the extrapolation on flow is a piece of cake (the interpolator doesn't care what values you put in anyway), so once we have some positive confirmation that this trend continues with larger nozzle sizes (reducing PA the larger the flow rate) I will convert the code from speed based to flow rate based which would have some very cool side benefits if the correlation holds:
|
I use significantly lower pressure advance with 0.6mm nozzle compared to 0.4 when printing. I mainly print PETG, and 0.6mm nozzles have a PA value of 0.012 while for 0.4mm it's 0.045. So seperate PA curves for each nozzle size is probably still needed, probably due to the viscosity of PETG so it has a much harder time going though 0.4mm nozzles? |
It's probably because I didn't spend much time making sure that the PA values were the best ones to use and using an old and crappy filament. I'll do some more through tests once I have some good filament. |
Done code updated :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good!
Thank you so much for another great feature!
Very cool work guys. Has anyone tested on Bambu printers to see how the firmware responds to rapid PA value changes? |
Ask on Discord, not here |
I have an X1C but due to time constraints with work I haven’t managed to test it with it yet. The option is available (ie I didn’t limit it) so feel free to experiment with it and report back :) |
This reverts commit 529c44d.
@igiannakas do you planning add a combined calibration test for this? |
Not in the immediate future (as in the next month or so) due to some family priorities this summer. But from autumn yes it makes sense |
feature is really nice. thanks for your efforts on this but requires proper calibration |
hi how i can test this feature ? where i can download it or mey be some guide how to install this )) |
It's in the latest nightly release. No need to install anything. Your printer needs to have the latest klipper version installed on it ideally to avoid artefacts. You'll need to follow the instructions on the first post on how to calibrate your printer, but in general you want to run a bunch of PA tests, for different speeds (50-100-150-200) and accelerations (1k,2k,4k) typically is enough. The max acceleration you test needs to be below the max shaper value recommended by Klipper to avoid artefacts. Finally take note of the PA value per acceleration and the corresponding volumetric flow rate at that speed and enter these values in the place shown above. |
Thx
пт, 16 авг. 2024 г., 15:10 Ioannis Giannakas ***@***.***>:
… hi how i can test this feature ? where i can download it or mey be some
guide how to install this )) thx
It's in the latest nightly release. No need to install anything. Your
printer needs to have the latest klipper version installed on it ideally to
avoid artefacts.
You'll need to follow the instructions on the first post on how to
calibrate your printer, but in general you want to run a bunch of PA tests,
for different speeds (50-100-150-200) and accelerations (1k,2k,4k)
typically is enough. The max acceleration you test needs to be below the
max shaper value recommended by Klipper to avoid artefacts.
Finally take note of the PA value per acceleration and the corresponding
volumetric flow rate at that speed and enter these values in the place
shown above.
—
Reply to this email directly, view it on GitHub
<#5609 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATOLAU6TBX3XUNEGCFPOUIDZRXT2XAVCNFSM6AAAAABI4VUKQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGM4TENRRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'd like to see a pre-made test so I don't have to create a lot of models and settings manually, thank you! |
Yes, that would be great. |
I'm using the translator to send this message, and this feature is really good. However, it's very tiring to use, especially for those with the Creality K1C. It's not quick to start printing, so imagine running this test 20 times. But what could help is if the ORCA allowed placing more than one test on the bed to speed up the process. I tried combining two G-codes, but I couldn't because the first layer of the second test doesn't adhere to the bed. Thank you so much for everything you do. You guys are doing an excellent job. Let me know if you need any adjustments! |
I know I need to make a calibration test for it as it takes a while to run 16 or so PA tests to get a good profile. in the mean time also check out the wiki page for the feature - it explains in detail how to run it. https://github.com/SoftFever/OrcaSlicer/wiki/adaptive-pressure-advance |
oh im so happy to see this PR. great work ! i have been having this issue for a while. this will be awesome :) |
As from what I learned, printing speed is not the problem but acceleration. Bambu's Pressure Advance Algorithm does in contrast to Marlin's Linear Advance not modify print acceleration but only extrusion (as far as I know). Print acceleration also has to be reduced the higher you set the K value, to give the changes in extrusion speed enough time to compensate for the filament compression that happens between the feeder and the tip of the nozzle. This is why they've added this to Linear Advance. They had realized that modification of only the extrusion speed is not enough to compensate for higher filament compression, caused by soft filament and/or higher speeds respectively higher acceleration. I've read this in the comment to the commit where it was accomplished. High K values are needed for flexible filament like TPU. I need depending on filament brand, shore hardness, nozzle temperature, hot end (E3D Obxidian e.g. is totally different from the stock hot end in this regard), nozzle diameter and layer height a K between about 0.15 and 2.5(!!!). This only works if I also reduce acceleration (and also jerk) radically. |
The algorithm looks at two parameters: speed is used as a proxy in order to run the calibrations but the model is based off volumetric flow rate. the higher the layer height, the greater the flow rate for the same speed and similarly with nozzle sizes. So I believe you can use the same model for this. You also have the option to completely disregard acceleration or flow rate from the calibrated model - if you set the values to be all the same the model ignores them. |
I`m so curious if now with this features will have better seams when using 0.6 nozzle and 0.25 layer height |
it looks fantastic! nice job! what filament is that it looks beautiful! |
In my understanding it's not the flow rate that affects the K parameter as the PA algorithm is designed to have a K parameter that's independent of the flow and thus the printing speed, but the resistance of the the filament to being pressed out of the nozzle. Every parameter that increases that resistance causes a higher filament compression inside the extruder (between the feeder and the ground where the molten filament is laid on, like the plate or the previously printed layer). These parameters are mainly the liquidity of the molten filament which depends on the nozzle temperature, the nozzle diameter and the layer height, where with wider nozzles and higher layers K quickly converges towards zero. PA tries to compensate for the extrusion latency caused by this filament compression. As I understand, it's not a physically correct implementation but only an approximation, but does not depend on the flow rate. The only issue is that the faster you print, the more visible will the defects from a not perfectly calibrated K parameter become, so optimally you should calibrate K using the maximum printing speed you will be using. This is also what Marlin's Linear Advance documentation essentially is saying ("Fast Printing Speed and Slow Printing Speed should be significantly different or the K-factor effect will barely be visible."). During my testing I've never experienced the flow rate depending problems that caused this pull request and I was one of the first who embraced LA and later PA where other people laughed at me when I was trying to tell them that it's not possible to print a line that maintains a homogeneous cross section throughout its whole length without using and properly configuring one of those two algorithms. So IMHO what we need is an implementation that accounts for just nozzle diameter and layer height and a function which reduces acceleration (and maybe also jerk) when K increases to simulate what Marlin's Linear Advance does but is missing in Pressure Advance so that PA will have enough time to compensate for very high filament compression (high K values) which happens when printing TPU and other flexible filaments. |
0.16 LH/0.4 nozzle / 3k external accel / 150mm/sec external perimeters. Voron 2.4 350 with Galileo 2 extruder and Voron revo plus ERCF v2 |
This has been merged. Further discussion should take place in the Orca Discord server. |
This reverts commit 529c44d.
Official wiki write up and instructions are here: https://github.com/SoftFever/OrcaSlicer/wiki/adaptive-pressure-advance
———
How picky are you about getting your PA tuning absolutely nailed for sharp corners but also no gaps between perimeters? This feature aims to bring PA tuning closer to perfection by reducing the compromises made when picking a single ideal PA value. The benefits are not earth shattering, but if you are picky about print quality, they are there.
I will leave this PR at this stage of development for now and would love your feedback and observations. It works, doesn’t appear to be causing any bugs, it’s just not fully optimised code wise yet
This PR is a long read but hopefully it will be useful :)
EDIT: Feature has been revamped to cater for accelerations and volumetric print speeds together, creating a 3 dimensional PA model that is used to derive the most appropriate PA against both different accelerations, print speeds, layer heights and line widths!
Testing is needed to demonstrate value and any adverse effects and whether we can mitigate them.
The description below has been updated with the revised workflow.
Feature Description and approach
What I and others have noticed is that the PA value needed to avoid artefacts is less the faster you print and the higher the print acceleration is. (see credits in the end and user submitted test results in this PR).
To demonstrate this I've run a series of tests from 50mm/sec to 200mm/sec at 3k acceleration, 0.2 LH and 0.015 and 0.005 smooth time.
From left to right at 50-100-150 & 200 mm/sec and 200mm/sec at 0.005 smooth time with constant acceleration at 3k.
Next I run a series of tests for the same speeds (50-100-150mm/sec) with constant acceleration at 10k
What this means is that we never get ideal PA values for each print feature. We can tune PA for a faster print speed but compromise on corner sharpness for slower speeds or tune PA for corner sharpness and deal with slight corner perimeter separation in faster speeds. Same for accelerations.
This compromise usually means that we tune for an "in between" PA value between slower external features and faster internal features so we don't get gaps but also not get too much bulging in external perimeters.
In this PR I am aiming to address this limitation of the current way to use Pressure Advance by proposing a completely different method of setting pressure advance.
In this PR we are enabling the slicer to model the extrusion behaviour for different PA values vs. volumetric flow speed vs. accelerations and use that model to emit the best fit PA for any arbitrary feature used in the print process.
As a bonus, depending on the profiles created it may mean that you only have to tune this feature once and print across different layer heights and different nozzle sizes with good PA performance.
What is volumetric speed?
In this model we are using the volumetric print speed - this is basically calculated as
Luckily Orca displays the volumetric speed in the sliced model so there is no need to do any calculations. It's called "Flow". This is proportional to the print speed as well as layer height and line width. So by keeping the layer height and line width constant in testing we can vary the print speed to get the PA results for different flow speeds.
PA testing workflow:
Screenshots of the workflow:
Step 1: Enable "Enable adaptive pressure advance (beta)" in the filament section
Step 2: Run the above PA tests for your filament
Step 3: Add them to the box, one test at a time - PA value,coma (,),tested flow speed,coma (,), tested acceleration. Save the filament profile. Make sure the value set in the pressure advance box above the options is a reasonable default as it's still used if the model fails for any reason.
Step 4 Add a model & slice. Observe the PA values changing when there is a change to the extrusion role (i.e. when printing internal perimeters and then going to external, when going from perimeter to bridge, etc). The PA value is then calculated based on the upcoming feature print volumetric speed and acceleration.
For example:
All features having the same / similar volumetric speed but different accelerations
Now with all features having the same acceleration but drastically different volumetric speeds:
Now for a combo of both - notice how the fast accelerating and high speed internal sparse infill has significantly lower PA than the walls which are slow accelerating and printing slightly slower too.
Now lets try a lower layer height:
PA set to 0.029 for the internal wall vs. 0.026 before :)
Why create a model instead of simply 4-5 PA pairs?
An alternative approach would be to submit a list of values (PA & speed) and let orca use these if the printed feature speed matches exactly.
The approach in this PR is more flexible. If the values match exactly, the exact PA will be used (due to the choice of regression model there is no deviation from the provided values). However, if they don't match exactly, because the user has picked a different speed and acceleration than the one PA was calibrated to, this approach will still estimate a reasonable PA value to use, granting more flexibility.
What interpolation model to use?
PCHIP is the preferred model as it has zero delta error from the submitted values (ie there is no deviation from the submitted PA/speed value pairs and the model response). It also will always return a value that is never higher than a linear interpolation between the two consecutive data points. This is important, as we don't want unpredictably higher values than if a straight line was drawn between the two samples, which can happen with spline/cubic etc modelling.
A set of models that were run through fitting is below for my initial tests:
We can indeed see that PCHIP is the preferred model as it doesn't over shoot from the general data trend, always returns the given PA value if the speeds match and smooths out the "curve" between the sampled points.
Preliminary conclusions and testing next steps:
It appears that adaptive PA can marginally improve print quality by better matching PA to the printed feature speed and acceleration. The largest benefits come from
This feature will NOT benefit the widest audience as the standard implementation of PA is meeting 95% of user's expectations. However if you want the last 5% it may be for you.
It will also benefit users that have a less constrained filament path between the extruder and the hot end - as this would typically require higher PA values hence the delta would be amplified. In addition, anyone still using a Bowden printer should see a benefit as seen in the links in the credit section below.
However to really notice the difference your printer needs to be spot on - EM, extruder in good mechanical health and a good design and your printer mechanics working well.
As I am a big fan of developing features that I will be using daily - from my side this is something that I will enable across all my filaments. The benefits are marginal, but they are there. As I will be daily driving this I'll let you know if I observe anything further.
I will leave this PR at this development point for now and would love your feedback and observations.
Status & ToDo:
MVP development
Testing:
Known potential issues:
Refactoring and tuning
Credits:
Inspiration for this feature was taken from the below community conversations and implementations.
Testing:
Hypothesis 1 (and the main use case) - Prove or disprove whether adapting PA when printing using widely different speeds would result in sharper feature edges.
When printing infill with 250+mm/sec, internal walls at 200+mm/sec and external perimeters at 50mm/sec the PA needed to ensure sharp feature edges with no perimeter gaps is different (as illustrated from the PA tests above).
Therefore the hypothesis is that varying the PA based on feature speed would result in sharper edges with less perimeter gaps and remove the existing potential compromise.
Testing profile below for my Voron 2.4 350. Using poly terra grey PLA as its the most revealing filament I have :)
With adaptive PA enabled:
Testing for wall artefacts on overhangs
Test shows no artefacts where the slowdowns begin. That is expected as we are not changing the PA in those regions. However there is ever so slight bulging after the corner of the overhang, which could be attributed to needing even higher PA. However check Hypothesis 2 below for relevant test and results.
Testing for corner performance
This looks exceedingly good to me. Absolutely no bulge in the corner. Just the smooth rounding caused by the SCV of 5mm/sec
No cover perimeter separation at all.
Testing for seam performance
Again this looks excellent. Absolutely no bulge at the seam.
Testing for top surface performance
Again this looks excellent. Absolutely no gaps, pinholes, under extrusions or over extrusion.
Testing for solid infill performance
Again very good - very smooth and connected to the perimeters. My overlap for internal solid infill is at 10% so there are some expected pockmarks.
Testing With Adaptive PA disabled and PA set to the value that gives good corner performance at slow speeds (50mm/sec)
In this "before" test I've disabled adaptive PA and set the static PA value for the filament to 0.04, which gave me the best corner performance when extruding at the external perimeter speeds.
As expected that PA value was too high for the faster internal features resulting in the typical issues you'll see happening from it.
Testing for corner performance
External corners look excellent; however slight perimeter separation on the faster internal perimeters. Typically this won't be visible to the outer shell as you can "hide" it using one wall top and bottom surfaces; however it is not performing as expected and won't pass the quality mark for something like PIF.
Testing for top surface performance / solid infill performance
We can clearly see that the PA is too high for the faster internal solid infill here as there is under extrusion when the solid infill begins/ends
Seam performance and overhang performance
This is unchanged as expected as we have tuned the PA for the slower external perimeter
Testing With Adaptive PA disabled and PA set to the value that gives good corner performance at fast speeds
The PA value for the below test was set to 0.026 which is the correct value when printing faster features in the range of 150-250mm/sec. This would be the value I would typically select when tuning the printer without this feature as it gives absolutely no perimeter gaps and a reasonably good external surface performance.
Observations:
So this is an interesting one.
Corner performance:
Admittedly this is very good and I would consider this as close to excellent too.
However upon closer inspection you'll notice the below:
The static PA test starts taking the corner later compared to the adaptive PA. This is incorrect due to the SCV being applied uniformly. You'd expect a perfect radius here. However this may give the appearance of a sharper part but the corners will not be uniform leading into them and moving away from them. They will always be sharper going into the corner than coming out of them, if that makes sense.
So adaptive PA takes the win here, but marginally. You can feel the difference in your hand but honestly, both parts are acceptable. Again, how picky are you about your PA....? :)
Seam performance:
Again another interesting test here - again the performance on first look appears great (and it is!).
However what you'll notice if you compare the two seams side by side is that the adaptive PA has an ever so slightly better controlled seam where the arrow is.
Wall printing performance:
This I did not expect and we need to do more tests to verify this or disprove it. It appears that the adaptive PA gave a slightly better wall finish to the print, coming out from an overhang. This may be expected as the extruder is pushing out now closer to the correct volume of material compared to the speed its printing so there is less random over extrusion when accelerating? All in all the surface finish appears improved with the adaptive PA.
Hypothesis 2 - Prove or disprove whether adapting PA when transitioning from printing external walls at the external wall speed to a (slower) external wall overhang region would show any benefit by having the right PA for that overhang speed.
When printing an external wall surface, there can be significant variation in print speed when transitioning from a fast print move printing the external walls, to a slower print move printing an overhang region. This would mean that the overhang is printed using a sub optimal PA (too low) potentially causing corner edges to slightly bulge.
Test performed:
Printed the orca cube at 150mm/sec external perimeter speed and slowdown for overhangs enabled, going down to 20mm/sec for the 75-100% overhang region.
Print results below:
Conclusion:
It appears that when changing PA when transitioning from a faster speed to a slower speed for an overhang causes feature bulging. This is the opposite of what is expected as the PA emitted is higher than the regular external wall PA. The assumption was that this would cause the opposite and "tighten" up the overhang regions.
After analysing some slow motion footage of the extruder I can see an ever so slight movement stop that is barely visible to the naked eye but is enough to cause that slight feature deformation.
This means that:
I have left this feature available for testing; but most likely it will be removed in the future unless tests to the contrary are provided.
After these results I have hidden this option in the GUI as it has adverse effects. If anyone wants to test this reach out.
Hypothesis 3 - Prove or disprove whether adapting PA when transitioning from printing a faster perimeter to an overhang perimeter or bridge could improve bridging performance and post bridge extrusion consistency
To be tested.
**Hypothesis 4 - The PA behaviour is tied to volumetric flow speed instead of print speed exclusively.
Initial tests seem to indicate that there is a positive correlation between flow speed and PA. The feature has now been revamped to use the volumetric flow speed instead of the print speed.