We help IT Professionals succeed at work.

Formula to calculate optimum acceleration and deceleration

simonwait
simonwait asked
on
Medium Priority
586 Views
Last Modified: 2012-05-11
I am working on a workbook which calculates an object moving between 2 points.

The variables I have are:-

Start position - this can be any value including negative values and represzents a measurement in mm
End position - as start position
Travel.  This is the distance travelled and therefore an absoute value
Accel/Decel.  This represents is the same for both acceleration and deceleration and is expressed in mm/sec^2
Time - The desired time taken to complete the task
Speed - the speed of the object derived from the time variable

The object has certain minimum and maximum values which are variables
AccelMin, AccelMax, SpeedMin, SpeedMax

I am trying to find the optimum value which will essentially accelerate and then immediately decelerate without reaching the  MoveSpeed or SpeedMax value (whichever is lower).

I could figure this using a loop but figure there is a much cleaner mathematical solution to this
Comment
Watch Question

Author

Commented:
An example would be:-

MaxAccel = 250mm/sec^2
MaxSpeed = 600mm/sec
StartPos = 2007mm
EndPos = -1899mm
(Therefore travel = 3906mm)
Time = 14.2 secs

So Accel/Decel = 77mm/sec^2 would mean 548.4mm/sec speed which would be good.

Incidentally accel/Decel values are whole numbers
GrahamSkanRetired
CERTIFIED EXPERT
Top Expert 2012

Commented:
How would you define 'optimum' - fastest? If so, then any solution would require using maximum possible acceleration and deceleration values.


Author

Commented:
But to achieve 14.2secs travel time over that distance I am essentially trying to regulate the speed using the acceleration and deceleration which must both be equal.
GrahamSkanRetired
CERTIFIED EXPERT
Top Expert 2012

Commented:
So you are looking for a target travel time. Even so, there could be an infinity of solutions - fast acceleration to one speed, or slower acceleration to a rather faster speed and anything in between.

Author

Commented:
I never want to reach full speed though so surely for example if my max speed is 600mm/s and I want to complete the move in 14.2 then actually anything above 77mm/s^2 would mean I would complete in less than 14.2 secs.  At 77 mm/s^2 my max speed would be 548mm/s which would mean I would ramp up and immediately start ramping back down without ever actually hitting 600mm/s.  Any lower than 77mm/s^2 would mean there would be a period of moving at a uniform speed.  (This is basically to look at reducing the pendulum effect of a moving piece on a long pole)  I would get the initial figure and then try reducing it down slowly until the swing stops)
GrahamSkanRetired
CERTIFIED EXPERT
Top Expert 2012

Commented:
I'm not sure that I am much wiser, but I'll try re-reading your comment

Here is an attempt to find the fastest time.

Sub Fastest()
    Dim MaxAccel As Single
    Dim MaxSpeed As Single
    Dim StartPos As Single
    Dim EndPos As Single
    Dim distance As Single
    Dim TimeToMax As Single
    Dim TravelTime As Single
    Dim DistanceToMax As Single
    
    MaxAccel = 250 'mm/sec^2
    MaxSpeed = 600  'mm/sec
    StartPos = 2007  'mm
    EndPos = -1899 'mm
    distance = StartPos - EndPos
    
    'v = u + at
    TimeToMax = MaxSpeed / MaxAccel
    DistanceToMax = MaxSpeed / (2 * MaxAccel)
    If DistanceToMax > distance / 2 Then
        TravelTime = 2 * TimeToMax + distance - (2 * DistanceToMax) / MaxSpeed
    Else
        TravelTime = 2 * Sqr(distance / MaxAccel)
    End If
    MsgBox TravelTime
End Sub

Open in new window

Retired
CERTIFIED EXPERT
Top Expert 2012
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
GrahamSkanRetired
CERTIFIED EXPERT
Top Expert 2012

Commented:
I'm not sure how to fit the mathematical requirement with your mention of a pendulum effect, but, as you are probably aware, pendulum movement is sinusoidal.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.