Motor Trajectory Generation Calculation Questions (quite long)

Hi All,
This is my first post, so apologies if it is not suitable for this board.
I'm writing a trajectory control algorithm for a simple stepper motor
controller. I want to implement a trapezoidal velocity profile. Given values for
1) The distance to cover (s) 2) The acceleration of the motor (a) 3) The time to cover the distance (t)
I need to calculate the maximum speed of the motor on the top of the trapezoid (Vmax)
i.e.
Vmax ________________________________ / \ / \ / \ / \ 0 / \
0 t
I thought this would be relatively straightforward,
Splitting the trajectory into 3 phases (accel, const speed, decel) the time for each phase is t1, t2 and t3
Taking the following 4 equations...
t = t1 + t2 + t3 t1 = t3 Vmax = a * t1 s = (Vmax * t2) + (0.5 VMax * t1) + (0.5 * VMax * t3)
I can solve for Vmax. However, the resulting equation is a quadratic, and hence has two solutions.
For ref, the solution, using the quadratic formula is Vmax = 0.5 * a * ( t - sqrt( t^2 - (4 * s / a)))
Having done a few example problems, it seems that that there are always two real number solutions, both of which are greater than zero.
From my examples, the smaller of the two solutions seems to be the correct one. The greater seems to be the solution for the following (nonsense) trajectory...
Vmax ________ \ / \ / \ / \/ /\ / \ / \ 0 / \
So, my questions are these...
1) Is this right? It seems that in the process of trying to solve the problem, I'm introducing this extra solution. Is there a way of combining the equations such that I only have a simple linear equation to solve, or is this just a feature of this particular problem.
2) If I have to go down the quadratic route, is it valid to assume that the smaller of the two solutions for Vmax is always the correct one?
Many thanks for all help.
Jim Donaldson
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Pages 29 and 30 of this document might help you.
http://www.ce.utwente.nl/rtweb/publications/Msc2003/pdf-files/010CE2003_Eglence.pdf
They describe pretty much what you are trying to solve if I read them correctly.
--
- Alan Kilian <alank(at)timelogic.com>
Director of Bioinformatics, TimeLogic Corporation 763-449-7622
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks for your reply Alan. The reference does talk about trajectory generation but in contrast, I have an extra constraint on the calculations - the time (and hence average speed) that the move is to take. It seems that I have a correct solution, but I wondered if there were any simpler ways to do it without forming the quadratic, and re-validating the results.
Jim
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Some useful stuff on generating linear ramps for steppers: http://mysite.freeserve.com/stepper

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.