# Time-optimal control of a car

I'm having trouble with the following problem:

$$\begin{array}{ll} \text{minimize} & J := \displaystyle\int_{t_0}^{t_f} 1 \,\mathrm{d}t\\ \text{subject to} & \dot{v}(t)=-9.8\sin(\theta)+u(t)-\frac{1}{m}F_a(t)\end{array}$$

where

• $\theta$ is the terrain inclination.

• $F_a$ is the aerodynamic drag, given by

\begin{equation*}F_a(t)=\frac{1}{2} \rho A C_d \big( v(t)-v_{\text{wind}}(t) \big)^2\end{equation*}

• $\rho$ is the air density.

• $A$ is the frontal area of the vehicle.

• $C_d$ is the drag coefficient.

• $v_{\text{wind}}$ is the wind velocity.

• $m$ is the mass of the car.

• $u(t)$ is the acceleration due to the accelerator or deceleration due to the brake system. The acceleration satisfies $-\beta \le u(t)\le \alpha$, where $\alpha > 0$ is the maximum acceleration which depends on the capability of the engine and $\beta>0$ is the maximum deceleration which is limited by the braking system parameters.

Further, if $t_0$ is the time leaving from point A, and $t_f$ is the time of the arrival at point B, then

\begin{equation*}v(t_0)=v(t_f)=0,\end{equation*}

and the speed limit on the road is $40km/h$.

1. I think that the Hamiltonian function is $$H=1+\lambda [-9.8\sin(\theta)+u(t)-\frac{1}{2m}\rho AC_d(v(t)-v_{\text{wind}}(t))^2]$$
2. How is the optimal control function $u^*(t)$ expressed?
3. How is the optimal velocity $v^*(t)$ expressed?
• add the physics tag – T.D. Jun 17 '18 at 17:43
• If the ODE is nonlinear (quadratic in $v$), why are you trying to use a linear state-space model? – Rodrigo de Azevedo Jun 17 '18 at 19:27
• Wouldn't the solution just be bang-bang, so first maximum acceleration and a jet unknown time which to maximum deceleration. – Kwin van der Veen Jun 17 '18 at 21:55
• @KwinvanderVeen The optimal control is $u^*(t)=-\beta$ if $t_0≤t<T$ and $u^*(t)=\alpha$ if $T≤t≤t_f$ – VarúAnselmo Sui Jun 18 '18 at 1:31

Given

$$H =1+\lambda(t) \left(-g\sin(\theta)+u(t)-\frac{1}{2m}\rho AC_d(v(t)-v_{\text{wind}}(t))^2\right)$$

we need a control $u^*$ such that $H(v,u^*,\lambda) = 0$ or

$$u^*(t) = \frac{A C \rho _d(v(t)-v_w(t))^2}{2 m}+g \sin (\theta )-\frac{1}{\lambda(t) }$$

and then knowing that

$$\dot\lambda = -\frac{\partial H}{\partial v}\\ \dot v = \frac{\partial H}{\partial \lambda}$$

we have

$$\dot\lambda(t) = \frac{A C_d \rho \lambda (t) (v(t)-v_w(t))}{m}\\ \dot v(t) = -\frac{1}{\lambda(t)}$$

we didn't consider the state restriction $v \le v_{max}$