Page 2 of 4

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

Posted: Fri Oct 06, 2017 7:38 am
by Z-Axis3D
+1 for Add accel and jerk settings for accurate build time calc.

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

Posted: Tue Oct 10, 2017 12:24 am
by ugme
+1

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

Posted: Tue Oct 10, 2017 10:34 pm
by arhi
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...

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

Posted: Thu Oct 12, 2017 6:02 pm
by Andre267
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.

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

Posted: Fri Oct 13, 2017 10:29 am
by WTLgrinda
+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 :/

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

Posted: Mon Oct 16, 2017 2:55 am
by georgepaul
+1 for this. Please add this.

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

Posted: Sat Dec 02, 2017 8:45 pm
by arhi
I had few hours this weekend so maybe someone finds this useful
https://github.com/arhi/gcodestat

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

Posted: Sun Dec 03, 2017 12:37 am
by arhi
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..)

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

Posted: Tue Dec 26, 2017 5:07 am
by mischl
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?

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

Posted: Tue Dec 26, 2017 5:36 am
by arhi
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 )