Overview
Comment:New example - used for teaching about linearisation ...
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 4bc499042c51a58953c6adf95331c69fda24f053ac0d6afe4103c73f878df448
User & Date: gawthrop@users.sourceforge.net on 2002-03-07 16:24:16
Other Links: branch diff | manifest | tags
Context
2002-03-26
11:58:58
Added cputime monitoring. check-in: b249b4a2fa user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-03-07
16:24:16
New example - used for teaching about linearisation ... check-in: 4bc499042c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2002-02-19
16:27:06
Changes to make MTT work out of the box with Debian. check-in: 885684d1df user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_abg.fig version [6195b18731].














































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
0 32 #969296
0 33 #e7e7cf
0 34 #9e9a9e
0 35 #cf9200
0 36 #f761ae
0 37 #7171ff
0 38 #595d59
1 3 0 3 1 7 55 0 -1 0.000 1 0.0000 1845 2430 186 186 1845 2430 2031 2430
2 2 0 1 1 7 55 0 47 0.000 0 0 -1 0 0 5
	 1800 2475 4500 2475 4500 2925 1800 2925 1800 2475
2 1 0 3 1 7 55 0 -1 0.000 0 0 -1 0 0 2
	 1830 2467 3180 129
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 5625 4725 5625 4500 5850
2 1 0 3 1 7 55 0 -1 0.000 0 0 -1 0 0 12
	 4453 2442 4177 1964 3884 2024 4282 1579 3700 1707 4103 1268
	 3521 1396 3914 946 3337 1077 3749 632 3445 696 3158 215
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 5625 1575 5625 1800 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 5400 3150 4050 3375 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 7200 3150 5850 3375 6075
4 1 1 55 0 32 30 0.0000 4 315 240 2385 2295 q\001
4 0 1 55 0 3 30 0.0000 4 300 270 2025 1260 L\001
4 0 1 55 0 3 30 0.0000 4 300 270 3105 3510 L\001
4 1 1 55 0 32 30 0.0000 4 225 195 1530 2250 t\001
4 1 0 100 0 18 18 0.0000 4 195 150 3150 5715 1\001
4 1 0 100 0 18 18 0.0000 4 210 390 3195 3915 R:r\001
4 1 4 100 0 18 18 0.0000 4 270 930 3060 7515 SS:[yu]\001
4 1 0 100 0 18 18 0.0000 4 270 240 1305 5715 I:j\001
4 0 0 100 0 18 18 0.0000 4 270 8610 4860 5715 C:k:mtt_e=k*(l^2)*cos(mtt_f/2)*2*(sin(mtt_f/2)-sin(alpha/2))+0*eta\001
4 0 1 101 0 3 20 0.0000 4 270 3255 4950 675 Rod (length L) hinged at left\001
4 0 1 101 0 3 20 0.0000 4 270 4275 4950 1125 Spring (stiffness k) unstretched when \001
4 0 1 101 0 32 20 0.0000 4 210 510 9225 1125 q=a\001
4 0 1 101 0 3 20 0.0000 4 270 3120 4950 1575 eta is the equilibrium angle\001

Added mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_desc.tex version [84c725288d].
































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system NonlinearMSD (NonlinearMSD_desc.tex)
% Generated by MTT on Thu Mar 7 14:48:47 GMT 2002.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This example illustrates the use of \textbf{MTT} to \emph{linaerise} a
nonlinear system -- a non-linear mass-spring-damper system called
\textbf{NonlinearMSD}. The model is considered in Section
\ref{sec:model} and linearisation in Section \Ref{sec:linearisation}.

Further work is suggested in Section \Ref{sec:further}.

\subsection{Bond Graph model}\label{sec:model}

The schematic diagram  of the system
\textbf{NonlinearMSD} is displayed in Figure
\ref{fig:NonlinearMSD_abg.ps}. The system comprises
\begin{itemize}
\item a rigid foundation,
\item a rod of length $L$ hinged at the left-hand end and
\item a linear spring of stiffness $k$ attached to the rigid
  foundation a distance $L$ from the hinge and to the free end of the rod.
\end{itemize}
The spring is unstretched when the rod makes an angle $\theta = \alpa
= \frac{pi}{3}$ with the foundation.

Using elementary geometry, the effectice angular spring generates a
torque $\tau$ given by (\ref{eq:spring})
\begin{equation}\label{eq:spring}
  \tau = -2kl^2 \cos{\frac{\theta}{2}} (\sin{\frac{\theta}{2}}-\sin{\frac{\alpha}{2}})
\end{equation}

The acausal bond graph of system \textbf{NonlinearMSD} is also
displayed in Figure \Ref{fig:NonlinearMSD_abg.ps}. This shows the
three bond graph components representing the friction \textbf{R}, the
inertia \textbf{I} and the spring \textbf{C} components. The
non-linear spring characteristic is given explicitly\footnote{The
  additional 0*eta term has no effect - it merely introduced the
  variable $\eta$ -- the equilibrium angle -- into the model}.

The (nonlinear) system ordinary differential equation is given by
\textbf{MTT} in Section \Ref{sec:NonlinearMSD_ode.tex}. This is a
special case of the general non-linear ordinary differential equation:
\begin{equation}
  \label{eq:non-state}
  \begin{cases}
    \dot{x} = f(x,u)\\
    y = g(x,u)
  \end{cases}
\end{equation}

\subsection{Linearisation}
\label{sec:linearisation}

The first step in linearisation is to determine a set of (constant)
states $x_e$ and (constant) inputs $u_e$ so that the system is in
equilibrium - that is
\begin{equation}
  \label{eq:eqilibrium}
 \dot{x} = f(x_e,u_e) = 0
\end{equation}

In this case, choosing an angle $\theta=\eta$ and an input:
\begin{equation}\label{eq:u_e}
  u_e = -\tau = 2kl^2 \cos{\frac{\eta}{2}} (\sin{\frac{\eta}{2}}-\sin{\frac{\alpha}{2}})
\end{equation}
together with zero velocity gives an equilibrium.

With this choice
The linearised system is given in terms of the $A$, $B$, $C$ and $D$
matrices appearing in the state equation:
\begin{equation}
  \label{eq:state}
  \begin{cases}
    \dot{x} = Ax + Bu\\
    y = Cx + Du
  \end{cases}
\end{equation}

\textbf{MTT} automatically generates these matrices -- see Section
\Ref{sec:NonlinearMSD_sm.tex}.

\subsection{Further work}
\label{sec:further}
\begin{enumerate}
\item Derive the system ordinary differential equation appearing in
  Section \Ref{sec:NonlinearMSD_ode.tex}.
\item Explain how the input of (\ref{eq:u_e}) gives equilibrium for
  all $\eta$.
\item Explain how the elements of the $A$, $B$, $C$ and $D$ appearing
  Section \Ref{sec:NonlinearMSD_sm.tex} arise from the ordinary
  differential equation of Section \Ref{sec:NonlinearMSD_ode.tex}
  together with the input of (\ref{eq:u_e}).
\item Setting up parameters, inputs and initial state as in Sections
  \Ref{sec:NonlinearMSD_numpar.tex}, \Ref{sec:NonlinearMSD_input.tex}
  and \Ref{sec:NonlinearMSD_state.tex}, perform simulations as in
  Section \Ref{sec:NonlinearMSD_state.tex} - the figure shows the
  angular \emph{velocity} $\dot{\theta}$.
\item Repeat the simulation with different perturbations by modifying
  the file ``NonlinearMSD\_input.tex'' (see Section
  \Ref{sec:NonlinearMSD_input.tex})
  \begin{enumerate}
  \item note that for smaller perturbations, the graphs are of similar
    shape (scaled by the perturbation input)
  \item note that for larger perturbations the graphs are quite
    different - this is a non-linear system.
  \end{enumerate}
\item \label{item:1} Repeat the simulation with different equilibrium angles $\eta$ by modifying
  the file ``NonlinearMSD\_numpar.tex'' (see Section
  \Ref{sec:NonlinearMSD_numpar.tex}) appropriately. Note that when
  $\eta=\pi$, the linearised system is \emph{unstable}.
\item The (2,1) element of the $A$ matrix in Section
  \Ref{sec:NonlinearMSD_sm.tex} is the \emph{linearised} stiffness
  $k_l$. Plot this against $\eta$ and explain the observation in item
  \ref{item:1}.
\end{enumerate}


Added mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_input.txt version [96b10a19b1].











1
2
3
4
5
6
7
8
9
10
+
+
+
+
+
+
+
+
+
+
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System NonlinearMSD, representation input, language txt; 
## File NonlinearMSD_input.txt; 
## Generated by MTT on Thu Mar  7 10:50:46 GMT 2002; 

## First term is the equilibrium input; last term is the perturbation input.
NonlinearMSD_yu	= k*(l^2)*cos(eta/2)*2*(sin(eta/2)-sin(alpha/2)) + 1e-2;

Added mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_numpar.txt version [da778d0db5].
















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System NonlinearMSD, representation numpar, language txt; 
## File NonlinearMSD_numpar.txt; 
## Generated by MTT on Thu Mar  7 14:03:19 GMT 2002; 



alpha	= pi/3; # Angle for unstretched string
eta	= pi/3; #  Equilibrium angle
j	= 1.0; # Inertia
k	= 1.0; # Spring constant
l	= 1.0; # Rod length
r	= 1.0; # Rotational resistance


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]