I have a periodic function describing the angle of an impeller blade rotating around an axis (2 pi is a full rotation):
(R code:)
param.rps = 2 # rotations per second
getAngle <- function(t) { t %% param.rps / param.rps * pi * 2.0 }
x = seq(0, 10, 0.1)
y = getAngle(x)
plot(y ~ x, xlab="Time [seconds]", ylab="Angle", axes=F, ylim=c(0,2)*pi)
axis(side=1)
axis(side=2, at=pi*0:2,labels=c("0", "pi", "2*pi"),las=2)
Now I would like to add a "ramp up" phase where the impeller accelerates from 0 up to its final rps. I tried just adding a factor to the formula that linearly increases up to 1, and that does achieve the acceleration but has the unwanted side effect of making the impeller "jump" back halfway through its rotation:
param.rampup = 5 # how many seconds is the ramp up phase
getAngle <- function(t) { pmin(1.0, (t / param.rampup)) * t %% param.rps / param.rps * pi * 2.0 }
I assume the cycle points would have to be shifted to the right by the amount of the ramp up phase somehow but I've been playing around a bit and can't make it produce the behaviour I want. Does anybody have any hints?


Here is a solution: