PWM Parabola - What's the calculation it performs?
Posted: Tue Feb 05, 2013 12:01 pm
I was just curious as to what the actual calculation the parabola function performs to determine the intensity % at whatever time of day it is? Maybe I missed it, but I tried to peek at all the libraries and I didn't see it anywhere in there.
From what I understand, it uses the start time, start %, end time, end(max) % to calculate a "midday" for the max %... and then it gradually increases from start % up max % at midday, ramping back down in reverse to end time. That part I understand no problem. I don't know the exact code used to figure the midday, but I'm sure it just takes the length of time and divides by 2, than adds that to the start time (or something as simple as that.)
But I guess my question is, what's the formula used to calculate the incremental values along the way?
I would think it's not a linear equation since it's a parabola, right? So, if that's correct, then it's not a simple x% increase per/hour until the midday point (or minute, or second, or whatever interval period it uses). I'm also guessing that the time span between "start time" / "midday" / "end time" and the intensity difference between "start%" / "end%" will vary the interval increases too. But there has to be some simple formula that is computed using those values... what is it?
From what I understand, it uses the start time, start %, end time, end(max) % to calculate a "midday" for the max %... and then it gradually increases from start % up max % at midday, ramping back down in reverse to end time. That part I understand no problem. I don't know the exact code used to figure the midday, but I'm sure it just takes the length of time and divides by 2, than adds that to the start time (or something as simple as that.)
But I guess my question is, what's the formula used to calculate the incremental values along the way?
I would think it's not a linear equation since it's a parabola, right? So, if that's correct, then it's not a simple x% increase per/hour until the midday point (or minute, or second, or whatever interval period it uses). I'm also guessing that the time span between "start time" / "midday" / "end time" and the intensity difference between "start%" / "end%" will vary the interval increases too. But there has to be some simple formula that is computed using those values... what is it?