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$.


*

*I think that the Hamiltonian function is \begin{equation}H=1+\lambda [-9.8\sin(\theta)+u(t)-\frac{1}{2m}\rho AC_d(v(t)-v_{\text{wind}}(t))^2]\end{equation}

*How is the optimal control function $u^*(t)$ expressed?

*How is the optimal velocity $v^*(t)$ expressed?


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}$
