+ Reply to Thread
Results 1 to 7 of 7

Control rate of change of a cell using VBA?

  1. #1
    Registered User
    Join Date
    01-29-2007
    Posts
    40

    Control rate of change of a cell using VBA?

    Ok, here's one that I really have had no luck searching for...

    I'm writing a little sheet to test some navigators on their basic speed/distance/time calculation skills. Ignore the clocks in Row 1, they're unrelated.

    What I'd like is to simulate some basic acceleration / deceleration characteristics of a vehicle against a speed demand set point that the user enters. Obviously, no vehicle can go from any speed to another instantaneously, so I'd like my end users to have to take this into account when setting their demand speed.

    Simply put, I'd like the actual speed in cell H4 to always target the demand speed in H3 and always return a result, but lag behind the demand speed slightly when changing.

    I appreciate this is very basic - vehicles will have individual acceleration curves which are obviously non-linear, and acceleration and deceleration will be different to each other. But, for now, a simple linear control to limit the rate of change cell H4 would be terrific.

    Cheers in advance,

    Roy K.
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,047

    Re: Control rate of change of a cell using VBA?

    Not sure if this is anywhere near to what you're looking for.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    slows down the increase of the actual speed.
    The 60/20 part is there to adjust for accelleration power. Means 0 to 60 miles in 20 seconds. So you can play with the seconds.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    01-29-2007
    Posts
    40

    Re: Control rate of change of a cell using VBA?

    Hi there,

    First up, thanks very much for your response, much appreciated!

    The overall effect of that formula is roughly what I'm trying to achieve. Although it doesn't seem to work at all on deceleration, or when changing to a new target speed after one is reached.

    But, yes, I think we're barking up the right tree, maybe!

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,047

    Re: Control rate of change of a cell using VBA?

    How is decelaration done?

  5. #5
    Registered User
    Join Date
    01-29-2007
    Posts
    40

    Re: Control rate of change of a cell using VBA?

    Deceleration will be done by moving the slider bar to the left to lower the demand speed, or by clicking either the "Stop" or "Crawl" preset speed buttons.

    Also, you've used a reference to my H1 cell clock called "Rally Time". This isn't anything to do with the acceleration or speed part of my sheet, that will eventually just display laptop time, activated by opening the worksheet.

  6. #6
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,047

    Re: Control rate of change of a cell using VBA?

    Aha! The coin dropped, I think.
    Didn't do it in a formula, but in the TickTock2 macro.
    Also added cells for Acceleration and deceleration force.
    Everything starts when clicking the StartRT button.
    You can adjust the demand speed on the fly.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-29-2007
    Posts
    40

    Re: Control rate of change of a cell using VBA?

    Hi Tsjallie - just gave that a whirl and it looks absolutely perfect. I'm trying to get Rally Time to run from Worksheet_Open and reflect laptop time, once that's working I'll integrate your code.

    But for now I'm calling this solved.

    Very much appreciate the assistance, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1