Formula to calculate optimum acceleration and deceleration

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
LVL 1
simonwaitAsked:
Who is Participating?
 
GrahamSkanRetiredCommented:
Am I interpreting MaxAccel and MaxSpeed incorrectly as imposed limits?

Do you just want to find the acceleration necessary to achieve the fixed time?
Sub FixedTime()
    Dim Accel As Single
    Dim MaxSpeed As Single
    Dim StartPos As Single
    Dim EndPos As Single
    Dim distance As Single
    Dim TargetTime As Single
    TargetTime = 14.2 'secs
    
    
    'Accel = 250 'mm/sec^2
    'Speed = 600  'mm/sec
    StartPos = 2007  'mm
    EndPos = -1899 'mm
    distance = StartPos - EndPos
    
    Accel = 4 * distance / (TargetTime ^ 2)
    MsgBox Accel
End Sub

Open in new window

0
 
simonwaitAuthor 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
0
 
GrahamSkanRetiredCommented:
How would you define 'optimum' - fastest? If so, then any solution would require using maximum possible acceleration and deceleration values.


0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
simonwaitAuthor 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.
0
 
GrahamSkanRetiredCommented:
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.
0
 
simonwaitAuthor 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)
0
 
GrahamSkanRetiredCommented:
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

0
 
GrahamSkanRetiredCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.