Ramp up down? Code ideas.


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    971


    Did you find this post helpful? Yes | No

    Default Re: Ramp up down? Code ideas.

    Consider this.

    The error between expected and actual output be summed every second in sE

    Now, decide the correction time as Ti or error Integration time in seconds. The aim is to apply the full sE in Ti seconds from the time of Error inception.

    The fraction of E that gets applied to regen output will be sE / Ti

    sE will be reduced by the above fraction.

    To prevent a lockup condition from which your control cannot recover, you will need to put limits (both +ve and -ve) on the value of sE so that it doesn't do fancy things like rollover on addition

    The output will change at the rate you specified.

    Good luck with that and Happy thanksgiving
    Last edited by Jerson; - 25th November 2023 at 03:55. Reason: wording

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: Ramp up down? Code ideas.

    if you were to use proper complementary numbers to represent your controller power then


    F(999) could be -999 and 0(345) would be 345

    ie actual = -999 desired = 345
    -999-345=-1344
    means desired is -1344 below required
    to get there in 100 x 10mS steps [1 second] just add 13.4 for the next 100 generations


    to go back
    345-(-999)=1344


    means desired is 1344 over required


    to get there in 100 x 10mS steps [1 second] just subtract 13.4 for the next 100 generations


    the controller can figure if its assist or regen simply by testing bit.15


    by rounding down the incrementor you will easily get within 10% will no fuss
    never underestimate the beauty of unsigned subtractions with complementary numbers


    to convert from pos to negative number n=~n+1
    to convert from negative to pos number n=~n+1



    ps never try to divide or multiply a negative number
    ie.
    inc = abs(difference)/100
    Last edited by richard; - 25th November 2023 at 06:47.
    Warning I'm not a teacher

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Ramp up down? Code ideas.

    Thanks for those.

Similar Threads

  1. Linear acceleration ramp
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th May 2012, 07:27
  2. Code optomization ideas...(link)
    By Heckler in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2012, 17:07
  3. Making code more efficient, any ideas please?
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th July 2011, 14:28
  4. Make an acceleration/deceleration ramp : any ideas?
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 4th April 2011, 00:19
  5. Ideas on ir-code for dimmer
    By tirithen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 14th February 2009, 00:22

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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