\chapter{Modeling Examples}
\section{The Modeling of a Vehicle}
Before a vehicle settles down into a steady-state after being subjected to the steering input, there is a transient state. The handling qualities of a vehicle depend on its transient behavior, among other factors. In this section we model a vehicle in a turning maneuver, for example, a step lane change. During such a maneuver, the vehicle undergoes translational as well as rotational motion. When modeling a vehicle in such a maneuver it is convenient to use reference coordinate frame attached to and moving with the vehicle. This is because with respect vehicle coordinate frame, moments of inertias of the vehicle are constant. We use the SAE (Society of Automotive Engineers) standard coordinate system in our model as shown in Figure~\ref{fig:one}. Lower case letters are used to label axes of the vehicle coordinate system.
\begin{figure}
\vspace{4in}
\hskip.2in\special{bmp:c:/tony/sae.bmp x=5.33in y=4in}
\caption{The Society of Automotive Engineers (SAE) coordinate system attached to the vehicle.}
\label{fig:one}
\end{figure}
Following the SAE convention we define the coordinates as follows:
\begin{itemize}
\item the $x$-coordinate is directed forward and on the longitudinal plane of symmetry of the vehicle,
\item the $y$-coordinate has a lateral direction out the right side of the vehicle,
\item the $z$-coordinate is directed downward with respect to the vehicle,
\item the roll velocity about the $x$-axis is denoted by $\dot{\varphi}$,
\item the pitch velocity about the $y$-axis is labeled by $\dot{\rho}$,
\item the yaw velocity about the $z$-axis is denoted by $\dot{\theta}$.
\end{itemize}
The origin of the vehicle coordinate system is located at the vehicle center of gravity (CG). We also use a global, or fixed coordinate system. Its axes are labeled using upper case letters as it is shown in Figure~\ref{fig:veh_pth}.
\begin{figure}
\vspace{3in}
\hskip1in\special{bmp:c:/mybook/veh_pth.bmp x=4in y=3in}
\caption{Analyzing vehicle motion using coordinate frame attached to the vehicle.}
\label{fig:veh_pth}
\end{figure}
To form the equations of motion of the vehicle, we need an expression for the vehicle CG acceleration. We first compute the change in the longitudinal component of the velocity. Using Figure~\ref{fig:veh_pth} and Figure~\ref{fig:veh_acc}, and assuming small angles we obtain
\begin{eqnarray*}
\left( v_x+\Delta v_x\right)\cos \Delta \theta - v_x -\left( v_y+\Delta v_y\right)\sin \Delta \theta &\approx& \Delta v_x-v_y \Delta \theta\\
&=& \Delta \dot{x}-\dot{y}\Delta \theta. 
\end{eqnarray*}
\begin{figure}
\vspace{3in}
\hskip1in\special{bmp:c:/mybook/veh_acc.bmp x=4in y=3in}
\caption{Computing the change in the longitudinal and lateral components of the vehicle velocity.}
\label{fig:veh_acc}
\end{figure}
Hence the total longitudinal acceleration component $a_x$ is
\begin{eqnarray*}
a_x &=& \lim_{\Delta t \to 0}\frac{\Delta v_x - v_y \Delta \theta}{\Delta t}\\
&=& \dot{v_x}-v_y\dot{\theta}\\
&=& \ddot{x}-\dot{y}\omega_z.
\end{eqnarray*}
Using similar argument to the one above we obtain the lateral acceleration component $a_y$ to be
\begin{eqnarray*}
a_y &=& \dot{v_y}+v_x\dot{\theta}\\
&=& \ddot{y}+\dot{x}\omega_z.
\end{eqnarray*}
In further analysis we assume that the vehicle is symmetric with respect to the $x0z$ plane. We use the so called bicycle model that is shown in Figure~\ref{fig:veh_for}.
\begin{figure}
\vspace{3in}
\hskip1in\special{bmp:c:/mybook/veh_for.bmp x=4in y=3in}
\caption{A simplified, bicycle, model of a vehicle.}
\label{fig:veh_for}
\end{figure}
Using Figure~\ref{fig:veh_for} we obtain the following two equations for a vehicle in a planar motion:
\[
m\left(\ddot{x}-\dot{y}\omega_z \right)=2F_{xf}\cos \delta_f-2F_{yf}\sin\delta_f +2F_{xr},
\]
and
\[
m\left(\ddot{y}+\dot{x}\omega_z \right)=2F_{xf}\sin \delta_f+2F_{yf}\cos\delta_f +2F_{yr}.
\]
The third equation of motion is obtained by summing the torques with respect to the $z$-axis. Referring again to Figure~\ref{fig:veh_for}, we obtain:
\[
I_z\omega_z=-2l_2F_{yr}+2l_1F_{yf}\cos\delta_f + 2l_1F_{xf}\sin\delta_f.
\]
In our further analysis we assume $v_x=\dot{x}=U=\mb{constant}$. This means that we need to use only the last two equations of motion in our model. The lateral forces $F_{yf}$ and $F_{yr}$ that appear in the above equations of motion are functions of the corresponding slip angles $\alpha_f$ and $\alpha_r$ and cornering stiffness coefficients $C_{\alpha f}$ and $C_{\alpha r}$. The tire slip angle is the angle between desired direction of motion of the tire specified by the steer angle and direction of travel of the center of the tire contact. We model dependencies between the lateral forces and slip angles as
\[
F_{yf}=C_{\alpha f}\alpha_f,
\]
and
\[
F_{yr}=C_{\alpha r}\alpha_r.
\]
The coefficients $C_{\alpha f}$ and $C_{\alpha r}$ are measured experimentally. A reasonable value is
\[
C_{\alpha f}=C_{\alpha r}=30,000.00 N/rad.
\]
We formulate expressions for the slip angles using Figure~\ref{fig:veh_vel}.
\begin{figure}
\vspace{3in}
\hskip1in\special{bmp:c:/mybook/veh_vel.bmp x=4in y=3in}
\caption{A diagram of a simplified vehicle model for computing slip angles.}
\label{fig:veh_vel}
\end{figure}
Assuming small angles and assuming $F_{xf}=0$ we form an expression for the forward tire slip angle
\begin{eqnarray*}
\alpha_f &=& \delta_f-\tan^{-1}\left( \frac{v_y+l_1\omega_z}{v_x}\right)\\
&\approx& \delta_f-\frac{v_y+l_1\omega_z}{v_x}\\
&=& \delta_f-\frac{\dot{y}+l_1\omega_z}{\dot{x}}.
\end{eqnarray*}
The rear tire slip angle is
\begin{eqnarray*}
\alpha_r &=& \delta_r+\tan^{-1}\left(\frac{l_2\omega_z-v_y}{v_x}\right)\\
&\approx& \delta_r+\frac{l_2\omega_z-v_y}{v_x}\\
&=& \delta_r+\frac{l_2\omega_z-\dot{y}}{\dot{x}}.
\end{eqnarray*}
Hence
\begin{eqnarray*}
F_{yf} &=& C_{\alpha f}\left( \delta_f-\frac{\dot{y}+l_1\omega_z}{\dot{x}}\right),\\
F_{yr} &=& C_{\alpha r}\left( \delta_r+\frac{l_2\omega_z-\dot{y}}{\dot{x}}\right).
\end{eqnarray*}
Substituting the above two equations into the equation of motion in the lateral direction, and assuming small angles yields
\[
m\ddot{y}+m\dot{x}\omega_z=2C_{\alpha f}\delta_f-2C_{\alpha f}\frac{l_1\omega_z+\dot{y}}{U}+2C_{\alpha r}\delta_r+2C_{\alpha r}\frac{l_2\omega_z-\dot{y}}{U}.
\]
Rearranging terms and performing some manipulations we get
\[
\ddot{y}=-\left( \frac{2C_{\alpha f}+2C_{\alpha r}}{mU}\right)\dot{y}+\left( -U-\frac{2C_{\alpha f}l_1-2C_{\alpha r}l_2}{mU}\right)\omega_z +\frac{2 C_{\alpha f}}{m}\delta_f+\frac{2 C_{\alpha r}}{m}\delta_r.
\]
Substituting the expressions for $F_{yf}$ and $F_{yr}$ into the equation describing the vehicle rotational motion, and assuming small angles yields
\[
I_z\dot{\omega}_z=2l_1C_{\alpha f}\left( \delta_f -\frac{l_1\omega_z + \dot{y}}{U}\right)\delta_f-2l_2C_{\alpha r}\left(\delta_r+\frac{l_2\omega_z-\dot{y}}{U}\right).
\]
Rearranging and performing manipulations yields
\[
\dot{\omega}_z=-\left(\frac{2l_1C_{\alpha f} - 2l_2C_{\alpha r}}{I_zU} \right)\dot{y}-\left( \frac{2l_1^2C_{\alpha f}+2l_2^2C_{\alpha r}}{I_zU}\right)\omega_z+\frac{2l_1C_{\alpha f}}{I_z}\delta_f-\frac{2l_2C_{\alpha r}}{I_z}\delta_r.
\]
We are interested in a step lane change maneuver. This requires that we transform the vehicle lateral variable into the fixed coordinates. Assuming small angles and referring to Figure~\ref{fig:veh_lat} we obtain
\begin{eqnarray*}
\dot{Y} &=& \dot{x}\sin \psi -\dot{y}\cos \psi\\
&\approx& U\psi - \dot{y}.
\end{eqnarray*}
\begin{figure}
\vspace{3in}
\hskip1in\special{bmp:c:/mybook/veh_lat.bmp x=4in y=3in}
\caption{Computing the position of a vehicle with respect to the fixed coordinates.}
\label{fig:veh_lat}
\end{figure}
Note that
\begin{eqnarray*}
\dot{X} &=& \dot{x}\cos \psi + \dot{y}\sin \psi\\
&\approx& U+\dot{y}\psi.
\end{eqnarray*}
We assume that
\[
\omega_z=\dot{\psi},
\]
and that
\[
\theta=\psi.
\]
We can now represent the vehicle modeling equations in a state space format. Let
\begin{eqnarray*}
x_1 &=& \dot{y},\quad x_2=\theta,\quad x_3=\omega_z,\quad x_4=Y\\
u_1&=& \delta_f,\quad u_2= \delta_r,\quad c=Y,
\end{eqnarray*}
where $c$ denotes the plant output. Then, we can write
\begin{eqnarray*}
\left[\begin{array}{c}
\dot{x}_1\\
\dot{x}_2\\
\dot{x}_3\\
\dot{x}_4
\end{array}\right]&=&\left[\begin{array}{cccc}
-\frac{2C_{\alpha f}+2C_{\alpha r}}{mU}& 0 & -U-\frac{2C_{\alpha f}l_1-2C_{\alpha r}l_2}{mU}& 0\\
0 & 0 & 1 & 0\\
-\frac{2l_1C_{\alpha f} - 2l_2C_{\alpha r}}{I_zU}& 0 & -\frac{2l_1^2C_{\alpha f}+2l_2^2C_{\alpha r}}{I_zU}& 0\\
-1 & U & 0 & 0
\end{array}\right]\left[\begin{array}{c}
{x_1}\\
{x_2}\\
{x_3}\\
{x_4}
\end{array}\right]\\
&+&\left[\begin{array}{cc}
\frac{2C_{\alpha f}}{m}&\frac{2C_{\alpha r}}{m} \\
0 & 0\\
\frac{2l_1C_{\alpha f}}{I_z}&-\frac{2l_2C_{\alpha r}}{I_z} \\
0 & 0
\end{array}\right]\b u\\
c&=&\left[\begin{array}{cccc}
0&0&0&1
\end{array}\right]\left[\begin{array}{c}
{x_1}\\
{x_2}\\
{x_3}\\
{x_4}
\end{array}\right].
\end{eqnarray*}
A possible vehicle parameters are given in Table~\ref{tab:par}.
\begin{table}
\caption{Vehicle data.}
\label{tab:par}
\begin{center}
\begin{tabular}{cc}
$C_{\alpha f}=C_{\alpha r}$ & $30,000.00\,N/rad$\\
$l_1$ & $1.20\,m$\\
$l_2$ & $1.22\,m$\\
$m$ & $1280\,kg$\\
$I_z$ & $2500\,kgm^2$\\
$U$ & $18.3\,m/sec$\\ \hline
\end{tabular}
\end{center}

\end{table}
Substituting the vehicle data into the modeling equations yields
\begin{eqnarray*}
\left[\begin{array}{c}
\dot{x}_1\\
\dot{x}_2\\
\dot{x}_3\\
\dot{x}_4
\end{array}\right]&=&\left[\begin{array}{cccc}
-5.123& 0 & -18.249& 0\\
0 & 0 & 1 & 0\\
0.026& 0 & -3.841& 0\\
-1 & 18.300 & 0 & 0
\end{array}\right]\left[\begin{array}{c}
{x_1}\\
{x_2}\\
{x_3}\\
{x_4}
\end{array}\right]+\left[\begin{array}{cc}
46.875&46.875\\
0&0\\
28.800&-29.28\\
0&0
\end{array}\right]\b u\\
c&=&\left[\begin{array}{cccc}
0&0&0&1
\end{array}\right]\left[\begin{array}{c}
{x_1}\\
{x_2}\\
{x_3}\\
{x_4}
\end{array}\right].
\end{eqnarray*}