Underruns, ways to reduce?
-
I am printing a Benchy from a g-code file downloaded to duetWiFi. The g-code was generated with Simplify3D. There are a number of underruns. As I understand it an underrun is an event where the firmware can't read the g-code file fast enough. Does anyone know if:
1 - A faster SD card will make a difference.
2 - There is a software that will filter a G-code file to reduce moves less than the resolution of the motors. -
It's unusual to get underruns during a print, so make sure they are caused by the actual print, by running M122 just before printing to clear the underrun counter. Operations such as finishing homing or bed probing may also record an underrun.
If you are certain that the underruns are occurring while printing from SD card, the first thing to do is to make sure that you are using a large cluster size (32kb or 64kb) on the SD card. You can run M39 to check this.
-
OK, thanks! Not sure if 32kb is small or big. This is the result of M39:
SD card in slot 0: capacity 3.97Gb, free space 3.90Gb, speed 20.00MBytes/sec, cluster size 32kb
And this is the result after approx 1 min printing after reboot and M122 before print:
Hiccups: 0, StepErrors: 0, LaErrors: 0, FreeDm: 240, MinFreeDm: 150, MaxWait: 315048ms, Underruns: 52, 10
1 - Would it be beneficial to increase the cluster size of the SD-card to 64kb?
2 - There are two numbers after Underruns, what is the difference?
-
@urban said in Underruns, ways to reduce?:
what is the difference
There are two kinds of Underruns:
Lookahead Underruns; // How many times we have run out of moves to adjust during lookahead
PrepareUnderruns; // How many times we wanted a new move but there were only un-prepared moves in the queueThe first number in your example is Lookahead and the second is Prepare.
-
OK, Thank you for the info. I checked the Benchy and it has a lot of triangles that probably will generate one line segment for each triangle intersection with the layer plane. The best way to filter out these short segments would be to have a software that eliminate unnecesary points in the G-code file that almost are on the same line, but I have not found such software.
1 -I guess that PreparedUnderruns will cause the movement to stop?
2 - What is the consequence of a lookaheadUnderrun?
This is similar to the block cycle time problems for CNC 20 years ago, I guess.
-
What microstepping are you using?
64kb cluster size may help.
-
I user a 20 mm lead ballscrew with 3200 steps per revolution. This gives 20mm/3200=0,0063mm per step. The maximum speed for 180kHz would then be 1134mm/s. There have never been any other errors, only underruns.
I will try reformat the SD-card.
1 - I wonder if lines with comments reduce the time to read a line? -
Does anyone know a way to quantify improvements? For example, is it possible to simulate a print and measure the time for completion?
-
@urban comments are stripped out so should have no effect unless you have huge amounts of them.
-
@urban said in Underruns, ways to reduce?:
1 -I guess that PreparedUnderruns will cause the movement to stop?
Yes, and may also cause print quality issues. They shouldn't happen in normal use. When you run M122 and find that some have occurred, please check the "Longest main loop time" and report here.
2 - What is the consequence of a lookaheadUnderrun?
A lookahead underrun means that there was a series of very short deceleration-only moves in the movement queue, which could potentially be amended because of a new incoming move; but the first one was already being executed so only the later ones could be amended.
Two questions:
-
From other information you posted, I deduce that your X and Y steps/mm is about 158.7. Is that correct? Please check by running M92, in case a change in microstepping has amended it.
-
Do you have logging enabled? If so, is anything written to the log file during a print in which underruns occur, other than the usual start and end print messages?
-
-
OK. I have turned on logging. The steps/mm=160 as reported by M92. I will do the tests next week since I need help from my college to assemble it after mounting a new vacuum bed and chamber heater.
-
I have done some tests and studies:
1 - I changed the SD card to a 32GB Samsung Evo plus with 95MB/s read and 20MB write speed that I verified on my computer. The card is formated to get max speed using SD Card Formater 5.0 that should give aligned blocks for maximum speed, actually 32kb sectors. No improvement on the underRuns or or lookAheadUnderruns.
2 - I turned on logging, but it looks ok.
3 - I am testing on a scaled Benchy, approx 180mm long. In the g-code there are 2964 xy-moves shorter than 0.05mm. Could those moves cause a problem?
4 - Longest main loop time - I can not find that entry in the reply from M122. Could it be this?:
Date/time: 2018-10-16 15:32:10
Slowest loop: 18.64ms; fastest: 0.08ms
=== Move ===
Hiccups: 0, StepErrors: 0, LaErrors: 0, FreeDm: 214, MinFreeDm: 150, MaxWait: 0ms, Underruns: 35, 1
Scheduled moves: 5225, completed moves: 5215
Any Ideas?
-
Yes that's the longest loop time, around 18ms. What I think is happening is that the model contains a sequence of very short moves and this means that the move queue isn't long enough to hold 0.5 seconds worth of frozen moves plus enough moves for the lookahead to work in that case. The move queue on the Duet 2 series is 30 moves long AFAIR.
Increasing XY acceleration may reduce the underruns, but may itself reduce print quality.
-
OK, Thank you!
Data reduction: I think there are two solutions for the input data (I think), one is to reduce the number of triangles and the other is to filter the contour after the slicing (the G-code file). If the triangles are reduced the file will be optimised for one size and the reduction itself can produce errors. Doing the reduction on the G-code file can be optimised for a specific machine and would not be to complicated if segments that are lined up in a strait line within a tolerance is removed.
Acceleration: I have a modest acceleration(1500mm/s/s) for the print move but can have a higher for travel moves (5000-10000mm/s/s). The rapid travel moves reduce ooze from the nozzle but due to the trapezoidal movement profile there can be ringing. An S-curve or similar movement profile would be beneficial.
-
@urban from memory some slicers have a setting to do this for you, minimum length or something like that.
-
The Smoothie guys had issues with S3D gcode generating very small segments a while back. They made a segment reduction tool, you may be able to find that online somewhere.
An S3D update 1-2 years ago also included a minimum segment size too, I think? Are you running a recent version?
-
I will check slic3r for short segment removal. I have the latest version of Simplify3D, and I have not found such filter there, except to avoid generating shorter infills and similar. I will try to find the Smoothie program.
There would be som other benefits of filtering G-code since:
- Many short segments on a strait line could be removed
- Circular polygons could be transformed to G2 (my servo controller would like that)
- Elliptical curves (tilted circular cylinders) could be optimised by 4 radii or special G-command
I am now running with lower accelerations and that removed overruns. The alternative solution is to improve the throughput is to use the
M572 Pressure Advanced
and a higher top speed. -
@urban Slic3r has an option under Print Settings>Advanced for resolution. It claims to simplify high resolution models. I'm not sure how it works though.
-
OK, thank you, I will check that.
-
@dc42 Looks like I am having the same Issue as Urban. Running on a wifi 2
Slowest loop: 80.30ms; fastest: 0.06ms
Scheduled moves: 22256, completed moves: 22216, StepErrors: 0, LaErrors: 0, Underruns: 0, 1
SD card in slot 0: capacity 15.93Gb, free space 15.90Gb, speed 20.00MBytes/sec, cluster size 32kb (sandisk ultra)The machine stopped in the middle of the print. Fans and heaters still going as well as the job clock and file progress etc, just no movement or movement in the status window xyz.