Overview
Comment:Added notes on -ae hybrd, rk4, ode2odes.cc, .oct dependencies.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: a1e26d10febf79dabc028ea1c70cdf1b6dc05cb3990a53739821e750f6672cb4
User & Date: geraint@users.sourceforge.net on 2001-07-23 03:25:02
Other Links: branch diff | manifest | tags
Context
2001-07-23
03:35:29
Updated file structure (mtt/bin). check-in: 30a2b9d6d7 user: geraint@users.sourceforge.net tags: origin/master, trunk
03:25:02
Added notes on -ae hybrd, rk4, ode2odes.cc, .oct dependencies. check-in: a1e26d10fe user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-07-22
19:24:03
Multiple '-v' increases verbosity. check-in: 61ecb7e23e user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/doc/mtt.texi from [9db1b72ad7] to [def72cc1f0].

12
13
14
15
16
17
18



19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+
+
+









@comment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@comment  Version control history
@comment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@comment  $Id$
@comment  $Log$
@comment  Revision 1.3  2001/07/13 03:02:38  geraint
@comment  Added notes on #ICD, gnuplot.txt and odes.sg rep.
@comment
@comment  Revision 1.2  2001/07/03 22:59:10  gawthrop
@comment  Fixed problems with argument passing for CRs
@comment
@comment  Revision 1.1  2001/06/04 08:18:52  gawthrop
@comment  Putting documentation under CVS
@comment
@comment  Revision 1.66  2000/12/05 14:20:55  peterg
404
405
406
407
408
409
410

411
412
413
414
415
416
417
418
419
420
421


422
423
424
425
426
427
428
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434







+











+
+







Simulation

* Steady-state solutions::      
* Simulation parameters::       
* Simulation input::            
* Simulation logic::            
* Simulation initial state::    
* Simulation code::             
* Simulation output::           

Steady-state solutions 

* Steady-state solutions - numerical(odess)::  
* Steady-state solutions - symbolic (ss)::  

Simulation parameters

* Euler integration::           
* Implicit integration::        
* Runge Kutta IV integration::  
* Hybrd algebraic solver::      

Simulation output

* Viewing results with gnuplot::  
* Exporting results to SciGraphica::  

Representations
654
655
656
657
658
659
660

661
662
663
664
665
666
667
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674







+







* Octave setup::                
* Paths::                       
* File structure::              

Octave setup

* .octaverc::                   
* .oct file dependencies::      

Paths

* $MTTPATH::                    
* $MTT_COMPONENTS::             
* $MTT_CRS::                    
* $MTT_EXAMPLES::               
1159
1160
1161
1162
1163
1164
1165



1166
1167
1168
1169
1170
1171
1172
1173


1174
1175
1176
1177
1178
1179
1180
1181

1182
1183
1184
1185
1186
1187
1188
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192

1193
1194
1195
1196
1197
1198
1199
1200







+
+
+








+
+







-
+








The available options are:
@vtable @code
@item -q
        quiet mode -- suppress MTT banner
@item -A 
        solve algebraic equations symbolically
@item -ae 
        <hybrd> solve algebraic equations numerically
 (this option requires -cc or -oct)
@item -D 
        debug -- leave log files etc
@item -I 
        prints more information
@item -abg 
       start at abg.m representation
@item -c 
        c-code generation
@item -cc
       C++ code generation
@item -d 
        <dir>  use directory <dir>
@item -dc 
       Maximise derivative (not integral) causality
@item -dc 
       Maximise derivative (not integral) causality
@item -i 
       <implicit|euler>   Use implicit or euler integration
       <implicit|euler|rk4>   Use implicit, euler or Runge Kutta IVintegration
@item -o 
       ode is same as dae
@item -oct 
       use oct files in place of m files where appropriate
@item -opt 
       optimise code generation
@item -p 
1200
1201
1202
1203
1204
1205
1206
1207

1208
1209
1210
1211
1212
1213
1214
1212
1213
1214
1215
1216
1217
1218

1219
1220
1221
1222
1223
1224
1225
1226







-
+







@item -sub 
       <subsystem> operate on this subsystem
@item -t 
        tidy mode (default)
@item -u 
        untidy mode (leaves files in current dir)
@item -v 
        verbose mode
        verbose mode (multiple uses increase the verbosity)
@item -viewlevel 
       <N> View N levels of hierachy
@item --version 
       print version and exit
@item --versions 
       print version of mtt and components and exit
@end vtable
1854
1855
1856
1857
1858
1859
1860


1861
1862
1863
1864
1865
1866
1867
1868
1869
1870




1871
1872
1873
1874
1875
1876
1877
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895







+
+










+
+
+
+







representations for the purposes of numerical simulation:
@ftable @code
@item m
        @code{octave} a high-level interactive language for numerical
        computation.
@item c
        @code{gcc} a c compiler.
@item cc
        @code{g++} a C++ front-end to gcc.
@end ftable

There are a number solution algorithms available:
@itemize @bullet
@item
explicit solution via the matrix exponential
@item
backward Euler integration (explicit)
@item
forward Euler integration (implicit)
@item
Runge Kutta IV integration (explicit, fixed step)
@item
Hybrd algebraic solver (MINPACK, Octave fsolve)
@c  @item
@c  LSODE (Hindmarsh's ODE solver as implemented in Octave)
@c  @item
@c  DASSL (Petzold's DAE solver as implemented in Octave) (Unavailable just now)
@end itemize

 However, all combinations of representation, language and solution
1903
1904
1905
1906
1907
1908
1909

1910
1911
1912
1913
1914
1915
1916
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935







+







``simulated''(@pxref{Steady-state solutions}).
@menu
* Steady-state solutions::      
* Simulation parameters::       
* Simulation input::            
* Simulation logic::            
* Simulation initial state::    
* Simulation code::             
* Simulation output::           
@end menu

@node Steady-state solutions, Simulation parameters, Simulation, Simulation
@comment  node-name,  next,  previous,  up
@section Steady-state solutions 
@cindex Steady-state solutions
1985
1986
1987
1988
1989
1990
1991
1992

1993
1994
1995
1996
1997
1998
1999






2000
2001
2002
2003
2004
2005
2006
2007
2008
2009


2010
2011
2012
2013
2014
2015
2016
2004
2005
2006
2007
2008
2009
2010

2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043







-
+







+
+
+
+
+
+










+
+







        Maximum frequency = 10^WMAX
@item WSTEPS
        Number of Frequency steps.
@item INPUT
        The input index for frequency response
@end itemize

There are two integration algorithms
There are a number of solution algorithms
@itemize @bullet
@item Euler
        basic Euler integration (@pxref{Euler integration}). This method
is simple, but not recommended for stiff systems.
@item Implicit
        semi-implicit integration  (@pxref{Implicit integration}) - uses the smx representation to give
        stability.
@item Runge Kutta IV
        fixed step Runge Kutta fourth order integration (@pxref{Runge Kutta IV integration}).
@item Hybrd
        numerical algebraic equation solver
        

@c @item ImplicitS
@c         Sparse semi-implicit integration  (@pxref{Sparse implicit integration})
@c -- takes advantage of the sparsity of the A matrix.
@c @item LSODE
@c         the variable step-size method that comes with Octave (@pxref{Octave}).
@end itemize

@menu
* Euler integration::           
* Implicit integration::        
* Runge Kutta IV integration::  
* Hybrd algebraic solver::      
@end menu

@node Euler integration, Implicit integration, Simulation parameters, Simulation parameters
@comment  node-name,  next,  previous,  up
@subsection Euler integration
@cindex Euler integration
Euler integration approximates the solution of the Ordinary Differential Equation 
2033
2034
2035
2036
2037
2038
2039
2040

2041
2042
2043
2044
2045
2046
2047
2060
2061
2062
2063
2064
2065
2066

2067
2068
2069
2070
2071
2072
2073
2074







-
+







where A is the nxn matrix appearing in
@example
f(x,u) = Ax + Bu
@end example
If the system is non linear, the linearised system matrix A should act
as a guide to the choice of STEPFACTOR.

@node Implicit integration,  , Euler integration, Simulation parameters
@node Implicit integration, Runge Kutta IV integration, Euler integration, Simulation parameters
@comment  node-name,  next,  previous,  up
@subsection Implicit integration
@cindex Implicit integration
Implicit integration approximates the solution of the Ordinary Differential Equation 
@example
dx/dt = f(x,u)
@end example
2070
2071
2072
2073
2074
2075
2076





























































2077
2078
2079
2080
2081
2082
2083
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







given by:
@example
(E(x)-A*DT)x := (E(x)-A*DT)x + f(x,u)DT
@end example
which reduces to the ordinary differential equation case when E(x)=I.

The _smx representation includes the E matrix.

@node Runge Kutta IV integration, Hybrd algebraic solver, Implicit integration, Simulation parameters
@comment  node-name,  next,  previous,  up
@subsection Runge Kutta IV integration
Runge Kutta IV approximates the solution of the Ordinary Differential Equation

@example
dx/dt = f(x,t)
@end example

by

@example
x := x + (DT/6)*(k1 + 2*k2 + 2*k3 + k4)
@end example

where

@example
k1 := f(x,t)
k2 := f(x+(1/2)*k1,t+(1/2)*DT)
k3 := f(x+(1/2)*k2,t+(1/2)*DT)
k4 := f(x+k3,t+DT)
@end example

The @strong{MTT} implementation of Runge-Kutta integration
is a fourth order, fixed-step, explicit integration method.

For some systems of equations, the increased accuracy of using a fourth order
method can allow larger step-lengths to be used than would allowed by the
 lower order Euler integration method.

It should be noted that during the interemediate calculations (k1...k4),
 the input vector @code{u} is not advanced w.r.t. time; the system inputs are
assumed to be constant over the period of the integration step-length.

@node Hybrd algebraic solver,  , Runge Kutta IV integration, Simulation parameters
@comment  node-name,  next,  previous,  up
@subsection Hybrd algebraic solver

The hybrd algebraic solver of @uref{http://www.netlib.org/minpack/hybrd.f,MINPACK},
which is used by Octave in the @code{fsolve} routine, may be used in conjunction
with one of the other integration methods to solve semi-explicit, index 1, differential
algebraic equations; these may be generated in @strong{MTT} models by use of 
@code{unknown} SS Components @pxref{SS component labels}.

This method requires that compiled simulation code is used; either -cc or -oct.
To perform a simulation based on a model @code{sys},

@example
mtt -cc -ae hybrd -i euler sys odeso view
@c XXX: should be daeso view?
@end example

@strong{MTT} will attempt to minimise the residual error at each integration time-step
using the hybrd routine.

This method of simulation is particularly well suited to stiff systems where very fast
dynamics are of little interest. Care must be taken to ensure that an acceptable level
of convergence is achieved by the solver for the system under investigation.
@c XXX: tolerance option

@c @node Sparse implicit integration,  , Implicit integration, Simulation parameters
@c @comment  node-name,  next,  previous,  up
@c @subsection Sparse implicit integration
@c @cindex Sparse implicit integration
@c This is an experimental approach for large (N>50) systems.

2156
2157
2158
2159
2160
2161
2162
2163

2164
2165
2166
2167
2168
2169
2170
2244
2245
2246
2247
2248
2249
2250

2251
2252
2253
2254
2255
2256
2257
2258







-
+







(defined by t) and parameters

For example:
@example
bounce_ground_1_mtt_switch_logic	= bounce_intf_1_mtt3<0;
@end example

@node Simulation initial state, Simulation output, Simulation logic, Simulation
@node Simulation initial state, Simulation code, Simulation logic, Simulation
@comment  node-name,  next,  previous,  up
@section Simulation initial state
@cindex Simulation initial state
This is defined in the system_state.txt file. A default file is created
automatically by @strong{MTT}. This is done explicitly by
@example
mtt system state txt
2193
2194
2195
2196
2197
2198
2199






















2200

2201
2202
2203
2204
2205
2206
2207
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309

2310
2311
2312
2313
2314
2315
2316
2317







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+







@c  @item
@c  The -ss switch is not present: the states default to zero
@c  @item
@c  The -ss switch is present: the states default to those set in the
@c  sspar.r file.
@c  @end itemize

@node Simulation code, Simulation output, Simulation initial state, Simulation
@comment  node-name,  next,  previous,  up
@section Simulation code
simulation code can be generated by @strong{MTT} in the form
of the @code{ode2odes} transformation. This can be produced in a number
of languages, including .m, .oct, C and C++ @pxref{Languages}.

To generate simulation code in C:
@example
mtt -c [options] sys ode2odes c
@end example

Similarly, to generate C++ code:
@example
mtt -cc [options] sys ode2odes cc
@end example

To generate an executable based on the C++ representation:
@example
mtt -cc [options] sys ode2odes exe
@end example

@node Simulation output,  , Simulation initial state, Simulation
@node Simulation output,  , Simulation code, Simulation
@comment  node-name,  next,  previous,  up
@section Simulation output
@cindex Simulation output
The view (@pxref{Views}) representation provides a graphical
representation of the results of a simulation; the postscript language
provides the same thing in a form that can be included in a document.

4351
4352
4353
4354
4355
4356
4357



4358
4359
4360
4361
4362
4363
4364
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477







+
+
+







# Generated by MTT at Mon Jun 16 15:10:17 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.3  2001/07/13 03:02:38  geraint
# %% Added notes on #ICD, gnuplot.txt and odes.sg rep.
# %%
# %% Revision 1.2  2001/07/03 22:59:10  gawthrop
# %% Fixed problems with argument passing for CRs
# %%
# %% Revision 1.1  2001/06/04 08:18:52  gawthrop
# %% Putting documentation under CVS
# %%
# %% Revision 1.66  2000/12/05 14:20:55  peterg
5739
5740
5741
5742
5743
5744
5745
5746
5747

5748
5749
5750
5751

5752
5753
5754

5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
















5770
5771
5772
5773
5774
5775
5776
5852
5853
5854
5855
5856
5857
5858


5859

5860
5861
5862
5863
5864
5865

5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904







-
-
+
-



+


-
+















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








@node Octave setup, Paths, REDUCE setup, Administration
@comment  node-name,  next,  previous,  up
@section Octave setup
@cindex  Octave setup

Octave is available at various web sites including:
@quotation

@uref{http://www.octave.org}
@end quotation

@menu
* .octaverc::                   
* .oct file dependencies::      
@end menu

@node .octaverc,  , Octave setup, Octave setup
@node .octaverc, .oct file dependencies, Octave setup, Octave setup
@comment  node-name,  next,  previous,  up
@subsection .octaverc
@vindex  .octaverc


The @file{.octaverc} file should contain the following lines:
@example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Startup file for Octave for use with MTT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

implicit_str_to_num_ok = 1;
empty_list_elements_ok = 1;

@end example

@node .oct file dependencies,  , .octaverc, Octave setup
@comment  node-name,  next,  previous,  up Additionally, it is necessary to
@subsection .oct file dependencies
Successful compilation of .oct code requires that Octave has been configured
to use dynamically linked libraries and that the Octave library @code{liboctave}
and the Octave modified version of @code{libkpathsea} are available on the
 system.

This can be acheived by compiling Octave from the source code, configured
with the options @code{--enable-shared} and @code{--enable-dl}.

Further information on configuring and installing Octave to handle dynamic
libraries (DLDs) can be found in the
@uref{http://www.octave.org/docs.html,Octave documentation}.


@node Paths, File structure, Octave setup, Administration
@comment  node-name,  next,  previous,  up
@section Paths
@cindex paths
@cindex mttrc


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