Results 1 to 7 of 7

Thread: Time and Decay problem

  1. #1

    Thread Starter
    Addicted Member darrenl's Avatar
    Join Date
    Jul 2000
    Location
    Portsmouth, UK
    Posts
    148

    Time and Decay problem

    I have an object spinning with starting rotation and a spin step i.e. how many degrees it moves each time interval. I want to decrease the spin step linearly over a given time period so that the object rests at a given angle.

    I want to calculate the decay rate (for the spin step) for any given time and spin rate accross a delta angle?

    Sorry if this is not very clear, Its a bit like spinning a wheel and wanting the wheel to spin for a fixed amount of time and come to rest at a fixed stop point.

    Any ideas?
    Dazzer

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Time and Decay problem

    You have a choice to make. Namely, how many times do you want the object to rotate completely before it stops?

    Let's say your object has been spinning and is at exactly xo when you hit "Stop". You want it to finish rotating in n time units at an angle of ao.

    So, to stop on this very turn, you would need to do the following:

    1) Check to see if x is bigger than a.

    If it is not, then you know that the angle you have left is (a - x)o
    If it is, then you have to go around through zero, so the angle you have left is (360 - (a - x))o.

    Let us call the angle you have left Ao.

    2) You want to turn through Ao in n time units, therefore the angle per time unit is just:

    A/n


    If you want to rotate w extra times around, you need (A + (360 x w))o





    Or do you mean that you want to reduce the rate of spin linearly, rather than the actual spin step? i.e. smoothly decelerate to a standstill and finish at the desired angle?

    zaza
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  3. #3

    Thread Starter
    Addicted Member darrenl's Avatar
    Join Date
    Jul 2000
    Location
    Portsmouth, UK
    Posts
    148

    Re: Time and Decay problem

    Yes, I want to reduce the rate of spin to land at a desired angle.
    Dazzer

  4. #4
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Time and Decay problem

    You won't be able to choose both the time frame over which this happens and the position that you end up at if your deceleration is constant.

    Your initial and final speeds are already determined, meaning that your deceleration can be calculated either by how long you want to take in getting there or how far you want to travel in doing so.
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  5. #5

    Thread Starter
    Addicted Member darrenl's Avatar
    Join Date
    Jul 2000
    Location
    Portsmouth, UK
    Posts
    148

    Re: Time and Decay problem

    Yes,

    The time to action this will be fixed, obviously the final speed will be 0, so the issue is in calculating the deceleration to reach the stop angle.
    Dazzer

  6. #6
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Time and Decay problem

    The point is that you can't choose both the time you want to take and the distance travelled in that time.

    If you start at 10 deg/sec and want to stop in 1 sec, then you have to decelerate at 10 deg/sec2. In this time you will travel 5o.

    If you start at 10 deg/sec and want to stop in 5o, then it will take you 1 sec to do so.


    You can use the linear eqs of motion to see this:

    u = start speed
    v = end speed
    s = distance travelled
    t = time taken
    a = acceleration

    Any 3 of these are enough to calculate the other 2.
    If you know u and v and choose t, you determine a and s.

    v = u + at -> gets you a
    s = ut + 0.5at2 -> gets you s


    If you know u and v and choose s, you determine a and t.

    v2 = u2 + 2as -> gets you a
    v = u + at -> gets you t


    So pick one, and the other will follow as a result.




    If you still don't like that, think of it this way; let's say you're travelling at 1 deg/sec. You can't say "I want to stop 180 degrees from now in 1 sec"; it's not physically possible. You can say "I want to stop in 1 sec" and you'll end up wherever you end up, or you can say "I want to stop 180 degrees from here", and you'll get there whenever you get there.


    If you want to say "I want to be at 180 degrees from now in 1 sec", then you can but you'll have some speed when you get there. The only way to stop as well is if you accelerate first and then decelerate, which means that you can't have a constant deceleration.



    zaza
    Last edited by zaza; Sep 28th, 2007 at 01:19 PM.
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  7. #7
    Frenzied Member
    Join Date
    Sep 2006
    Location
    Scotland
    Posts
    1,054

    Re: Time and Decay problem

    I amn't sure of the code, or even the best way to go about it, but I do have a suggestion. Why don't you find the angle you are stopping at, rotate to it, and then begin to slow down at a constant rate? This will work better for faster spinning objects though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width