For a project I am doing, I need to calculate the time a car will take to travel from point A to point B, given that:
- The distance between A and B is straight
- The car has starting velocity Vstart, and a maximum velocity Vmax
- At point B, a curve starts, where the car must have a different maximum velocity: Vcurvemax. This velocity is typically lower than Vmax
- The car will accelerate coming from A, at its accelaration rate, at most until it reaches velocity Vmax. At some point along the line from A to B, whether or not Vmax was reached, the car needs to decelarate (at its decelaration rate), in order to be at velocity Vcurvemax when reaching point B
My question is: is it possible to calculate precisely the time the car will take to cover the distance between A and B, given these circumstances? Actually, this comes down to another question: is it possible to calculate precisely the point between A and B where the car needs to start decelarating?
I could estimate it fairly accurately by doing a few calculations (in a programmatic loop) to find out just about where the car will have to start decelarating. However, I wonder if a calculation could precisely determine this.
Thanks for any ideas!
The given data are the initial velocity $v_A$, the end velocity $v_B$, the maximal speed $\bar v$, the maximal acceleration $a^\uparrow>0$, the maximal deceleration $a^\downarrow>0$, and the distance $d=|AB|$. From these data the time needed to travel from $A$ to $B$ is determined, and can be simply calculated. Three different cases can arise, depending on the numerical values of the data:
(i) If $v_A$ is too large in comparison with $d$ and $a^\downarrow$ the trip cannot be done as required.
(ii) If case (i) does not hold we may accelerate with rate $a^\uparrow$ to a certain maximal speed $v_0<\bar v$, then decelerate to $v_B$ with rate $a^\downarrow$.
(iii) If $d$ is even larger in comparison we may accelerate with rate $a^\uparrow$ until the maximal speed $\bar v$ is reached, then cruise at that speed until a well defined time point, where we start decelerating at rate $a^\downarrow$ and arrive at $B$ with the required speed $v_B$.
Concerning case (ii):
At the beginning one has $$v(t)=v_A+a^\uparrow t,\quad s(t)=v_A t+a^\uparrow{t^2\over2}\ .$$ The state $v(t)=\bar v$ is reached at time $t_1={\bar v-v_A\over a^\uparrow}$, and the necessary length of road to reach this state is $$s_{\rm acc}=v_A t_1+a^\uparrow{t_1^2\over2}\ .$$ Similarly a full decelerating process takes time $t_2={\bar v-v_B\over a^\downarrow}$ and requires $$s_{\rm dec}=v_B t_2+a^\downarrow{t_2^2\over2}$$ of road length. If $s_{\rm acc}+s_{\rm dec}>d$ then we cannot accelerate to the maximal possible speed, and we are in case (ii). In this case one has to solve the system of equations $$v_A t'+a^\uparrow{t'^2\over2}+v_B t''+a^\downarrow{t''^2\over2}=d,\qquad v_A+a^\uparrow t'=v_B+a^\downarrow t''\ .$$ The total time then is $t'+t''$.