So I'll try to help out a bit with some rusty physics
The simple 1D kinematic equation for distance including jerk is:
s = vi*t + (1/2)*ai*(t^2) + (1/6)*j*(t^3)
where s = distance traveled, vi = initial velocity, ai = initial acceleration, j = jerk (i.e. rate of change of acceleration), and t = time
However, I'm not sure where your quadratic equation came from based on that. Even if I assume vi=0, I still don't come out with the same results.
Can you elaborate on where your quadratic equation came from? Based on the above, I would think the solution would be a cubic equation with no simple solution...
Well, in 3d printing jerk isn't the derivative of the acceleration as the definition states, but just the initial instantaneous speed, so if jerk is set to 10, it means the stepper will start immediately at 10mm/s and accelerate from there.
The equation is : distance = Vstart x delta-time + (Acceleration^2 x delta-time)/2
We need to find the delta time (for a half segment since the process is Start at jerk speed, accelerates, eventual constant speed, deccelerate and stop from jerk point). So we solve the equation for Vstart = jerk, Acceleration = acceleration setting, and distance = half segment size
Then when we have the delta-time value, we have to see if we are in a case where it's accelerating until the mid point and deccelerating after, or if you reach the print speed, and stay there for a while until you deccelerate (for short segments and high print speed, you never reach the goal speed).
If there is no constant speed, the time to print the segment is 2 x delta-time found above, otherwise we need to do some more calculations (I did make at least one mistake in my original post):
First let's see how much distance we have travelled until reaching the wanted speed, for that we need to know the time until reaching the goal speed, this is simple time-to-goal-speed: =(Vgoal - Vstart) / acceleration. With that we use the same equation as above: distance-until-reach-goal-speed = Jerk x time-to-goal-speed + (Acceleration^2 x time-to-goal-speed) /2
Now the part I forgot in my original post: the remaining distance at constant speed is : dist-const-speed = half-segment-size - distance-until-reach-goal-speed
time-at-constant-speed = dist-const-speed / Vgoal
time for half segment = time-to-goal-speed + time-at-constrabt-speed
=> time for segment = 2x the above.
This time it should be correct.
To answer the other comment, the difference is very significant depending on what you print and your print speed, the faster you print, the most off is the current build time estimation, and the most small segment you have as well
For example, for my settings (Jerk = 8, Acceleration = 800) and a print speed (goal) of 50mm/s (3000mm/min), the time given by the build estimate in S3D is :
0.02 second for 1mm segment
0.04 second for 2mm segment
0.1 second for 5mm segment
0.4 second for 20mm segment
Now the real time according to the calculation described (if I made a mistake again I'm sorry, but I have it in an excel sheet and the values below are correct):
0.053 second for 1mm segment (+167%)
0.082 second for 2mm segment (+105%)
0.14 second for 5mm segment (+44%)
0.44 second for 20mm segment (+11%)
I did a print last night which was estimated at 2h30 and it actually took a little over 4hours... so the difference is very significant. Now if you print slower or equal to the jerk value, you should have an actual print speed the same as the current build estimate (beside some minor difference, such as firmware approximation, delay in serial communication, ...)
This calculation can be done while slicing, but can also be done post process on the gcode file... I was suggesting it to be optional in case someone worries about slowing down the process, but it could also be done in background after the slicing, you could start your printing while it's still estimating the time, but I very doubt it would take long, unless you have an insane number of segment. These calculations are trivial compared to the slicing algorithm
I hope I make sense