% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system TwoLinkGPC (TwoLinkGPC_desc.tex)
% Generated by MTT on Wed Apr 15 18:15:23 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/15 18:41:58  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkGPC} is
   displayed in Figure \Ref{TwoLinkGPC_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkGPC_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkGPC_sub}.
   
   This example provides an illustration of nonlinear generalised
   predictive control (GPC) (continuous-time) operating on a twolink
   manipulator with a modified sensor.  The  sensor is modified in a
   rather contrived way to give a nonlinear system with an
   \emph{unstable} inverse. The idea is that the sensor approximates a
   pure delay of $\tau$ as:
   \begin{equation}
     e^{-s\tau} \approx 1 - s \tau
   \end{equation}
   
   The example contrasts GPC with GMV, which can also be interpreted
   as:
\begin{itemize}
\item the exact linearisation (by feedback) followed by a
  pole-placement design on the resulting linear system and
\item a special case of generalised predictive control (GPC) were the
  prediction horizon is zero and the $P(s)$ polynomial is the same as
  the system relative degree and
\end{itemize}


The composite system of Figure \Ref{TwoLinkGPC_abg} has three
(visible) parts:
\begin{enumerate}
\item a linear decoupled \emph{specification} system that describes the desired
  closed-loop system in terms of a physical system (two decoupled
  mass-spring-damper systems),
\item the system itself (a two-link manipulator) representing the
  system to be controlled, more details are given in Sections
  \Ref{sec:TwoLinkP_ode.tex} and \Ref{sec:TwoLinkP_rfe.tex}.
\item a model of the system with additional state inputs to be used as
  a state observer.
\end{enumerate}
The invisible parts are implemented in the text file
``TwoLinkGPC\_input.txt'' (see Section \Ref{sec:TwoLinkGPC_input.txt}).
These parts are:
\begin{itemize}
\item the reference signal (joint angles)
  \begin{equation}
    w(t) = 
    \begin{cases}
      \begin{pmatrix}
        \pi \\
        0
      \end{pmatrix} & 0 \ge t > 10 \\
      \begin{pmatrix}
        2\pi \\
        0
      \end{pmatrix} & 10 \ge t > 15 \\
      \begin{pmatrix}
        2\pi \\
        \pi
      \end{pmatrix} & 15 \ge t > 30 \\
    \end{cases}
  \end{equation}
\item The control signal (joint torques) being the solution of 
  \begin{equation}
    \phi^*(t) = O_o(\hat x(t)) + O_h(\hat x(t)) u(t) = w(t)
  \end{equation}
where $\hat x$ is the observed state.
\item The observer feedback signal
  \begin{equation}
    u_x = K ( y - \hat y)
  \end{equation}
where $K$ is the observer gain matrix and $y$ and $\hat y$ are the
system and model outputs respectively.
\end{itemize}
The observer gain is set up on the basis of the \emph{linearised}
system using LQ theory. This is implemented in the text file
``TwoLinkGPC\_state.txt'' (see Section \Ref{sec:TwoLinkGPC_state.txt})
using the Octave function ``lqe'' together with the MTT-generated
linearised system ``TwoLink\_sm''.


The system was simulated using Octave under MTT with the results given
in Figures
\Ref{fig:TwoLinkGPC_odeso.ps-TwoLinkGPC-Theta-1,TwoLinkGPC-Theta-1-r}
and
\Ref{fig:TwoLinkGPC_odeso.ps-TwoLinkGPC-Theta-2,TwoLinkGPC-Theta-2-r}
giving the actual and specification angles for joints 1 and 2
respectively.

The initial \emph{system} state was zero except that the angle of the
first rod was $\frac{\pi}{4}$. The initial \emph{observer} state was
(erroneously but deliberately) set at zero. This explains the
(decaying) discrepancy between the actual and specification angles.
Simulations with zero initial state gave precise matching.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
