?
Solved

Formula to calculate optimum acceleration and deceleration

Posted on 2011-04-27
8
Medium Priority
?
509 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
0
Comment
Question by:simonwait
  • 5
  • 3
8 Comments
 
LVL 1

Author Comment

by:simonwait
ID: 35478493
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
 
LVL 76

Expert Comment

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


0
 
LVL 1

Author Comment

by:simonwait
ID: 35478606
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35478754
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
 
LVL 1

Author Comment

by:simonwait
ID: 35478904
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35479317
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
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 35479641
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35483060
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question