E value Calculation of the G code in Prusa Slicer
 
Notifications
Clear all

E value Calculation of the G code in Prusa Slicer  

Page 1 / 2
  RSS
Vick
 Vick
(@vick)
New Member
E value Calculation of the G code in Prusa Slicer

Hi, I am wondering does anyone know how to calculate the E value (the amount of extrude from the start to the endpoint ) in the Prusa Slicer? I am trying to test the performance of my adaptive slicing (non-uniform layer height) f0r my research, but not sure how to adjust the G-code ( E ) of Prusa slicer based on my given length and height. Many thanks 

I have tried to use the formula below, but it does not match the E of Prusa Slicer. 

Posted : 26/06/2020 10:57 am
karl-herbert
(@karl-herbert)
Illustrious Member
RE: E value Calculation of the G code in Prusa Slicer
Posted by: @vick

Hi, I am wondering does anyone know how to calculate the E value (the amount of extrude from the start to the endpoint ) in the Prusa Slicer? I am trying to test the performance of my adaptive slicing (non-uniform layer height) f0r my research, but not sure how to adjust the G-code ( E ) of Prusa slicer based on my given length and height. Many thanks 

I have tried to use the formula below, but it does not match the E of Prusa Slicer. 

if you want to know how Prusa calculates this in the slicer, you can browse the source code of the slicer:

https://github.com/prusa3d/PrusaSlicer/releases

I you want to calibrate the extruder, look here:

https://mattshub.com/blog/2017/04/19/extruder-calibration

Statt zu klagen, dass wir nicht alles haben, was wir wollen, sollten wir lieber dankbar sein, dass wir nicht alles bekommen, was wir verdienen.

Posted : 26/06/2020 11:57 am
Vick
 Vick
(@vick)
New Member
Topic starter answered:
RE: E value Calculation of the G code in Prusa Slicer

@karl-herbert

Thank you very much. 

Posted : 26/06/2020 2:11 pm
Sanglae Kim
(@sanglae-kim)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

I'm currently working at same page(Calculating E value in G-code from prusaslicer), but I couldn't find some functions in source files..

Also, I'm not expertise in coding.

 

The only thing I found was

The related functions and variables which is "m_E(to stack when it's absolute coordinate), dE", etc..

All functions are pointed each other, so that there is no direct calculation formula there..

On the other hand, I also looked a "Flow math" at slic3r. The calculation for my E value isn't correct

 

I have 2 questions for this.

First, E value calculation, What is wrong with my formula?

(This is some part of G-code from prusaslicer)

; external perimeters extrusion width = 0.45mm
; perimeters extrusion width = 0.45mm
; infill extrusion width = 0.45mm
; solid infill extrusion width = 0.45mm
; top infill extrusion width = 0.40mm
; first layer extrusion width = 0.70mm

 

(This is somewhere between top, bottom layer, just to avoid compensation for first, last layer)
G1 X115.996 Y179.003 E0.86610
G1 X115.996 Y160.225 E0.90316
G1 X118.961 Y154.015 E0.33096
G1 X120.077 Y151.147 E0.14800
G1 X120.766 Y148.109 E0.14984
G1 X120.996 Y145.038 E0.14811
G1 X120.996 Y64.964 E3.85132
G1 X120.766 Y61.893 E0.14811
G1 X120.077 Y58.855 E0.14983
G1 X118.961 Y55.985 E0.14809

form X120.996 Y145.038 to X120.996 Y64.964, (I made it bold)

 

extrusion at nozzle

from "Flow math" the width(w) : 0.45, layer height(h) : 0.3

cross section area from nozzle = h*h*0.25+w*(w-h) = 0.11568582

the extrusion length will be 80.074(=145.038-64.964).

total extrusion volume = 9.263426

 

At the same time, for filament

the 1.75*1.75*PI*0.25=2.4052813(cross section area for filament)

 

So my conclusion is to 9.263426/2.4052813 = 3.851286

It is not even close to 3.70389(=3.84993-0.14604)

It seems I'm missing something, for sure.

 

Second, 

Some parts of G-code has same value of E or even minus or less then before, even they are still extruding

Is there any method that I'm missing..?

 

 

Giving any small hint would be thankful..

Thanks,

This post was modified 4 years ago by Sanglae Kim
Posted : 17/01/2021 8:21 am
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

@sanglae-kim

a hint: https://manual.slic3r.org/advanced/flow-math

but you do not tell if Linear Advance if in use, that may affect too.

Posted : 17/01/2021 8:54 am
Sanglae Kim
(@sanglae-kim)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

@misan

So, the E value that I calculated was not wrong!

I'll look for it right away

Thanks for the advice!!

Best regards,

 

(PS, for those who are struggling with,

the effect of advanced linear - )

This post was modified 4 years ago by Sanglae Kim
Posted : 18/01/2021 12:30 am
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

@sanglae-kim

By modelling the pressure inside the hot-end, Linear Advance may cause different extrusion values for the same length of the extruded line. So expect some non-obvious differences if you monitor the length of extrusion for a given line length if LA is active.

Posted : 18/01/2021 8:38 am
Sanglae Kim
(@sanglae-kim)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

@misan

Yes, thank you so much for reply.
I'll work on that part, see if LA was the missing point

Thanks a lot!
Best regards,
Posted : 18/01/2021 9:35 am
Kelly Egan
(@kelly-egan)
New Member
RE: E value Calculation of the G code in Prusa Slicer

Is linear advance something that is calculated by the slicer and applied to the gcode or interpreted by the firmware? Isn't this why you might send the firmware a custom K value in the start gcode if you use a different filament?

Posted : 12/11/2021 6:18 pm
bobstro
(@bobstro)
Illustrious Member
RE: E value Calculation of the G code in Prusa Slicer
Posted by: @kelly-egan

Is linear advance something that is calculated by the slicer and applied to the gcode or interpreted by the firmware? Isn't this why you might send the firmware a custom K value in the start gcode if you use a different filament?

You enable or set the Linear Advance setting in gcode, but the printer firmware must support the feature and does the actual adjustments during the print.

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 12/11/2021 6:58 pm
Heiko
(@heiko)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

So K value doesn't affect the E value calculation in PrucaSlicer gcode, when i got
kelly egan right.

This would mean (assuming all other parameters are the same):
double pathlength = double amount of extruded filament

so the E value per mm should always be the same?!
But as misan has already mentioned, there are some deviations in PrusaSlicer gcode.

May anyone explain, where this comes from and how the E value is calculated by
PrusaSlicer?

PrusaSlicer?

Posted : 20/05/2022 11:08 am
Sanglae Kim
(@sanglae-kim)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

As far as I know, the equation we know or 'well known' was correct.

It may help you to understand.
( https://www.sciencedirect.com/science/article/pii/S2238785422003052)

Otherwise, for short.

1. PursaSlicer changes extrusion value automatically (to fit rasters in integer)

2. Also, multiplier that PrusaSlicer uses were different from what we set

(Above information might be outdated.. since I was working with older slicer version)

Hopefully it helps,

Thanks

 

Posted : 21/05/2022 7:09 am
Daniel liked
Heiko
(@heiko)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

@sanglae-kim thank you very much for your reply!

1. PursaSlicer changes extrusion value automatically (to fit rasters in integer)

 I guess, this is where the deviations might come from?
 
Actually, I don't want to dive to deep into flow math and think, i can
just calculate the mean extrution per mm for a certain set of settings
and use this for my own gcode?

D

 

Posted : 22/05/2022 2:18 pm
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

You guys got me thinking 🙂 ... so let me elaborate a bit more on my thoughts: you can read the E value from the code, or you can monitor the step signal of the extruder's stepper, or the extruder shaft angle, or you can measure the actual length of filament going through the extruder. Each one of these actions may lead to different values.

PrusaSlicer (of which I am not knowledgeable enough of its internals) has a number of details that can make its output less than obvious, as it is the sum of different contributions. For example, elephant foot compensation is about to change the extrusion of the first layer to avoid making it wider than the rest of the layers. If you do not discount that, you can see that one line and the same one on top get different E values though they are the same length, width, and height. I do not know how many other similar details are running in PrusaSlicer internals, but my guess is there is more, so I won't be surprised if my back-of-the-envelope calculation is off too. 

But it is not only the slicer but the firmware itself that contains crevices where deviations from the "simple" model are created (Linear Advance, Look-ahead, machining imperfections, dust, etc)

If motivated enough, both the slicer and the firmware are open source so a thorough study can be conducted but that could be a long shot. IMHO it is a bit like getting an accurate estimate of the print time.

Answering to @Heiko I reckon if layer height and width are the same, two lines of equal length would get the same E value from the slicer (unless subtle changes like multiplier change happen in the background of the slicer internals unbeknown to us).

Posted : 23/05/2022 8:12 am
Heiko
(@heiko)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

Answering to @Heiko I reckon if layer height and width are the same, two lines of equal length would get the same E value from the slicer

@ misan i think so, but the amount of extrusion per mm differs, when the lenght is changing. (you can check it easily by comparing two
paths with diffrent lenght of any infill) i'm still wondering, where this might come from, but for my purpose i guess it's ok to just calculate
the mean of all e values (per mm) and then multiply with the pathlenghts of my one code

 

 

 

 

Posted : 23/05/2022 7:50 pm
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

Just a sample cube in vase mode. You can see that 3 of the sides render precisely the same E value. The fourth one is not because a slicing decision is made;  it will split it into two segments for reasons I ignore. But once you add these two together, 0.81863+0.01235, you get the same E value 0.83098 so at least in this example the idea that a certain distance renders a given E value holds.

 

Posted : 23/05/2022 8:06 pm
Heiko
(@heiko)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

example infill pattern "line" at 20%.
e values per mm range = 0.054281 To 0.054399

 

 

Posted : 24/05/2022 9:05 am
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

@Heiko: that variation you mention is less than 0,22% so I would assume it might be connected to some simplification on the distance calculations to make it quicker (or another type of math artifact).

To my eyes it does not seem a huge difference but, unfortunately, I cannot shed any more light on a possible reason for that slight variation.

Posted : 24/05/2022 12:13 pm
Heiko
(@heiko)
Active Member
RE: E value Calculation of the G code in Prusa Slicer

@misan surely...thanks for your reply. so sanglae-kim said (PursaSlicer changes extrusion value automatically (to fit rasters in integer))
just wanted to make sure to be on the right track.
(i'm looking forward printing very tiny, but still readable text on "filament level") 

Posted : 24/05/2022 12:37 pm
misan
(@misan)
Member Moderator
RE: E value Calculation of the G code in Prusa Slicer

I wrote some code for that (no extrusion though) a while ago. I am mentioning it here in case it can be useful for @heiko

https://github.com/misan/gcodeFont

Posted : 24/05/2022 4:38 pm
Page 1 / 2
Share: