Notebook 7.3 - Tutorial Solutions using Python and Gekko

Question 1

The following equations describe the movement of a vehicle:

\begin{align} \frac{dx}{dt} & = v \cos \theta \\ \frac{dy}{dt} & = v \sin \theta \\ \frac{dv}{dt} & = a_v \\ \frac{dv}{dt} & = h(x,y) +u_e-u_b+f(v) \\ \frac{d\theta}{dt} & = \phi \\ \end{align}

where $x,y$ denote the position of the vehicle, $v$ is velocity and acceleration is $a$. For simplicity, $u_e$ and $u_b$ are combined into a single variable $u_v$. In addition, a region is created that must be avoided based on the grid for part c). The region is represented as 3 circular obstacles of radius = 6.5. The following equation is used to ensure the vehicle does not collide with the obstacle:

\begin{equation} (x-x_o)^2 + (y-y_o)^2 \geq r_o^2 \end{equation}

Question 2

The following equations describe the movement of the rocket:

\begin{align} \frac{ds}{dt} & = v \\ \frac{dv}{dt} & = \frac{u-0.2v^2}{m_v} \\ \frac{dm_v}{dt} & = -0.01u^2 \\ \end{align}

where $x$ denotes the position of the rocket, $v$ is velocity and fuel mass is $m_v$. The propulsion force $u$ controls the vehicle movement.