Z-Axis3D
Posts: 14
Joined: Thu Sep 29, 2016 11:10 am

Re: Add accel and jerk settings for accurate build time calc

Fri Oct 06, 2017 7:38 am

+1 for Add accel and jerk settings for accurate build time calc.


arhi
Posts: 435
Joined: Thu Oct 06, 2016 5:13 pm

Re: Add accel and jerk settings for accurate build time calc

Tue Oct 10, 2017 10:34 pm

note that not all firmwares use jerk, some use junction deviation (smoothieware for e.g.) which is much better then a simple jerk calculation ..
Junction deviation determines how much to slow down, proportional to how much the direction changes.
http://smoothieware.org/motion-control# ... -deviation

my experimental code on 10 hour print has less then 30sec error - not sure where this 0.1% error comes from, I probbly aproximated something inprecisely but I'm satisfied with precision .. code needs a lot of work to be universally used and is missing jerk settings for marlin but since I don't really use marlin i never spent time on that .. the major part of the code handling the time calculation with jerk and acceleration is here..

Code: Select all

...
  distance = sqrt(pow((x - oldx),2) + pow((y-oldy),2) + pow((z-oldz),2));
  if (distance == 0.0){ oldf = f; return 0; }
  if (!mm) distance = distance * 25.4; 
  xa = x - oldx; ya = y - oldy; za = z - oldz;

  costheta = (xa*oldxa + ya*oldya + za+oldza) / ( sqrt(xa*xa + ya*ya + za*za) * sqrt(oldxa*oldxa + oldya*oldya + oldza*oldza) );

  if (costheta < 0.95F) { //smoothieware constant 0.95 is limit where we assume line is "straight enough" and treat it that way without any slowdown
    speed = f;
    if (costheta > -0.95F) {
      sin_theta_d2 = sqrt(0.5 * (1.0 - costheta));
      speed = min(speed, sqrt(accel * jdev * sin_theta_d2 / (1.0 - sin_theta_d2)));
    }
  }

  Ta = (f - oldspeed) / accel;      
  Td = (f - speed) / accel;          
  Sa = (f + oldspeed) * Ta / 2.0;
  Sd = (f + speed) * Td / 2.0;     
  if ((Sa + Sd) < distance){
    Ts = (distance - (Sa + Sd)) / f;
  } else {
    Ts = 0;                          
    Ta = distance / (f + oldspeed);
    Td = distance / (f + speed);
  }

  ret = Ta + Ts + Td;
...

tenaja wrote:How much slower will slicing be if they switch from a simple calculation to a complicated one?
a fairly slow arm box I use for some testing takes 0.049 seconds to calculate the total time smoothieware based firmware will take to execute a g-code for a 85320 lines G-code (2.3MB file) so I doubt you will notice any speed impact on your desktop for properly calculating time it takes to print something...
gcodestat integrates with Simplify3D and allow you to
Calculate print time accurately (acceleration, max speed, junction deviation all taken into consideration)
Embed M117 codes into G-Code
Upload your G-Code directly to Octoprint
open source and unlicence

Andre267
Posts: 6
Joined: Fri Dec 16, 2016 4:47 pm

Re: Add accel and jerk settings for accurate build time calc

Thu Oct 12, 2017 6:02 pm

This is not a Feature that can be added some day this is something that i exspected from the beginning. ;) (just my opinion)

So PLEASE add this with custom speed Values.

WTLgrinda
Posts: 15
Joined: Fri Jul 28, 2017 8:30 am

Re: Add accel and jerk settings for accurate build time calc

Fri Oct 13, 2017 10:29 am

+1 for that.

Maybe in the machine settings we could enter some default values that we use. My print time is always 15-25% off :/

georgepaul
Posts: 2
Joined: Thu Sep 21, 2017 3:58 am

Re: Add accel and jerk settings for accurate build time calc

Mon Oct 16, 2017 2:55 am

+1 for this. Please add this.

arhi
Posts: 435
Joined: Thu Oct 06, 2016 5:13 pm

Re: Add accel and jerk settings for accurate build time calc

Sat Dec 02, 2017 8:45 pm

I had few hours this weekend so maybe someone finds this useful
https://github.com/arhi/gcodestat
gcodestat integrates with Simplify3D and allow you to
Calculate print time accurately (acceleration, max speed, junction deviation all taken into consideration)
Embed M117 codes into G-Code
Upload your G-Code directly to Octoprint
open source and unlicence

arhi
Posts: 435
Joined: Thu Oct 06, 2016 5:13 pm

Re: Add accel and jerk settings for accurate build time calc

Sun Dec 03, 2017 12:37 am

here is the video of the gcodestatus integrated with s3d: https://we.tl/Uf1TPvxsZ2
(or use attached s3d.zip, unpack and view s3d.mp4 in your favorite movie player)

to get it working one line of the script looks like

Code: Select all

e:\Dev\eclipse-workspace\gcodestat\gs.bat "[output_filepath]" 
(of course path should be to your batch file)

and the batch file needs to look like:

Code: Select all

@echo off
e:\Dev\eclipse-workspace\gcodestat\gcodestat.exe -d 0.02 -a 1000 --gcode=%* | c:\Windows\System32\msg.exe %username%
again with your paths and your parameters, this sets junction_Deviation to 0.02, acceleration to 1000 and is calling msg.exe from system32 (if you don't have msg.exe on your system, for e.g. if you have home version of windows, you can copy it from any other system that has it)

I attached the gcodestat.exe (win64 binary, but you might need mingw dll to run it, dependency walker states it does not need anything but..)
Attachments
gcodestat.zip
(24.44 KiB) Downloaded 129 times
s3d.zip
(798.08 KiB) Downloaded 129 times
gcodestat integrates with Simplify3D and allow you to
Calculate print time accurately (acceleration, max speed, junction deviation all taken into consideration)
Embed M117 codes into G-Code
Upload your G-Code directly to Octoprint
open source and unlicence

mischl
Posts: 30
Joined: Thu May 18, 2017 2:10 pm

Re: Add accel and jerk settings for accurate build time calc

Tue Dec 26, 2017 5:07 am

thank you!

somehow I am not able to start it from post processing option. the batch file does not run.
I have tried different folders and to start S3D with admin rights, but nothing helps.

starting calc from there with C:\Windows\system32\calc.exe works...

any idea?

arhi
Posts: 435
Joined: Thu Oct 06, 2016 5:13 pm

Re: Add accel and jerk settings for accurate build time calc

Tue Dec 26, 2017 5:36 am

try the latest batch file from https://github.com/arhi/gcodestat/blob/master/gs.bat

you have to have a full path to bat file in s3d and in bat file you need full path to gcodestat.exe

if it runs from system32 it means you are running it without full path and system32 is in system path so it can be found

(you can get latest binary for windows also https://github.com/arhi/gcodestat/releases )
gcodestat integrates with Simplify3D and allow you to
Calculate print time accurately (acceleration, max speed, junction deviation all taken into consideration)
Embed M117 codes into G-Code
Upload your G-Code directly to Octoprint
open source and unlicence

Return to “Feature Requests”