Skip to content
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

Open
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

igiannakas
Copy link
Contributor

@igiannakas igiannakas commented Jun 6, 2024

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.
IMG_3874

Next I run a series of tests for the same speeds (50-100-150mm/sec) with constant acceleration at 10k

IMG_3907

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

  1. The amount of filament in mm3 that is extruded from the nozzle per mm of movement
  2. Multiplied by the speed the toolhead is printing at.

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.

image

PA testing workflow:

  1. The user runs at a minimum 6 PA tests for a filament and submit them to Orca.
  2. The tests should be run to cover the slowest volumetric flow speeds, the fastest ones as well as the slowest and fastest print accelerations the user is typically using. Typically these are the external wall accelerations, sparse infill accelerations and a value in between as well as the slowest and fastest print speed and one in between.
  3. In my example below I have used 50mm/sec, 100mm/sec, 150mm/sec and 200mm/sec across 3k and 10k accelerations.
  4. The user takes note of the optimal PA values, the corresponding volumetric flow speeds that the test was executed at and the acceleration used. To find the volumetric flow speeds, check the screenshot below.
  5. The user submits the pairs of PA values and volumetric speeds to Orca, in a new text box in the filament settings.
  6. Orca uses the PCHIP (Piecewise Cubic Hermite Interpolating Polynomial) curve to fit against the submitted PA values and volumetric speeds. It then uses the same model to fit between different accelerations. The models are calculated at slice time and the resulting PA for a given volumetric speed and acceleration is emitted to the printer ahead of commencing printing that feature.

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.
image

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
image

Now with all features having the same acceleration but drastically different volumetric speeds:
image

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.
image

Now lets try a lower layer height:
PA set to 0.029 for the internal wall vs. 0.026 before :)
image

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:
50B5324C-4B28-4666-B5E9-BF668221B8C8

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

  1. Marginally improved corner performance
  2. Marginally improved surface finish
  3. No pin hole gaps between perimeters when cornering if your PA was tuned too high.
  4. More leeway when using printers that do not control the extrusion as well as the examples above - for example nozzles with large melt zones may have a much steeper PA curve than mine (all tests done with a revo 0.4 HF obxidian nozzle which has excellent extrusion control due to the limited melt zone).

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

  • Validating hypothesis that different speeds require different optimal PA values - Done
  • Identify most suitable regression analysis model to fit experimental data. - Done
  • Develop option initial "plumbing" in the UI - Done
  • Develop regression analysis class (PCHIP). - Done & tested interpolation model with sample code
  • Integrate dynamic PA with slicing code - emit new PA values per speed change - Done
  • Integrate with filament settings instead of hard coded values - Done
  • Refactor code to reduce unnecessary emitting of PA changes if the PA value has not changed from the current one. - Done
  • Milestone 1 - Code is functional for POC testers Done

Testing:

  • Validate overall feature benefit or lack thereof with community support - Done. See below.
  • Validate whether dynamic PA would benefit print quality when speeds change while printing the same feature (eg. when slowing down for overhangs). Done. For results see above. This has now been removed as a feature as it is detrimental to print quality
  • Validate whether flow speed, acceleration or print speed is the dominant factor. Done - acceleration and flow speed have been identified as the dominant factors and the code has been updated to model a 3 dimensional PA profile that can interpolate between both.

Known potential issues:

  • When a perimeter starts at an overhang (ie. the seam is placed on an overhang) this feature will evaluate the PA based on the starting speed of the perimeter and will not adjust the PA later after the overhang is printed. While this avoids artefacts by not adjusting PA mid way through an external perimeter, it also results in that perimeter having a wrong PA value in its entirety. Fix approach is currently being thought through
  • There may be conflict between this feature and the small area flow compensation and/or scarf seams. More investigation is needed.

Refactoring and tuning

  • Convert the approach to injecting the PA values to the GCODE as a gcode slicer post processor. This is to address the fact that slowdown for layer cooling changes the print speeds after the initial gcode generation - Done
  • Milestone 2 - Code is ready for wider testing Done
  • Performance tune, optimise, fix bugs found by community testers, remove gcode debug statements, further refine error handling and prepare for release.

Credits:

Inspiration for this feature was taken from the below community conversations and implementations.

  1. https://www.reddit.com/r/klippers/comments/o98xes/pressure_advance_becomes_way_too_aggressive_when/?utm_medium=android_app&utm_source=share
  2. https://github.com/hadesz/v2blorgr-config/wiki/Dynamic-Pressure-Advance
  3. https://klipper.discourse.group/t/modification-of-pressure-advance-for-high-speed-bowden-printers/
  4. https://github.com/jjgraphix/KlipperSettingsPlugin

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 :)
image
image
image
image

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.
IMG_3882 2

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.
IMG_3883
IMG_3884

Testing for seam performance
Again this looks excellent. Absolutely no bulge at the seam.
IMG_3885

Testing for top surface performance
Again this looks excellent. Absolutely no gaps, pinholes, under extrusions or over extrusion.
IMG_3886

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.
IMG_3893

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.
image
IMG_3890

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
IMG_3891
image

Seam performance and overhang performance
This is unchanged as expected as we have tuned the PA for the slower external perimeter
IMG_3888
IMG_3892

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.
image

However upon closer inspection you'll notice the below:
image
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!).
IMG_3897

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.
image

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.

image

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.

image

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:
IMG_3880

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:

  1. We must NOT dynamically change PA when printing a specific feature as this may introduce artefacts immediately after PA was set.
  2. Extrapolating from this learning, we probably must exclude changing PA when transitioning to an overhang perimeter, even though that is an extrusion role change in addition to being a speed change. Testing for this scenario is needed.
    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.

@igiannakas igiannakas marked this pull request as ready for review June 6, 2024 16:15
@igiannakas igiannakas changed the title Draft: Adaptive Pressure advance POC: Adaptive Pressure advance Jun 6, 2024
igiannakas and others added 3 commits June 6, 2024 18:17
Reduce the frequency of requested PA changes by introducing a "state" variable.
Implement user toggle for adapting PA for external walls for overhangs
@Eldenroot
Copy link
Contributor

Awesome

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

Awesome

Want to see how it performs. I have 2 use cases for this:

  1. Improved external perimeter corners as typically external perimeters are printed using slower speeds compared to infill
  2. Improved overhang performance as again these are printed slower than the perimeter speeds

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

@SoftFever SoftFever added enhancement New feature or request Community testers wanted Looking for community testers and feedback labels Jun 7, 2024
@SoftFever
Copy link
Owner

This is awesome!
I thought it was more relevant to accel instead of speed.
But you testing seems indicate the speed affect more.

Do you use same accel for all the features in your tests?

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

This is awesome! I thought it was more relevant to accel instead of speed. But you testing seems indicate the speed affect more.

Do you use same accel for all the features in your tests?

Nope I'm using varying accelerations as below:
image

but I guess my accelerations are not sufficiently different between perimeters to show the effect of acceleration on PA. The only place I go high is internal solid infill. The rest are reasonably conservative (in order to remain within the klipper input shaper envelope).

The above PA profile was tuned for 3k accelerations. From the test I've done, higher acceleration does indeed affect PA but more likely than not it's a linear correlation. So what I suspect is happening in my test situation is that the faster speeds use lower PA anyway and that is good enough to prevent issues showing on the internal solid infill which also uses very high accelerations.

@cochcoder
Copy link
Contributor

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 :)

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

So... Digging a little more:

https://klipper.discourse.group/t/pressure-advance-smooth-time-skews-pressure-advance/

From Kevin:
Smooth time impact on PA

"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.....

@igiannakas
Copy link
Contributor Author

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 :)

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.

@SoftFever
Copy link
Owner

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!

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

Test prints with a 10k acceleration target done.

At 50mm/sec there is no difference between the 3k and 10k acceleration PA test.

At 100mm/sec the optimal PA drops from 0.029 to 0.026

At 150mm/sec the optimal PA drops from 0.026-27 to 0.022

IMG_3907

image

So there is for sure another correlation there.

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

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:
1. The smooth time parameter - this introduces a deviation from optimal PA that can be expressed as a delay in the PA reacting, causing gaps/blobs. This appears as different PA values against speed & acceleration (I think)
2. A non linearity of the PA depending on nozzle pressure that is not linearly proportional to speed. Extruder position of a given PA value is linear to the speed right now in Klipper - pa_position(t) = (nominal_position(t) + pressure_advance * nominal_velocity(t)) then smoothed over the smooth time and integrated.

For number (2) this is interesting. I would expect that

  1. A higher PA is needed the higher the nozzle pressure.
  2. Higher speeds would create a higher nozzle pressure due to higher consequential flow rate.
  3. However what I'm seeing from my tests is the exact opposite - that a lower PA value is needed the higher the nozzle pressure for a given nozzle size

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:

image

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:

  1. PA has a relationship with speed
  2. PA has a relationship with acceleration, but the effect appears to be near constant or slightly increasing above a certain speed.

We need more tests and I need more brains for this!!

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 7, 2024

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

@cochcoder
Copy link
Contributor

cochcoder commented Jun 8, 2024

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.

@igiannakas
Copy link
Contributor Author

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?

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 8, 2024

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 here was changed using variable speed.
image

Volumetric flow speed based changed using variable layer height:
image

A couple of observations:

  1. This graph tells us lower flow -> higher PA, higher flow -> lower PA.
  2. The lowest point in that graph is the 50mm/sec speed -> 3.96mm3/sec flow rate
  3. When reaching nozzle flow limits (for me its around 20mm/sec) PA appears to break down and reduce significantly
  4. There is some correlation between the two methods (even though this is based on a sample of just 2 points) - the 12.93 flow using LH to generate it results in 0.023 PA for 10k accel. The 11.87 flow using speed to generate it uses similar 0.023 value. Same for the 15.86 and 18.83 point -> they both are around the 0.021 mark. Please bear in mind that I can only get so accurate with the PA. we are talking 0.01 delta's here which are a bit subjective too.
  5. When using my 0.25 nozzle I noticed that my PA is around 0.42-0.45. This was calibrated at 140mm/sec which is 3. 12mm3/sec flow. This does show that this may actually work as a single PA curve across nozzles (?). The calibrated PA value and what I'm getting out of this model appears to be indeed very close for a lower flow nozzle even though the speeds are higher...

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:

  1. One PA calibration and use it across all nozzle sizes
  2. One PA calibration irrespective of Line width/Layer height

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 8, 2024

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?

@cochcoder
Copy link
Contributor

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?

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.

@igiannakas
Copy link
Contributor Author

New build is up. Found a rare bug which impacted seams if you had enabled wipe before external perimeters - this is now fixed. Also it’s up to date with the latest orca mainline branch.

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 28, 2024

image
Yep, the PA change happens after the small wipe now. The problem is it doesn't solve bad seams on my machine.
noeffect

I think it might be caused by how pressure advance is calculated. Because when extrusion slows down, it effectively retracts, then it transitions to outer walls, with higher PA, then accelerates. I think due to higher PA more material is pushed out of the nozzle than retracted in?
Also this effect is significantly more severe on my machine when it comes to PETG, possibly due to high PA required for slow features and less than half of the PA needed for fast features. I wonder if it is just an issue on my side or it can be replicated on other machines with PETG.

@igiannakas
Copy link
Contributor Author

I;ve broken something on this build - please hold off :)

@GromovPeter
Copy link

GromovPeter commented Jun 28, 2024

20240627_185911
Hi everyone.
Can this feature help with adaptive layer height?
To fix this corners.
20240627_185827

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 28, 2024

@GromovPeter I've only tested it on objects with 0.2mm and 0.1mm layer height and it worked, making both types of layers have sharp corners. For your case I think it requires more precise calibration.

mixheight

@GromovPeter
Copy link

@GromovPeter I've only tested it on objects with 0.2mm and 0.1mm layer height and it worked, making both types of layers have sharp corners. For your case I think it requires more precise calibration.

mixheight

If I print fix layer hight it looks perfect. But variable layer height I think it change Flow and pressure advance and corners going very different depends of layer height

@igiannakas
Copy link
Contributor Author

OK bug fixed.

@Ataraxia-Mechanica the changes wouldn't help you with your specific case - it was only when wipe before external was enabled and specifically on overhanging regions, so it wouldn't trigger this issue with what you saw I'm afraid.

I really wish I had your printer to figure out what's going on :( Looks like I need to do some petg testing...

Could you post the project file for your test print? I'd like to run it through my printer, in case I'm missing something

@Ataraxia-Mechanica
Copy link

@igiannakas 10mm.zip

@igiannakas
Copy link
Contributor Author

@GromovPeter I've only tested it on objects with 0.2mm and 0.1mm layer height and it worked, making both types of layers have sharp corners. For your case I think it requires more precise calibration.
mixheight

If I print fix layer hight it looks perfect. But variable layer height I think it change Flow and pressure advance and corners going very different depends of layer height

This feature will change your PA if you change your layer height. But your case looks very extreme - I've never seen anything so pronounced with variable layer height, with this feature disabled :S So something else is going on, and I'd suggest trying to trouble shoot that before delving into this feature.

Potentially your extruder struggles with the increased pressure from the lower layer height. But still it shouldn't be like this. Maybe your baseline PA value is way off?

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 28, 2024

@GromovPeter At least it looks like the thick layers are having too high PA values, so it follows the higher flow having lower PA behavior, so this PR should improve the corners. I think the value is just too high in general?

@GromovPeter
Copy link

@GromovPeter At least it looks like the thick layers are having too high PA values, so it follows the higher flow having lower PA behavior, so this PR should improve the corners. I think the value is just too high in general?

I have enabled pressure advance in meterial. 0.05. I think it must be constant and not changing with different layer height.
P. S. Need to try this feature

@Ataraxia-Mechanica
Copy link

@GromovPeter You need to use the calibration button and select pressure advance, then test out different value under different flow, then fill it inside the new setting inside the filament. The newest build isn't ready yet, after it finishes, you can do this:
aaaaaaaaaaaaa

@igiannakas
Copy link
Contributor Author

@igiannakas 10mm.zip

@Ataraxia-Mechanica I've taken a look at your project file - firstly omg aren't you making good use of the plates feature :D

Secondly, a couple of things to try:

  1. Disable extrusion rate smoothing - Im noticing slight speed variations before your corners print
    ERS Enabled:
    image

ERS disabled:
image
This shouldn't happen in that feature, so somewhere we're doing some math that are messing up the G1 Fx command. This may or may not help with your corner performance in general but it's something that shouldn't happen. So give it a shot and maybe it improves things.

  1. Try printing one of your vertical models with 3 perimeters instead of 2. I have a hypothesis that what you're seeing may be an artefact of too few walls interacting with each other and also because when using 2 walls inner outer inner falls back to outer inner which gives really poor seam performance...

  2. You're using 0.4 line width for external and internal perimeters. That is borderline what the nozzle can achieve due to the way flow is modelled in the underlying slic3r engine. I'd recommend unless you absolutely HAVE to have 0.4 width walls to try once with 0.42 external and 0.42 internal as this gives the minimum recommended width to ensure good adhesion and uniform flow, especially at speed. Personally I use 0.46-0.48 width for my external walls.

image
https://manual.slic3r.org/advanced/flow-math

So maybe run one test with all three recommendations. ERS disabled, 3 perimeters and 0.46 line width for external and internal perimeters and post a picture?

PS. Please use the latest build

@Ataraxia-Mechanica
Copy link

The surface quality with 0.46 width looks so good. I was using orca wrong this entire time :(

@igiannakas
Copy link
Contributor Author

The surface quality with 0.46 width looks so good. I was using orca wrong this entire time :(

post a pic :D

Did you do all three suggestions or just the line width? Would help troubleshooting and also learning :)

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 28, 2024

All 3 suggestions. 3 walls static > 2 walls static > 2 walls dynamic > 3 walls dynamic, for some reason. With dynamic PA on, the seam also splits up into 2 parts. Guess the extra material builds up more with 3 walls and dynamic PA? PA also needs to be a bit higher it seems.
suggested

@igiannakas
Copy link
Contributor Author

Your PA for sure needs to be higher...

@igiannakas
Copy link
Contributor Author

Also when using dynamic PA, as the value is more aggressive for your external perimeters this would lead to the seam gap being potentially more pronounced. You can set your seam gap to 0% instead of 5% I think you have now. This will close the seam more tightly.

Finally with 2 walls the outer wall is printed first, immediately after a retraction and travel move. This usually leads to inconsistent seams as the nozzle has ever so slight time to depressurise and also has to precisely control the deretraction process which is inherently variable (extruder slack and play, filament grip, resistance in the tube etc)

Compared to printing with 3 walls, the seam starts immediately after an internal perimeter is printed. So the travel from the inner to the outer and then back inner is tiny, so no loss of pressure. And usually there is / shouldn't be any retraction there as well.

@Ataraxia-Mechanica
Copy link

aaaaaaaaaaaaa
:(

Also, in both cases, the PA of outer wall is 0.038, so I don't think it's caused by outer wall PA?

By the way I think you should make what you told me into a tutorial. More people probably have set the extrusion width to exactly the nozzle width.

@igiannakas
Copy link
Contributor Author

That is the wipe move. Set your min distance before retracting to 2 or 3mm to avoid retractions when moving between perimeters on inner and outer inner ordering. Especially as you appear to be using staggered inner seams

@Ataraxia-Mechanica
Copy link

But by using travel distance threshold, the wipe on outer wall disappears first, then the wipe of inner wall disappears.
image

@igiannakas
Copy link
Contributor Author

But by using travel distance threshold, the wipe on outer wall disappears first, then the wipe of inner wall disappears.

Yeap the wipes are not necessary over small distances... The nozzle doesn't have enough opportunity to ooze so you're causing more harm than good by retracting, wiping and unretracting. I would set to 3mm if I were you, especially as your travel speeds are 500mm/sec and accels at 25k - there is zero opportunity to ooze over 3mm with that speed ;)

Also I've noticed you're using a negative extra length on restart. This, I suppose, was because your filament oozed and you wanted to get better seams. But with the right PA, this may be causing unintended consequences, like the seam gaps you're seeing as the nozzle isn't fully primed.

If I were you I'd go for inner outer inner, 3 walls, no extra length on restart, 3mm distance before retraction. In any case I'm attaching you my profile so you get some ideas :) And you may need to up your PA as your non seam corners are still bulging out

I'm using a 2.4 350, so not as fast as yours :) But even with slower speeds this works very well

tttt.3mf.zip

@Ataraxia-Mechanica
Copy link

Ataraxia-Mechanica commented Jun 28, 2024

Oh, that was just from a slightly older file. All the tests done today was with 0 extra length. Currently I'm using 0.045 PA and it looks good. By the way with wider line width the printer seems to be much better at bridging, perhaps because lines wasn't stretched? Thank you for diagnosing my issue today, never realized my profile was wrong.

@igiannakas
Copy link
Contributor Author

@Ataraxia-Mechanica stefan from cnc kitchen has a decent article on line widths here:https://www.cnckitchen.com/blog/the-effect-of-extrusion-width-on-strength-and-quality-of-3d-prints

take a look at my profile - maybe you find other variances too that are of interest ;) to not “pollute” the pr just reach out to me over discord and we can chat there too :)

@igiannakas
Copy link
Contributor Author

igiannakas commented Jun 28, 2024

So new push completed - have enabled adapting PA on fully overhanging perimeters as shown below. Highly experimental and may end up reverting it as it is unproven whether this is doing more harm than good but pushing out to testing.

image
image
image

@lookypanda would you mind cross checking that I have not introduced any regressions against your "tricky" models above if possible?

@Ataraxia-Mechanica same here if you haven’t run out of blue petg yet 😂😅

All,

Dont think I'll do any more updates to this for the coming week or two as looks like work will get a bit crazy but please do let me know if you find any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community testers wanted Looking for community testers and feedback enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet