[Top] | [Contents] | [Index] | [ ? ] |
It implements two features not discussed in that book:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT is a set of Model Transformation Tools based on bond graphs. MTT implements the theory to be found in the book "Metamodelling: Bond Graphs and Dynamic Systems" by Peter Gawthrop and Lorcan Smith published by Prentice Hall in 1996 (ISBN 0-13-489824-9).
It implements two features not discussed in that book:
In the context of software, it has been said that one good tool is worth many packages. UNIX is a good example of this philosophy: the user can put together applications from a range of ready made tools. This manual describes the application of this philosophy to dynamic system modeling embodied in MTT - a set of Model Transformation Tools each of which implements a single transformation between system representations.
System representations have two attributes.
Transformations in MTT are accomplished using appropriate software (e.g. Octave/Matlab, Reduce) encapsulated in UNIX Bourne shell scripts. The relationships between the tools are encoded in a Make File; thus the user can specify a final representation and all the necessary intermediate transformations are automatically generated.
1.1 What is a representation? | ||
1.2 What is a transformation? | ||
1.3 What is a bond graph? | ||
1.4 Variables | ||
1.5 Bonds | ||
1.6 Components | ||
1.7 Algebraic loops | ||
1.8 Switched systems |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Physical systems have many representations. These include
Each of these representations is related to other representations by an appropriate transformation (see section 1.2 What is a transformation?. In many cases, a modeler is presented with a physical system and needs to make a model. In particular, a model, in this context, is a representation of the system appropriate to a particular use, for example:
Indeed, for a given physical system, the modeler would need to derive a number of models. This process can be viewed as a series of steps; each involving a transformation between representations (see section 1.2 What is a transformation?.
In this context, the following considerations are relevant.
I happen to believe that Bond graphs (see section 1.3 What is a bond graph?) provide the most convenient and powerful basis for the core representation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Each system representation (see section 1.1 What is a representation? is related to other representations by an appropriate transformation as follows:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Bond graphs provide a graphical high-level language for describing dynamic systems in a precise and unambiguous fashion. They make a clear distinction between structure (how components are connected together), and behavior (the particular constitutive relationships, or physical laws, describing each component.
They can describe a range of physical systems including:
More importantly, they can describe systems which contain subsystems drawn from all of these domains in a uniform manner.
Bond graphs are made up of components (see section 1.6 Components) connected by bonds (see section 1.5 Bonds) which define the relationship between variables (see section 1.4 Variables).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Examples of effort variables are
Examples of flow variables are
Examples of integrated flow variables are
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The half-arrow indicates two things:
The causal stroke indicates two things:
The causal half-stoke indicates one thing:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Components provide the building blocks of a dynamic system when connected by bonds (see section 6.4.1.2 Bonds). Components have the following attributes:
ports
constitutive
relationships
1.6.1 Ports | ||
1.6.2 Constitutive relationship | ||
1.6.3 Symbolic parameters | ||
1.6.4 Numeric parameters |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Ports are implemented in MTT using named SS components. (see section 6.4.1.9 Named SS components).
The direction of the named SS components. (see section 6.4.1.9 Named SS components) is coerced (see section 6.4.1.10 Coerced bond direction) to have the same direction as the bons connected to the corresponding port. Thus the direction of the direction of the named SS components has no significance unless the component is at the top level.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The constitutive relationship of a component defines how the port variables are related. This relationship may be linear or non-linear. This typically contains symbolic parameters (see section 1.6.3 Symbolic parameters) which may be replaced, for the purposes of numerical analysis by numeric parameters (see section 1.6.4 Numeric parameters).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
However, MTT allows replacement of symbolic parameters by numeric parameters (see section 1.6.4 Numeric parameters) when appropriate.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In particular if zero junction is undercausal an SS:loop component (with effort output indicated by a causal stroke) with the following label file entry:
loop SS unknown,zero |
For more information, refer to: "Metamodelling: Bond Graphs and Dynamic Systems" by Peter Gawthrop and Lorcan Smith published by Prentice Hall in 1996 (ISBN 0-13-489824-9).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some systems contain switch-like components. For example an electrical system may contain on-off switches and diodes and a hydraulic system may shut-off valves and non-return valves.
Such systems are sometimes called hybrid systems. The modelling an simulation of such systems is the subject of current research. MTT implements a simple pragmatic approach to the modelling and simulation of such systems via two new Bond Graph components:
ISW
I
componentCSW
C
componentThese switches are user controlled through the logic representation (see section 4.4 Simulation logic).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.1 Menu-driven interface | ||
2.2 Command line interface | ||
2.3 Options | ||
2.4 Utilities |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
xmtt |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt [options] <system_name> <representation> <language> |
[options]
<system_name>
<representation>
<language>
mtt rc rep view |
mtt rc sm m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT has a number of optional switches to control its operation. These are invoked immediately after `mtt' on the command line; for example:
mtt -o -ss -cc syst cbg view |
-o
, -ss
, and -cc
options.
If you wish to use an option all the time, use the alias function appropriate to the shell you are using. For example, using bash:
alias mtt='mtt -o -ss -cc' |
mtt syst cbg view |
The available options are:
-q
-A
-ae
-D
-I
-abg
-c
-cc
-d
-dc
-dc
-i
-o
-oct
-opt
-p
-partition
-r
-s
-ss
-stdin
-sub
-t
-u
-v
-viewlevel
--version
--versions
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt help
mtt copy
<system>
mtt rename <old_name>
<new_name>
mtt <system>
clean
mtt clean
mtt system representation
vc
mtt system vc
2.4.1 Help | ||
2.4.2 Copy | ||
2.4.3 Clean | ||
2.4.4 Version control |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt help representations mtt help components mtt help examples mtt help crs mtt help representations <match_string> mtt help components <match_string> mtt help examples <match_string> mtt help crs <match_string> mtt help <component_or_example_or_CR_name> |
2.4.1.1 help representations | ||
2.4.1.2 help components | ||
2.4.1.3 help examples | ||
2.4.1.4 help crs | ||
2.4.1.5 help <name> |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command
mtt help representations |
The command
mtt help representations <match_string> |
match_string
. This string can be any regular expression (see
standard Linux documentation under awk
). For example
mtt help representations descriptor |
descriptor
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command
mtt help components |
The command
mtt help components <match_string> |
match_string
. This string can be any regular expression (see
standard Linux documentation under awk
). For example
mtt help components source |
component
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This command provides a good way to get started in MTT. having found an interesting example, copy it to your working directory using
mtt copy <example_name> |
mtt help examples |
The command
mtt help examples <match_string> |
match_string
. This string can be any regular expression (see
standard Linux documentation under awk
). For example
mtt help examples pharmokinetic |
pharmokinetic
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command
mtt help crs |
The command
mtt help crs <match_string> |
match_string
. This string can be any regular expression (see
standard Linux documentation under awk
). For example
mtt help crs sin |
sin
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command
mtt help <name> |
name
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT provides a way of copying examples to your working directory:
mtt copy <example_name> |
Use the command
mtt help examples |
Note that components and constitutive relationships are automatically copied when required.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt system clean
mtt clean
The files which remain after such a clean are the Defining representations (see section 6.2 Defining representations).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you are working on a modeling project, it is easy to forget what changes you made to a system and why you made them. Sometimes, you may regret some changes and wish to revert to an earlier version: even if you use .old files this may be difficult to achieve safely.
These are very similar problems to those faced by software developers and can be solved in the same way: using version control.MTT provides version control using the standard GNU Revision Control System (RCS). This is hidden from the user, but is fully complementary to direct use of RCS (e.g. via emacs vc commands) to the more experienced user who wishes to do so.
The only files that you should ever change (i.e. the ones never overwritten by MTT) are the Defining representations (see section 6.2 Defining representations).
All of the files, with the exception of system_abg.fig
, are
initially created by MTT and contain the RCS header for
version control.
The MTT version control will automatically expand this part of the text to include all change comments that you give it -- so will direct use of RCS (e.g. via emacs vc commands)
The MTT version commands are as follows:
mtt system representation
vc
mtt system vc
The first is appropriate after you have made a revision to a single file. It will prompt you for a change comment; this will be automatically included in the file header. In addition, enough information will be saved to enable any version to be retrieved via RCS.
The second is appropriate to record the state of the entire model. This assumes that all relevant files have been recorded by the first version of the command. Once again, old versions of the entire model can be retrieved using the relevant RCS commands.
A subdirectory `RCS' is created to hold this information. You need not bother about the contents, except that you must not delete any files within `RCS'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT helps you to analyse and transform system models -- ultimately the process of capturing the real world in a model is up to you. This chapter discusses the MTT aspects of creating a model. For convenience, this is divided into creating simple models and creating complex models.
3.1 Quick start | ||
3.2 Creating simple models | ||
3.3 Creating complex models |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is probably worth a quick skim though MTT to get a flavour of what it can do before plunging into the detail of the rest of this document. Here is a series of commands to do this.
Copy an initial set of files describing the bond graph.
mtt copy rc |
cd rc |
mtt rc abg view |
mtt rc cbg view |
mtt rc ode view |
mtt rc sro view |
An alternative (but more general) way of achieving the same result is
mtt -c rc odeso view |
View the system transfer function
mtt rc tf view |
mtt rc lmfr view |
View the log modulus frequency response of the system for 100 logarithmically spaced frequencies in the range 0.1 to 10 radians per second.
mtt rc lmfr view 'W=logspace(-1,1,100);' |
MTT has a report generation ((see section 6.16 Report (rep)) facility which can generate a hypertext description of the system.
mtt rc rep hview |
The report contents are specified by the rep representation (see section 6.16 Report (rep)), in this case the corresponding file is:
% %% Outline report file for system rc (rc_rep.txt) mtt rc abg tex mtt rc struc tex mtt rc cbg ps mtt rc ode tex mtt rc ode dvi mtt rc sm tex mtt rc tf tex mtt rc tf dvi mtt rc sro ps mtt rc lmfr ps mtt rc odes h mtt rc numpar txt mtt rc input txt mtt -c rc odeso ps mtt rc rep txt |
mtt rc rep view |
Now have a go at modifying the bond graph.
mtt rc abg fig |
More examples can be found using
mtt help examples |
mtt help <example_name> |
mtt copy <example_name> |
Lots of examples are available.
mtt help examples |
mtt copy <name> |
A number of examples are to be found <A HREF="http://www.mech.gla.ac.uk/~peterg/software/MTT/examples/Examples/Examples.html"> here</A>.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For then purposes of this section, simple models are those which are built up from bond graphs involving predefined components. In contrast, more complex systems (see section 3.3 Creating complex models) need to be built up hierarchically.
The recommended sequence of steps to create a simple model is:
mtt syst abg fig |
SS
components. (see section 6.4.1.6 SS components). Save the bond graph.
mtt syst cbg view |
mtt syst dae view |
mtt syst sm view |
mtt syst tf view |
mtt syst sro view |
mtt syst odeso view |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Complex models -- in distinction to simple models (see section 3.2 Creating simple models) -- have a hierarchical structure. In particular, bond graph components can be created by specifying their bond graph. Typically, such components will have more than one port (see section 1.6.1 Ports); within each component, ports are represented by named SS components (see section 6.4.1.9 Named SS components); outwith each component, ports are unambiguously identified by labels (see section 6.4.1.11 Port labels) and vector labels (see section 6.4.1.12 Vector port labels).
Complex models are thus created by conceptually decomposing the system into simple subsystems, and then creating the corresponding bond graphs. The procedure for simple systems (see section 3.2 Creating simple models) is then followed using the top level system (see section 3.3.1 Top level); MTT then recursively operates on the lower level systems.
The report representation (see section 6.16 Report (rep)) provides a convenient way of viewing a complex system.
An example of such a system can be created as follows:
mtt copy twolink mtt twolink rep hview |
The result is <A HREF="./examples/twolink/twolink_rep/twolink_rep.html"> here</A>.
3.3.1 Top level |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Simulation is typically performed using an appropriate simulation language (which is often inappropriately conflated with modelling tools). MTT provides a number of alternative routes to simulation based on the following representations (see section 6. Representations):
cse
ode
Special cases of numerical simulation, appropriate to linear systems, are:
ir
iro
sr
sro
There are a number of languages (see section 9. Languages) which can be used to describe these representations for the purposes of numerical simulation:
m
octave
a high-level
interactive language for numerical computation.c
gcc
a c compiler.cc
g++
a C++ front-end to
gcc.There are a number solution algorithms available:
However, all combinations of representation, language and solution method are not supported by MTT at the moment. Given a system `system', some recommended commands are:
mtt system iro
view
mtt system sro
view
mtt -c system odeso
view
mtt -c -i euler system odeso
view
Simulation parameters are described in the system_simpar.txt file (see section 4.2 Simulation parameters).
The steady-state solution of a system can also be "simulated"(see section 4.1 Steady-state solutions).
4.1 Steady-state solutions | ||
4.2 Simulation parameters | ||
4.3 Simulation input | ||
4.4 Simulation logic | ||
4.5 Simulation initial state | ||
4.6 Simulation code | ||
4.7 Simulation output |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.1.1 Steady-state solutions (odess) | ||
4.1.2 Steady-state solutions (ss) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT can compute the steady-state solutions of an ordinary differential equation; this used the octave function `fsolve'. The solution is computed as a function of time using the input specified in the input file. The simulation parameter file (see section 4.2 Simulation parameters) is used to provide the time scales.
For example
mtt copy rc cd rc mtt rc odess view |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt system ss view |
For example
mtt copy rc cd rc mtt rc sspar view mtt rc ss view |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Simulation parameters are set in the system_simpar.txt file. At the moment this sets the following variables:
There are a number of solution algorithms
4.2.1 Euler integration | ||
4.2.2 Implicit integration | ||
4.2.3 Runge Kutta IV integration | ||
4.2.4 Hybrd algebraic solver |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dx/dt = f(x,u) |
x := x + f(x,u)*DDT |
DDT = DT/STEPFACTOR |
(maximum eigenvalue of -A)*DT/2 |
f(x,u) = Ax + Bu |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dx/dt = f(x,u) |
(I-A*DT)x := (I-A*DT)x + f(x,u)DT |
If the system is linear, stability is ensured unconditionaly. If the system is non-linear, then the method still works well.
This method is nice in that choice of DT trades of accuracy against computation time without compromising stability. In addition, the correct stready-state values are achieved.
This approach can also be used for constrained state equations of the form:
E(x) dx/dt = f(x,u) |
(E(x)-A*DT)x := (E(x)-A*DT)x + f(x,u)DT |
The _smx representation includes the E matrix.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dx/dt = f(x,t) |
by
x := x + (DT/6)*(k1 + 2*k2 + 2*k3 + k4) |
where
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) |
The 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 u
is not advanced w.r.t. time; the system
inputs are assumed to be constant over the period of the integration
step-length.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The hybrd algebraic solver of MINPACK, which is used by
Octave in the 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
MTT models by use of unknown
SS Components
see section 6.6.1 SS component labels.
This method requires that compiled simulation code is used; either -cc
or -oct. To perform a simulation based on a model sys
,
mtt -cc -ae hybrd -i euler sys odeso view |
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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt system input txt |
Inputs are defined by the full system name appearing in the structure file (see section 6.7 Structure (struc)). They can depend on states (again defined by name), time (defined by t) and parameters
For example:
system_pump_l_1_u = 4e5*atm; system_pump_r_1_u = 4e5*(t<10)*atm; system_ss_i = 0*kg; system_ss_o = 3e-3*kg; system_v_1_u = (t>10); system_v_ll_1_u = 1; system_v_lr_1_u = (t<10); system_v_ul_1_u = 0; system_v_ur_1_u = (t>10); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt system logic txt |
Logical inputs are defined by the full system name corresponding to MTT_switch components appearing in the structure file (see section 6.7 Structure (struc)) with `_logic' appended. They can depend on states (again defined by name), time (defined by t) and parameters
For example:
bounce_ground_1_mtt_switch_logic = bounce_intf_1_mtt3<0; |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt system state txt |
States are defined by the full system name appearing in the structure file (see section 6.7 Structure (struc)). They can depend on parameters. For example
system_c_l = (1e4/k_l)/kg; system_c_ll = (1e4/k_s)/kg; system_c_lr = (1e4/k_s)/kg; system_c_u = (1e4/k_l)/kg; |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ode2odes
transformation. This can be produced in a number of
languages, including .m, .oct, C and C++ see section 9. Languages.
To generate simulation code in C:
mtt -c [options] sys ode2odes c |
Similarly, to generate C++ code:
mtt -cc [options] sys ode2odes cc |
To generate an executable based on the C++ representation:
mtt -cc [options] sys ode2odes exe |
4.6.1 Dynamically linked functions |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some model representations can be compiled into dynamically loaded code (shared objects) which are compiled prior to use in other modelling and simulation environments; in particular, .oct files can be generated for use in GNU Octave (see section 10.4.2 Creating GNU Octave .oct files) and .mex files can be generated for use in Matlab (see section 10.4.3 Creating Matlab .mex files) or Simulink (see section 10.4.4 Embedding MTT models in Simulink). The use of compiled (and possibly compiler-optimised) code can offer significant processing speed advantages over equivalent interpreted functions (e.g. .m files) for computationally intensive procedures.
The C++ code generated by MTT allows the same code to be generated as standalone code, Octave .oct files or Matlab .mexglx files. Although MTT usually takes care of the compilation options, if it is necessary to compile the code on a machine on which MTT is not installed, the appropriate flag should be passed to the compiler pre-processor:
-DCODEGENTARGET=STANDALONE
-DCODEGENTARGET=OCTAVEDLD
-DCODEGENTARGET=MATLABMEX
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These are two simulation output representations
odes
odeso
Particular output variables can be selected by adding a fourth argument in one of 2 forms
'name1;name2;..;namen'
'name1:name2'
An example of plotting a single variable against time is:
mtt -o -c -ss OttoCycle odeso ps 'OttoCycle_cycle_V' |
mtt -o -c -ss OttoCycle odeso ps 'OttoCycle_cycle_V:OttoCycle_cycle_P' |
4.7.1 Viewing results with gnuplot | ||
4.7.2 Exporting results to SciGraphica |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Simulation plots may be conveniently selected, viewed with gnuplot and saved to file (in PostScript format) using the command
mtt [options] rc gnuplot view |
This will cause a menu to be displayed, from which states and outputs may be selected for viewing. Clicking on a parameter name will, by default, cause the time history of the selected parameter to be displayed.
As with xMTT (see section 2.1 Menu-driven interface), the Wish Tcl/Tk interpreter must be installed to make use of this feature.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Simulation results can be converted into an XML-format SciGraphica (version 0.61) .sg file with the command
mtt [options] sys odes sg |
The SciGraphica file will contain two worksheets, X_sys and Y_sys, containing the state and output time-histories from the simulation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The sensitivity model of a system is a set of equations giving the sensitivity of the system outputs with respect to system parameters. MTT has built in methods for assisting with the development of such models.
This feature is experimental at the moment, but the following example gives an idea of what can be achieved.
mtt copy rc cd rc mtt -s src ode view mtt -s src odeso view |
An alternative route is to create the sensitivity functions by symbolic differentiation. The following sensitivity representations are available:
scse
sm
scsm
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As discussed in 1.1 What is a representation?, a system has many representations. The purpose of MTT is to provide an easy way to generate such representation by applying the appropriate sequence of transformations. The representations supported by MTT are summarised in 6.1 Representation summary.
There is a two-fold division of representations into those with which the user defines the system and its various attributes, and those which are derived from these. The defining representations are listed in 6.2 Defining representations.
Each representation is implemented in one or more languages depending on its use. These languages are discussed in 9. Languages and are associated with appropriate tools for modifying or viewing the representations.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some of the the representations available in MTT are (in alphabetical order):
abg
cbg
cr
cse
csm
dae
daes
daeso
def
desc
dm
ese
fr
input
ir
iro
lbl
lmfr
lpfr
nifr
numpar
nyfr
obs
ode
odes
odes
odeso
odess
odesso
rbg
rep
rfe
sabg
simp
sm
smx
sms
smss
sr
sro
ss
sspar
struc
sub
sub
sympar
tf
help representations
command (see section 2.4.1.1 help
representations).
Many of these representations have more than one language (see section 6. Representations) associated with them.
Some of these representations define the system (see section 6.2 Defining representations).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following representations define the system and therefore must, ultimately, be defined by the user. However, all of these are assigned default values by MTT and may then be subsequently edited (see section 10.3 Text editors) viewed or operated on by the appropriate tools (see section 10. Language tools).
system_abg.fig
system_lbl.txt
system_desc.tex
system_simp.r
system_subs.r
system_simpar.txt
system_numpar.txt
system_input.txt
system_logic.txt
system_sspar.r
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Systems can be documented in LaTeX using the _desc.tex file. This file is included in the report (see section 6.16 Report (rep)) if the abg tex option is included in the rep.txt file. As usual, MTT provides a default text file to be edited by the user (see section 10.3 Text editors).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The acausal bond graph is the main input to MTT. It is up to you, as a system modeler, to distill the essential aspects of the system that you wish to model and capture this information in the form of a bond graph.
The inexperienced modeler may wish to look in one of the standard textbooks and copy some bond graphs of systems to get going.
To create the acausal bond graph of system `sys' in language fig type:
mtt sys abg fig |
mtt sys abg m |
mtt sys abg view |
6.4.1 Language fig (abg.fig) | ||
6.4.2 Language m (rbg.m) | ||
6.4.3 Language m (abg.m) | ||
6.4.4 Language tex (abg.tex) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A bond graph is made up of:
bonds
strokes
components
artwork
An icon library of bonds, components and other symbols is available within xfig (see section 6.4.1.1 Icon library).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Click onto the library icon Click onto the library pull-down menu and select BondGraph Select iconic symbols from the presented list |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Bonds are represented by polylines with two segments. They must be the default style (i.e. plain not dashed or dotted). The shortest segment is taken to be the half-arrow. its positioning is significant because:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Causal strokes are represented by single-segment polylines. There are two sorts of strokes:
MTT is reasonably forgiving; but a neat diagram will be less ambiguous to you as well as to MTT.
Causality is indicated as follows:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Components are represented by a text string in fig. The recommended style is: 20pt, Times-Roman and centre justified.
The component text string can be of the following forms:
type
R |
type:label
R:r |
type:label:cr
R:r:flow,r |
type:label:expression
R:r:mtt_e=r*mtt_f R:r:mtt_e-r*mtt_f=0 R:r:mtt_f=mtt_e/r |
R:r:mtt_e = sin(mtt_f) |
type*n
MySystem*25 |
type:label*n
MySystem:MyLabel*25 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following simple components are defined in MTT.
R
C
I
SS
TF
GY
AE
AF
CSW
ISW
6.4.1.6 SS components | ||
6.4.1.7 Simple components - implementation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SS
components provide input and output variables for a
system; Named SS components (see section 6.4.1.9
Named SS components) provide this for subsystems.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Each simple component, with name NAME, is defined by two m files:
NAME_cause.m
NAME_eqn.m
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Like any other system, they are described by a graphical Bond Graph description (see section 6.4.1 Language fig (abg.fig)), and a label file (see section 6.6 Labels (lbl)).
By convention, all of the files describing a component live in a directory with the same name as the component.
6.4.1.9 Named SS components |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Named SS components provide the link from the system which
defines compound component to the system which uses a
compound component see section 6.4.1.8 Compound
components. A named SS components is of the form
SS:[name]
;
Where `name' is a name consisting of alphanumeric characters and underscore; for example:
SS:[Mechanical_1] |
If a named SS component exists at the top level (see section 3.3.1 Top level) and is treated as an ordinary SS component with the given direction and with the attributes specified in the label file (see section 6.6 Labels (lbl)).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
0
and 1
)
components. For this reason, MTT provides a method for
unambiguously identifying the ports of a multi-port component by port
labels.
A port label is indicated by a name within parentheses of the form
[name]
, where `name' is a name consisting of alphanumeric
characters and underscore; for example:
[Mechanical_1] |
The following rules must be be obeyed:
Port labels may be grouped into vector port labels (see section 6.4.1.12 Vector port labels). Components with compatible (ie containing the same number of ports) vector ports may be connected by a single bond (see section 1.5 Bonds); such a bond implies the corresponding number of bonds (one for each element of the vector port label). All such bonds inherit the same direction and any explicit causal strokes (see section 6.4.1.3 Strokes)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[name1,name2,name3]
.
[Mechanical_1,Electrical,Hydraulic_5] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These defaults may, in turn be aliases (see section 6.6.9 Aliases) for port labels (see section 6.4.1.11 Port labels) or vector port labels (see section 6.4.1.12 Vector port labels). Combining the default and alias mechanism is a powerful tool for creating uncluttered, yet complex, bond graph models.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
0
junctions, 1
junctions, SS
components and
SS
port components.
In each case, the presence of a vector component is indicated by a single port label (see section 6.4.1.11 Port labels) of one of two forms:
Within the corresponding label file (see section 6.6 Labels (lbl)), the components of a vector port can be accessed using _i where i is the corresponding index. Thus a port SS:[Electrical] appearing near the port label [1,2,3] could contain the port alias (see section 6.6.9.1 Port aliases)
%ALIAS in Electrical_1,Electrical_2,Electrical_3 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You may add any Fig (see section 9.1 Fig) object to the bond graph as long as it will not be interpreted as part of the bond graph. The reccommended way to acheive this is to put the Bond Graph at depth 0,10,20 etc (ie depth modulo 10 is zero) and artwork at any other depth.
For compatibility with earlier versions of MTT, the following objects are ignored even at level 0. However, their use is strongly discouraged.
"
, '
, !
etc.The stripped abg file (sabg) (see section 6.5 Stripped acausal bond graph (sabg)) shows only those parts of the diagram recognised by MTT and is therefore useful for distinguishing artwork.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following names should be avoided
if endif |
The following reserved words in reduce should also be avoided (with any case)
Commands ALGEBRAIC ANTISYMMETRIC ARRAY BYE CLEAR CLEARRULES COMMENT CONT DECOMPOSE DEFINE DEPEND DISPLAY ED EDITDEF END EVEN FACTOR FOR FORALL FOREACH GO GOTO IF IN INDEX INFIX INPUT INTEGER KORDER LET LINEAR LISP LISTARGP LOAD LOAD PACKAGE MASS MATCH MATRIX MSHELL NODEPEND NONCOM NONZERO NOSPUR ODD OFF ON OPERATOR ORDER OUT PAUSE PRECEDENCE PRINT PRECISION PROCEDURE QUIT REAL REMFAC REMIND RETRY RETURN SAVEAS SCALAR SETMOD SHARE SHOWTIME SHUT SPUR SYMBOLIC SYMMETRIC VECDIM VECTOR WEIGHT WRITE WTLEVEL Boolean Operators EVENP FIXP FREEOF NUMBERP ORDP PRIMEP Infix Operators := = >= > <= < => + * / ^ ** . WHERE SETQ OR AND MEMBER MEMQ EQUAL NEQ EQ GEQ GREATERP LEQ LESSP PLUS DIFFERENCE MINUS TIMES QUOTIENT EXPT CONS Numerical Operators ABS ACOS ACOSH ACOT ACOTH ACSC ACSCH ASEC ASECH ASIN ASINH ATAN ATANH ATAN2 COS COSH COT COTH CSC CSCH EXP FACTORIAL FIX FLOOR HYPOT LN LOG LOGB LOG10 NEXTPRIME ROUND SEC SECH SIN SINH SQRT TAN TANH Prefix Operators APPEND ARGLENGTH CEILING COEFF COEFFN COFACTOR CONJ DEG DEN DET DF DILOG EI EPS ERF FACTORIZE FIRST GCD G IMPART INT INTERPOL LCM LCOF LENGTH LHS LINELENGTH LTERM MAINVAR MAT MATEIGEN MAX MIN MKID NULLSPACE NUM PART PF PRECISION RANDOM RANDOM NEW SEED RANK REDERR REDUCT REMAINDER REPART REST RESULTANT REVERSE RHS SECOND SET SHOWRULES SIGN SOLVE STRUCTR SUB SUM THIRD TP TRACE VARNAME Reserved Variables CARD NO E EVAL MODE FORT WIDTH HIGH POW I INFINITY K!* LOW POW NIL PI ROOT MULTIPLICITY T Switches ADJPREC ALGINT ALLBRANCH ALLFAC BFSPACE COMBINEEXPT COMBINELOGS COMP COMPLEX CRAMER CREF DEFN DEMO DIV ECHO ERRCONT EVALLHSEQP EXP EXPANDLOGS EZGCD FACTOR FORT FULLROOTS GCD IFACTOR INT INTSTR LCM LIST LISTARGS MCD MODULAR MSG MULTIPLICITIES NAT NERO NOSPLIT OUTPUT PERIOD PRECISE PRET PRI RAT RATARG RATIONAL RATIONALIZE RATPRI REVPRI RLISP88 ROUNDALL ROUNDBF ROUNDED SAVESTRUCTR SOLVESINGULAR TIME TRA TRFAC TRIGFORM TRINT Other Reserved Ids BEGIN DO EXPR FEXPR INPUT LAMBDA LISP MACRO PRODUCT REPEAT SMACRO SUM UNTIL WHEN WHILE WS |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function [rbonds, rstrokes,rcomponents,rports,n_ports] = sys_rbg |
The five outputs of this function are:
rbonds is a matrix with
rstrokes is a matrix with (see section 6.4.1.3 Strokes)
rcomponents is a matrix with (see section 6.4.1.4 Components)
rports is a matrix with (see section 6.4.1.11 Port labels)
n_ports is the number of ports associated with the system -- i.e. the number of Named SS components (see section 6.4.1.9 Named SS components).
6.4.2.1 Transformation abg2rbg_fig2m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation takes the acausal bond graph as a fig file (see section 6.4.1 Language fig (abg.fig)) and transforms it into a raw bond graph in m-file format (see section 6.4.2 Language m (rbg.m)).
This transformation is implemented in GNU awk (gawk). It scans both the fig file (see section 6.4.1 Language fig (abg.fig)) and the label file (see section 6.6 Labels (lbl)) and generates the rbg (see section 6.4.2 Language m (rbg.m)) with components sorted according to the label file. It also generates a file sys_fig.fig containing details of the bond graph with the components removed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The acausal bond graph of system `sys' is represented as an m file with heading:
function [bonds,components,n_ports] = sys_abg |
bonds is a matrix with
components is a matrix with
n_ports is the number of ports associated with the system -- i.e. the number of Named SS components (see section 6.4.1.9 Named SS components).
6.4.3.1 Arrow-orientated causality | ||
6.4.3.2 Component-orientated causality | ||
6.4.3.3 Transformation rbg2abg_m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The arrow-orientated causality convention assigns -1, 0 or 1 to both the effort and flow (see section 1.4 Variables) sides of a bond to represent the causal stroke (see section 6.4.1.3 Strokes) as follows:
0
1
-1
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The component-orientated causality convention assigns -1, 0 or 1 to both the effort and flow (see section 1.4 Variables) sides of a bond to represent the causal stroke (see section 6.4.1.3 Strokes) as follows:
0
1
-1
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For the purpose of producing a report (see section 6.16 Report (rep)), MTT generates a LaTeX (see section 10.5 LaTeX) file describing the bond graph and its subsystems. Additional information may be supplied using the description representation (see section 8.2.2 Detailed on-line documentation).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.5.1 Language fig (sabg.fig) | ||
6.5.2 Stripped acausal bond graph (view) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt syst sabg fig |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The label file contains the following non-blank lines (blank lines are ignored)
Note, for compatability with old versions, % may be used in place of #; but the use of % is deprecated. Each lable contains three fields (in the following order) separated by white space and on one line:
Not each component see section 6.4.1.4 Components needs a label, only those which are explicitly labeled on the Bond Graph see section 6.4 Acausal bond graph (abg). MTT checks whether all components labelled on the bond graph have labels and vice versa.
If no lbl file exists, MTT will create a valid one for you; including a default set of arguments and crs for both simplae and compound components.
If wish to create one to edit yourself, type
mtt system_name lbl txt |
%% Label file for system RC (RC_lbl.txt) %SUMMARY RC %DESCRIPTION <Detailed description here> % Port aliases %ALIAS in in %ALIAS out out % Argument aliases %ALIAS $1 c %ALIAS $2 r %% Each line should be of one of the following forms: % a comment (ie starting with %) % component-name cr_name arg1,arg2,..argn % blank % ---- Component labels ---- % Component type C c lin effort,c % Component type R r lin flow,r % Component type SS [in] SS external,external [out] SS external,external |
The old-style lbl files (see section 6.6.11 Old-style labels (lbl)) are NO LONGER supported -- you are encouraged to convert them ASAP.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These two information fields correspond to the effort and flow variables of the of the SS components as follows
info_field_1
info_field_2
external
internal
a number
a symbol
unknown
zero
Some examples are:
%% ss1 is both a source and sensor ss1 SS external,external %% ss1 acts as a flow sensor - it imposes zero effort. ss2 SS 0,external |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to the label there are two information fields, see section 6.6 Labels (lbl). They correspond to the constitutive relationship (see see section 1.6.2 Constitutive relationship and arguments of the component as follows
info_field_1
info_field_2
Some examples are:
%Armature resistance r_a lin effort,r_a %Gearbox ratio n lin effort,n |
MTT supports parameter-passing to (see section 6.6.10 Parameter passing) subsystems.
6.6.3 Component names | ||
6.6.4 Component constitutive relationship | ||
6.6.5 Component arguments | ||
6.6.9 Aliases | ||
6.6.10 Parameter passing | ||
6.6.11 Old-style labels (lbl) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is sometimes useful to use parameters (in addition to those implied by the Component arguments see section 6.6.5 Component arguments) to compute values in, for example the numpar file. These can be declared in the label file; for examples , the two parameters par1 and par 2 can be declared as:
#PAR par1 #PAR par2 |
On the other hand, some CR arguments (eg foo and bar) may not correspond to parameters. These can be excluded from the sympar list using the NOTPAR declaration
#NOTPAR foo #NOTPAR bar |
For comapability with old code, VAR may be used in place of PAR, but this usage is deprecated.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#UNITS Port_name domain effort_units flow_units |
electrical
translational
rotational
fluid
thermal
Allowed units are those defined in the units package.
MTT checks that units are
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#ICD PressureSensor PUMP1_PRESSURE_SENSOR,Pa;null,none #ICD Electrical PUMP1_VOLTAGE,volt;PUMP1_CURRENT,amp % Component type De PressureSensor SS external % Component type SS Electrical SS external,external |
The ICD directive consists of 3 whitespace delimited fields:
If no parameter name is required, a value of "null" should be used. If the parameter does not have any units, a value of "none" should be used.
ICD parameters may be aliased see section 6.6.9 Aliases in the same way as normal parameters, thus it is possible to define some or all of the ICD in higher level components.
The command
mtt sys ICD txt |
will generate a text file containing a list of mappings:
## Interface Control Definition for System sys ## sys_ICD.txt: Generated by MTT Thu Jul 12 21:21:21 CDT 2001 Input: PUMP1_VOLTAGE sys_P1_1_Electrical Causality: Effort Units: volt Output: PUMP1_CURRENT sys_P1_1_Electrical Causality: Flow Units: amp Output: PUMP1_PRESSURE_SENSOR sys_P1_1_PressureSensor Causality: Effort Units: Pa |
A set of assignments can be generated with the command
mtt sys ICD m |
resulting in:
# Interface Control Definition mappings for system sys # sys_ICD.m: Generated by MTT Thu Jul 12 21:26:56 CDT 2001 # Inputs mttu(1) = PUMP1_VOLTAGE; # Outputs PUMP1_CURRENT = mtty(1); PUMP1_PRESSURE_SENSOR = mtty(2); |
A similar file will be generated by the command
mtt sys ICD cc |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Aliases provide a convenient mechanism for relabelling words appearing in the label file (see section 6.6 Labels (lbl)). There are three contexts in which the alias mechanism is used:
All three mechanisms use the same form of statement within the label file
%ALIAS short_label real_label |
MTT distinguishes between the three forms as follows:
6.6.9.1 Port aliases | ||
6.6.9.2 Parameter aliases | ||
6.6.9.3 CR aliases | ||
6.6.9.4 Component aliases |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
%ALIAS short_label real_label |
When the component is used within another component, the short_lable may be used in place of the real_label. More than one alias per label can be used, for example
%ALIAS short_label_1 real_label %ALIAS short_label_2 real_label %ALIAS short_label_3 real_label |
The port can then be refered to in four ways: as real_label, short_label_1, short_label_2 or short_label_3. An alternative notation for the ALIAS statement in this case is
%ALIAS short_label_1|short_label_2|short_label_3 real_label |
The alias feature is particularly powerful in conjunction with vector port labels (see section 6.4.1.12 Vector port labels) and the port label default (see section 6.4.1.13 Port label defaults) mechanisms. For example, a component with 5 ports appearing in the lbl file as:
[Hydraulic_in] external external [Hydraulic_out] external external [Power_Shaft] external external [Thermal_in] external external [Thermal_out] external external |
together with the following statements in the label file:
%ALIAS in Thermal_in,Hyydraulic_in %ALIAS out Thermal_out,Hydraulic_out %ALIAS shaft|power Power_Shaft |
can appear in the bond graph containing that component with one bond labeled either [shaft] or [power] or [Power_Shaft], one unlabeled vector bond pointing in and one unlabeled vector bond pointing out.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Parameter aliases are of the form
%ALIAS $n actual parameter |
%ALIAS $1 c_v %ALIAS $2 density,ideal_gas,r %ALIAS $3 alpha %ALIAS $4 flow,k_p |
Assigns four symbolic parameters to the corresponding strings These four
parameters ($1
--$4
) can then be used for
parameter passing(see section 6.6.10 Parameter
passing).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CR aliases are of the form
%ALIAS $an actual parameter |
%ALIAS $a1 lin |
$1
can then be used for passing a diofferent cr to the
component (see section 6.6.10 Parameter
passing).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Component aliases are of the form
%ALIAS Component_name Component_location |
An example appears in the following label file fragment
... %ALIAS wPipe CompressibleFlow/wPipe %ALIAS Poly CompressibleFlow/Poly .... |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
$1
,
$2
etc. Although this can be done directly, it is recommended
that this is done via the alias mechanism (see section 6.6.9.2 Parameter aliases).
In a subsystem $i
, is replaced by the ith field of a colon
;
separated field in the calling label file. This field may
include commas ,
and the four arithmetic operators
+
, -
, *
and /
.
For example, consider the following example label file fragment (associated with a component called Pump:
... %ALIAS $1 c_v %ALIAS $2 density,ideal_gas,r %ALIAS $3 alpha %ALIAS $4 flow,k_p %ALIAS wPipe CompressibleFlow/wPipe %ALIAS Poly CompressibleFlow/Poly % Component type wPipe pipe none c_v;density,ideal_gas,r % Component type Poly poly Poly alpha |
The 4 parameters $1
, $2
, $3
, and
$4
can be passed from a higher level component as in the
following label file fragment:
% Component type Pump comp none c_v;rho,ideal_gas,r;alpha;effort,k_c turb none c_v;rho,ideal_gas,r;alpha;effort,k_t |
Thus in component `comp':
$1
is replaced by c_v$2
is replaced by rho,ideal_gas$3
is replaced by alpha$4
is replaced by effort,k_c$4
is replaced by effort,k_t[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Old syle labels (mtt version 2.x) are supported by mtt version 3.x. However, you are advised to use the new form (see section 6.6 Labels (lbl)).
Each line of the _label.txt
file is of one of three
forms:
label field_1 field_2 |
The role of the two information fields depends on the component with the corresponding label. In particular the classes of components are:
6.6.11.1 SS component labels (old-style) | ||
6.6.11.2 Other component labels (old-style) | ||
6.6.11.3 Parameter passing (old-style) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
info_field_1
info_field_2
internal
a number
a symbol
unknown
zero
Some examples are:
%Label field1 field2 ss1 external external ss2 0 external |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to the label there are two information fields, see section 6.6 Labels (lbl). They correspond to the constitutive relationship (see see section 1.6.2 Constitutive relationship and arguments of the component as follows
info_field_1
info_field_2
Some examples are:
%Armature resistance r_a lin effort,r_a %Gearbox ratio n lin effort,n |
MTT supports parameter-passing to (see section 6.6.11.3 Parameter passing (old-style)) subsystems.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
$1
,
$2
, etc.
In a subsystem $i
, is replaced by the ith field of a colon
;
separated field in the calling label file. This field may
include commas ,
.
For example subsystem ROD contains the following lines in the label file:
%DESCRIPTION Parameter 1: length from end 1 to mass centre %DESCRIPTION Parameter 2: length from end 2 to mass centre %DESCRIPTION Parameter 3: inertia about mass centre %DESCRIPTION Parameter 4: mass %DESCRIPTION See Section 10.2 of "Metamodelling" %Inertias J lin flow,$3 m_x lin flow,$4 m_y lin flow,$4 %Integrate angular velocity to get angle th %Modulated transformers s1 lsin flow,$1 s2 lsin flow,$2 c1 lcos flow,$1 c2 lcos flow,$2 |
This can be used in a higher-level lbl (see section 6.6 Labels (lbl)) file as:
%SUMMARY Pendulum example from Section 10.3 of "Metamodelling" %Rod parameters rod none l;l;j;m |
6.6.12 Language tex (desc.tex) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The causal bond graph implies a set of equations describing the system. The Structure (struc) representation describes the structure of these equations in terms of the input, outputs, states and non-states of the system.
6.7.1 Language txt (struc.txt) | ||
6.7.2 Language tex (struc.tex) | ||
6.7.3 Language tex (view) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
type
system name
repetition
An example of such a file (corresponding to rc) (see section 3.1 Quick start) is:
input 1 e1 rc 1 output 1 e2 rc 1 state 1 c rc 1 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
longtable
format. It is a useful item to include in a report(see section 6.16 Report (rep)).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The constitutive relationship (see section 1.6.2 Constitutive relationship) of a simple component (see section 6.4.1.5 Simple components is defined in the symbolic algebra language Reduce (see section 9.3 Reduce). The constitutive relationship of a compound components (see section 6.4.1.8 Compound components) is implied by the constitutive relationships of its constituent components.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some common cr's are predefined by MTT; these are:
lin
exotherm
6.8.1.1 lin | ||
6.8.1.2 exotherm |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
lin
is predefined for the
following components.
R
TF
GY
MTF
MGY
FMR
causality
gain
flow,r |
e = rf |
f = e/r |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Consider the following CR file.
FOR ALL rho,g,vol,h,topt,bott,flowin,press LET tktf2(rho,g,vol,h,topt,bott,effort,2,press,effort,1) = tank(rho,g,vol,h,topt,bott,press); |
The resulting function can then be expressed as octave (see section 6.8.4 Unresolved constitutive relationships - Octave) or c++ code as (see section 6.8.5 Unresolved constitutive relationships - c++) appropriate.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function p = tank (rho,g,vol,h,topt,bott,press) ## usage: p = tank (vol,h,topt,bott,press) ## ## val = press; zt = topt; zb = bott; zval = 0.5*(abs(zb+(zt-zb)*val-h)+(zb+(zt-zb)*val-h)); p = rho*g*zval + 0.5*(1+tanh((press-0.98)*500))*100000; endfunction |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
inline double tank(const double rho, const double g, const double vol, const double h, const double topt, const double bott, const double press) /* ## usage: p = tank (vol,h,topt,bott,press) ## ## */ double p, val, zval, zt, zb; val = press; zt = topt; zb = bott; zval = 0.5 * (abs(zb + (zt - zb) * val - h) + zb + (zt - zb) * val - h); p = rho * g * zval + 0.5 * (1 + tanh((press - 0.98) * 500)) * 100000L; return p; |
To make sure that this is used in system `model', the model_cr.h file must be as follows:
// CR headers for system model #include "tank.c" |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In general, lbl (see section 6.6 Labels (lbl)) files contain symbolic parameters. MTT provides three ways of substituting for these parameters:
6.9.1 Symbolic parameters (subs.r) | ||
6.9.2 Symbolic parameters for simplification (simp.r) | ||
6.9.3 Numeric parameters (numpar) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LET cos(~x)*cos(~y) = (cos(x+y)+cos(x-y))/2; LET cos(~x)*sin(~y) = (sin(x+y)-sin(x-y))/2; LET sin(~x)*sin(~y) = (cos(x-y)-cos(x+y))/2; LET cos(~x)^2 = (1+cos(2*x))/2; LET sin(~x)^2 = (1-cos(2*x)); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When computing time and frequency responses; or when evaluating functions in Octave (see section 10.4 Octave); symbolic parameters need numerical instantiations.
The numpar representation provides the relevant numerical information. It comes in a number of languages:
txt
m
octave
a
high-level interactive language for numerical computation -- translated
by mtt from the txt version.c
gcc
a c
compiler -- translated by mtt from the txt version.6.9.3.1 Text form (numpar.txt) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
assignment
statements
comments
commented assignment
statements
# Numerical parameter file (rc_numpar.txt) # Generated by MTT at Mon Jun 16 15:10:17 BST 1997 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% Version control history # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% $Id: mtt.texi,v 1.18 2003/09/07 20:41:19 geraint Exp $ # %% $Log: mtt.texi,v $ # %% Revision 1.18 2003/09/07 20:41:19 geraint # %% *** empty log message *** # %% # %% Revision 1.17 2003/08/19 14:20:38 gawthrop # %% Version 5.0 of MTT # %% Remove xref errors (spurious spaces) # %% # %% Revision 1.16 2003/08/19 14:11:23 gawthrop # %% Links to legal stuff # %% # %% Revision 1.15 2003/08/19 14:01:45 gawthrop # %% Added legal appendices # %% # %% Revision 1.14 2003/08/06 14:50:56 gawthrop # %% Describe the alias mechanism for invoking mtt options # %% # %% Revision 1.13 2002/12/13 10:07:07 gawthrop # %% Added example in sh section of DIY reps # %% # %% Revision 1.12 2002/09/19 08:09:31 gawthrop # %% Updated documentation documentation # %% # %% Revision 1.11 2002/08/20 15:51:17 gawthrop # %% Update to work with ident DIY rep # %% # %% Revision 1.10 2002/07/22 10:45:22 geraint # %% Fixed gnuplot rep so that it correctly re-runs the simulation if input files have changed. # %% # %% Revision 1.9 2002/07/05 13:29:34 geraint # %% Added notes about generating dynamically linked functions for Octave and Matlab. # %% # %% Revision 1.8 2002/07/04 21:34:12 geraint # %% Updated gnuplot view description to describe Tcl/Tk interface instead of obsolete txt method. # %% # %% Revision 1.7 2002/04/23 09:51:54 gawthrop # %% Changed incorrect statement about searching for components. # %% # %% Revision 1.6 2001/10/15 14:29:50 gawthrop # %% Added documentaton on [1:N] style port labels # %% # %% Revision 1.5 2001/07/23 03:35:29 geraint # %% Updated file structure (mtt/bin). # %% # %% Revision 1.4 2001/07/23 03:25:02 geraint # %% Added notes on -ae hybrd, rk4, ode2odes.cc, .oct dependencies. # %% # %% 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 # %% Added the c++ anf m CR info. # %% # %% Revision 1.65 2000/11/27 15:36:15 peterg # %% NOPAR --> NOTPAR # %% # %% Revision 1.64 2000/11/16 14:22:48 peterg # %% added UNITS declaration # %% # %% Revision 1.63 2000/11/03 14:41:08 peterg # %% Added PAR and NOTPAR stuff # %% # %% Revision 1.62 2000/10/17 17:53:34 peterg # %% Added some simulation details # %% # %% Revision 1.61 2000/09/14 17:13:06 peterg # %% New options table # %% # %% Revision 1.60 2000/09/14 17:09:20 peterg # %% Tidied up valid name sections # %% Tidied up defining represnetations table # %% Verion 4.6 # %% # %% Revision 1.59 2000/08/30 13:09:00 peterg # %% Updated option table # %% # %% Revision 1.58 2000/08/01 13:30:19 peterg # %% Version 4.4 # %% updated STEPFACTOR info # %% describes octave and OCST interfaces # %% # %% Revision 1.57 2000/07/20 07:55:44 peterg # %% Version 4.3 # %% # %% Revision 1.56 2000/05/19 17:49:17 peterg # %% Extended the user defined representation section -- new nppp rep. # %% # %% Revision 1.55 2000/03/16 13:53:31 peterg # %% Correct date # %% # %% Revision 1.54 2000/03/15 21:22:57 peterg # %% Updated to 4.1 -- old style SS no longer supported # %% # %% Revision 1.53 1999/12/22 05:33:10 peterg # %% Updated for 4.0 # %% # %% Revision 1.52 1999/11/23 00:25:11 peterg # %% Added the sensitivity reps # %% # %% Revision 1.51 1999/11/16 04:43:47 peterg # %% Added start of sensitivity section # %% # %% Revision 1.50 1999/11/16 00:30:35 peterg # %% Updated simulation section # %% Added vector components # %% # %% Revision 1.49 1999/07/20 23:44:58 peterg # %% V 3.8 # %% # %% Revision 1.48 1999/07/19 03:08:33 peterg # %% Added documentation for (new) SS lbl fields # %% # %% Revision 1.47 1999/03/09 01:42:22 peterg # %% Rearranged the User interface section # %% # %% Revision 1.46 1999/03/09 01:18:01 peterg # %% Updated for 3.5 including xmtt # %% # %% Revision 1.45 1999/03/03 02:39:26 peterg # %% Minor updates # %% # %% Revision 1.44 1999/02/17 06:52:14 peterg # %% New level formula dor artwork # %% # %% Revision 1.43 1998/11/25 16:49:24 peterg # %% Put in subs.r documentation (was called params.r) # %% # %% Revision 1.42 1998/11/24 12:24:59 peterg # %% Added section on simulation output # %% Version 3.4 # %% # %% Revision 1.41 1998/09/02 12:04:15 peterg # %% Version 3.2 # %% # %% Revision 1.40 1998/08/27 08:36:39 peterg # %% Removed in. methods except Euler anf implicit # %% # %% Revision 1.39 1998/08/18 10:44:28 peterg # %% Typo # %% # %% Revision 1.38 1998/08/18 09:16:38 peterg # %% Version 3.1 # %% # %% Revision 1.37 1998/08/17 16:14:30 peterg # %% Version 3.1 - includes documentation on METHOD=IMPLICIT # %% # %% Revision 1.36 1998/07/30 17:33:15 peterg # %% VERSION 3.0 # %% # %% Revision 1.35 1998/07/22 11:00:53 peterg # %% Correct date! # %% # %% Revision 1.34 1998/07/22 11:00:13 peterg # %% Version to BAe # %% # %% Revision 1.33 1998/07/17 19:32:19 peterg # %% Added more about aliases # %% # %% Revision 1.32 1998/07/05 14:21:56 peterg # %% Further additions (Carlisle-Glasgow) # %% # %% Revision 1.31 1998/07/04 11:35:57 peterg # %% Strarted new lbl description # %% # %% Revision 1.30 1998/07/02 18:39:20 peterg # %% Started 3.0 # %% Added alias and default sections. # %% # %% Revision 1.29 1998/05/19 19:46:58 peterg # %% Added the odess description # %% # %% Revision 1.28 1998/05/14 09:17:22 peterg # %% Added METHOD variable to the simpar file # %% # %% Revision 1.27 1998/05/13 10:03:09 peterg # %% Added unknown/zero SS label documentation. # %% # %% Revision 1.26 1998/04/29 15:12:46 peterg # %% Version 2.9. # %% # %% Revision 1.25 1998/04/12 17:00:26 peterg # %% Added new port features: coerced direction and top-level behaviour. # %% # %% Revision 1.24 1998/04/05 18:27:20 peterg # %% This was the 2.6 version # %% # Revision 1.23 1997/08/24 11:17:51 peterg # This is the released version 2.5 # # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Parameters c = 1.0; # Default value r = 1.0; # Default value # Initial states x(1) = 0.0; # Initial state for rc (c) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To create the causal bond graph of system `sys' in language fig type:
mtt sys cbg fig |
mtt sys cbg m |
mtt sys cbg view |
6.10.1 Language fig (cbg.fig) | ||
6.10.2 Language m (cbg.m) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The causal bond graph of system `sys' is represented as an m file with heading:
function [cbonds,status] = sys_cbg |
cbonds is a matrix with
status is a matrix with
6.10.2.1 Transformation abg2cbg_m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation takes the acausal bond graph as an m file (see section 6.4.3 Language m (abg.m)) and transforms it into a causal bond graph in m-file format (see section 6.10.2 Language m (cbg.m)).
It is based on the m-function abg2cbg.m which iteratively tries to complete causality whilst recursively searching the bond graph structure. If causality is incomplete, it picks the first acausal dynamic (C or I) component, asserts integral causality, and tries again.
This is essentially the sequential causality assignment procedure of Karnopp and Rosenberg.
The transformation informs the user of the final status in terms of the percentage of causally complete components; a successful model will yield 100% here.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The elementary system equations are a complete set of assignment statements describing the dynamic system corresponding to the bond graph. They are in the Reduce (see section 9.3 Reduce) language.
Because these are based on a causally complete system, these assignment statements are directly soluble by substitution.
Unlike early versions of MTT, MTT does not sort the equations in order of solution, but rather leaves them sorted by component and subsystem.
These are not supposed to be read by the user, so there is no view facility as such. However, you may read these with your favourite text editor and, to this end, helpful comment lines have been added.
Wherever components have an explicit constitutive relationship, the corresponding RHS of the equation has a standard form.
cr(arguments,out_causality,outport, input_1, causality_1, port_1, .... input_i, causality_i, port_i, .... input_n, causality_n, port_n ); |
arguments
out_causality
outport
input_i
causality_i
port_i
An example for a resistor with linear constitutive relationship is:
rc_1_bond4_flow := lin(flow,r,flow,1, rc_1_bond4_effort,effort,1 ); |
6.11.0.1 Transformation cbg2ese_m2r |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is based on the m-function cbg2ese.m which iteratively traverses the causal bond graph writing equations as it goes.
It also writes out the system structure as the file `sys_def.r'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system differential algebraic equations describe the system dynamics together together with any algebraic constraints.
They are generated in language lang
for system
sys
by:
mtt sys dae lang |
r
m
view
There are five sets of variables describing the system:
x
z
u
ui
y
In general there are four sets of equations. The right-hand side of each is a function of x, dz/dt, u and ui and the left hand sides are:
6.12.1 Language reduce (dae.r) | ||
6.12.2 Language m (dae.m) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system DAEs (see section 6.12 Differential-Algebraic Equations (dae)) are represented in the reduce (see section 9.3 Reduce) language as arrays containing the algebraic expressions for the right hand sides of each set of equations. The arrays are:
MTTx
MTTz
MTTu
mttv
MTTy
6.12.1.1 Transformation ese2dae_r |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation (see section 1.2 What is a transformation?) uses Reduce (see section 9.3 Reduce) to combine the elementary system equations (see section 6.11 Elementary system equations (ese)) with the constitutive relationships (see section 1.6.2 Constitutive relationship) and simplify the result.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function resid = sys_dae(dx,x,t) function y = sys_dae(dx,x,t) |
6.12.2.1 Transformation dae_r2m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation (see section 1.2 What is a transformation?) uses Reduce (see section 9.3 Reduce) to rewrite the elementary system equations (see section 6.11 Elementary system equations (ese)) in m-file format (see section 9.2 m) . Numerical parameters are declared as global.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system constrained-state equations describe the system dynamics for a special class of systems (see the book for details). The resuting equations are of the form:
E(x) dx/dt = f(x,u) y = g(x,u) |
They are generated in language lang
for system
sys
by:
mtt sys cse lang |
r
m
view
There are three sets of variables describing the system:
x
u
y
In general there are two sets of equations. The right-hand side of each is a function of x and u and the left hand sides are:
6.13.1 Language reduce (cse.r) | ||
6.13.2 Language m (view) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system CSEs (see section 6.13 Constrained-state Equations (cse)) are represented in the reduce (see section 9.3 Reduce) language as arrays containing the algebraic expressions for the right hand sides of each set of equations. The arrays are:
MTTx
MTTu
MTTy
6.13.1.1 Transformation dae2cse_r |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation (see section 1.2 What is a transformation?) Reduce (see section 9.3 Reduce) to find various Jacobians which are combined to find the E matrix and the constrained-state equations (see section 6.13 Constrained-state Equations (cse)).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system ordinary differential equations describe the system dynamics.
They are generated in language lang
for system
sys
by:
mtt sys ode lang |
r
m
view
There are three sets of variables describing the system:
x
u
y
In general there are two sets of equations. The right-hand side of each is a function of x and u and the left hand sides are:
6.14.1 Language reduce (ode.r) | ||
6.14.2 Language m (ode.m) | ||
6.14.3 Language m (view) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system ODEs (see section 6.14 Ordinary Differential Equations) are represented in the reduce (see section 9.3 Reduce) language as arrays containing the algebraic expressions for the right hand sides of each set of equations. The arrays are:
MTTx
MTTu
MTTy
6.14.1.1 Transformation cse2ode_r |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation (see section 1.2 What is a transformation?) uses Reduce (see section 9.3 Reduce) to invert the E matrix of the constrained-state equations (see section 6.13 Constrained-state Equations (cse)) and simplify the result.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function dx = sys_ODE(x,t) function y = sys_ODE(dx,x,t) |
6.14.2.1 Transformation ode_r2m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This transformation (see section 1.2 What is a transformation?) uses Reduce (see section 9.3 Reduce) to rewrite the ordinary differential equations (see section 6.14 Ordinary Differential Equations) in m-file format (see section 9.2 m) . Numerical parameters are declared as global.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system descriptor matrices A, B, C, D and E describe the linearised system dynamics in the form
E dx/dt = Ax + Bu y = Cx + Du |
They are generated in language lang
for system
sys
by:
mtt sys dm lang |
r
m
view
6.15.1 Language reduce (dm.r) | ||
6.15.2 Language m (dm.m) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system descriptor matrices (see section 6.15 Descriptor matrices (dm)) are represented in the reduce (see section 9.3 Reduce) language as arrays containing the four matrices. The arrays are:
MTTA
MTTB
MTTA
MTTD
MTTE
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function [A,B,C,D,E] = sys_dm |
System numeric parameters (see section 1.6.4 Numeric parameters) are passed via global variables defined in the _numpar.m file. Thus the system descriptor matrices are typically generated in Octave (see section 10.4 Octave) as follows:
sys_numpar [A,B,C,D,E] = sys_dm |
Parameters can be changed from their default values by entering their
values directly into Octave (see section 10.4
Octave) and then invoking sys_dm
; for example
sys_numpar par_1 = 25 par_2 = par_1 + 3 [A,B,C,D,E] = sys_dm |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT has a report-generator feature. The user specifies the report contents in a text file (see section 6.16.1 Language text (rep.txt)) using an appropriate text editor (see section 10.3 Text editors).
For example, the report can be viewed by typing
mtt system rep view |
6.16.1 Language text (rep.txt) | ||
6.16.2 Language view |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The user specifies the report contents in a text file (see section 6.16.1 Language text (rep.txt)) using an appropriate text editor (see section 10.3 Text editors). The text file contains lines which are either comments (indicated by %) or valid MTT commands. The report will then contain appropriate sections. The following languages are supported by the report generator:
m
octave
a high-level
interactive language for numerical computation.r
reduce
a high-level
interactive language for symbolic computation.tex
latex
a text
processor.ps
ghostview
another
document viewer.c
gcc
a c compiler.
mtt rc abg tex mtt rc cbg ps mtt rc struc tex mtt rc ode tex mtt rc sro ps mtt rc tf tex mtt rc lmfr ps |
The acausal bond graph (abg) (see section 6.4 Acausal bond graph (abg)) with the tex language is handled in a special way: the acausal Bond Graph in fig format (see section 6.4.1 Language fig (abg.fig)), the label file (see section 6.6 Labels (lbl)) the description file (see section 8.2.2 Detailed on-line documentation), together with corresponding subsystems are included in the report. It is recommended that the first (non-comment line) in the file should be:
mtt <system> abg tex |
<system>
is the name of the (top-level)
system.
As usual, MTT provides a default text file to be edited by the user (see section 10.3 Text editors).
In the special case that the first argument to mtt (normally the system) is a directory, a default text file is provided which generates a report for all systems to be found in that directory tree.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT has a number of built-in mechanisms for the user to extend its capabilities. As MTT is based on `Make' it is unsurprising that some of these involve the creation of `make files'.
7.1 Makefiles | ||
7.2 New (DIY) representations | ||
7.3 Component library |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If a file called `Makefile' exists in the current directory, MTT executes it using make before doing anything else. This is useful if one of the .txt files contains a reference to, for example, an octave function of which MTT unaware. Such a function can be created using the makefile. An example `Makefile' is
# Makefile for the Two link GMV example all: msdP_tf.m TwoLinkP_obs.m TwoLinkP_sm.m twolinkp_sm.m TwoLinkGMV_numpar.m msdP_tf.m: msdP_abg.fig mtt -q msdP tf m TwoLinkP_obs.m: TwoLinkP_abg.fig TwoLinkP_lbl.txt mtt -q TwoLinkP obs m TwoLinkP_sm.m: TwoLinkP_abg.fig TwoLinkP_lbl.txt mtt -q TwoLinkP sm m twolinkp_sm.m: TwoLinkP_sm.m cp -v TwoLinkP_sm.m twolinkp_sm.m TwoLinkGMV_numpar.m: TwoLinkGMV_numpar.txt mtt -q TwoLinkGMV numpar m |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It may be convenient to create new representations for MTT; in particular, it is nice to be able to include the result of some numerical or symbolic computations within an MTT report (see section 6.16 Report (rep)). Therefore MTT provides a mechanism for doing this.
Future extensions of MTT will use such representations stored in $MTT_REP.
There are three parts to creating a DIY representation called myrep
7.2.1 Makefile | ||
7.2.2 Shell-script | ||
7.2.3 Documentation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To create a new representation `myrep' in a language `mylang', create a file with the name
myrep_rep.make |
The following example declares the new representation `ident' which is created in conjunction with the shell-script ident_rep.sh (see section 7.2.2 Shell-script).
@verbatim # -*-makefile-*-
#SUMMARY Identification #DESCRIPTION Partially know system identification using #DESCRIPTION using bond graphs
# Makefile for representation ident # File ident_rep.make
#Copyright (C) 2000,2001,2002 by Peter J. Gawthrop
## Model targets model_reps = ${SYS}_sympar.m ${SYS}_simpar.m ${SYS}_state.m model_reps += ${SYS}_numpar.m ${SYS}_input.m ${SYS}_ode2odes.m model_reps += ${SYS}_def.m
## Prepend s to get the sensitivity targets sensitivity_reps = ${model_reps:%=s%}
## Model prerequisites model_pre = ${SYS}_abg.fig ${SYS}_lbl.txt model_pre += ${SYS}_rdae.r ${SYS}_numpar.txt
## Prepend s to get the sensitivity targets sensitivity_pre = ${model_pre:%=s%}
## Simulation targets sims = ${SYS}_sim.m s${SYS}_ssim.m
## m-files needed for ident ident_m = ${SYS}_ident.m ${SYS}_ident_numpar.m
## Targets for the ident simulation ident_reps = ${ident_m} ${sims} ${model_reps} ${sensitivity_reps}
## ps output files etc psfiles = ${SYS}_ident.ps ${SYS}_ident.comparison.ps figfiles = ${psfiles:%.ps=%.fig} gdatfiles = ${psfiles:%.ps=%.gdat} datfiles = ${psfiles:%.ps=%.dat2}
## LaTeX files etc latexfiles = ${SYS}_ident_par.tex
all: ${SYS}_ident.${LANG}
echo: echo "sims: ${sims}" echo "model_reps: ${model_reps}" echo "sensitivity_reps: ${sensitivity_reps}" echo "ident_reps: ${ident_reps}"
${SYS}_ident.view: ${psfiles} ident_rep.sh ${SYS} view
${psfiles}: ${figfiles} ident_rep.sh ${SYS} ps
${figfiles}: ${gdatfiles} ident_rep.sh ${SYS} fig
${gdatfiles}: ${datfiles} ident_rep.sh ${SYS} gdat
${datfiles} ${latexfiles}: ${ident_reps} ident_rep.sh ${SYS} dat2
${SYS}_ident.m: ident_rep.sh ${SYS} m
${SYS}_ident_numpar.m: ident_rep.sh ${SYS} numpar.m
## System model reps ## Generic txt files ${SYS}_%.txt: mtt ${OPTS} -q -stdin ${SYS} $* txt
## Specific m files ${SYS}_ode2odes.m: ${model_pre} mtt -q -stdin ${OPTS} ${SYS} ode2odes m
${SYS}_sim.m: ${SYS}_ode2odes.m mtt ${OPTS} -q -stdin ${SYS} sim m
## Numpar files ${SYS}_numpar.m: mtt ${SYS} numpar m
## Sympar files ${SYS}_sympar.m: mtt ${SYS} sympar m
## Generic txt to m ${SYS}_%.m: ${SYS}_%.txt mtt ${OPTS} -q -stdin ${SYS} $* m
## r files ${SYS}_def.r: ${SYS}_abg.fig mtt ${OPTS} -q -stdin ${SYS} def r
${SYS}_rdae.r: mtt ${OPTS} -q -stdin ${SYS} rdae r
## Sensitivity model reps ## Generic txt files s${SYS}_%.txt: mtt ${OPTS} -q -stdin -s s${SYS} $* txt
## Specific m files ## Numpar files s${SYS}_numpar.m: mtt -s s${SYS} numpar m
## Sympar files s${SYS}_sympar.m: mtt -s s${SYS} sympar m
s${SYS}_ode2odes.m: ${sensitivity_pre} mtt -q -stdin ${OPTS} -s s${SYS} ode2odes m
s${SYS}_ssim.m: mtt -q -stdin ${OPTS} -s s${SYS} ssim m
s${SYS}_def.m: mtt -q -stdin ${OPTS} -s s${SYS} def m
## Generic txt to m s${SYS}_%.m: s${SYS}_%.txt mtt ${OPTS} -q -stdin s${SYS} $* m
## r files s${SYS}_rdae.r: mtt ${OPTS} -q -stdin -s s${SYS} rdae r
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For more complex DIY representations, it is convenient to define new commands to be used by the Makefile (see section 7.2.1 Makefile).
The following example shows this in the context of the DIY representation `ident' used as an example in the previous section (see section 7.2.1 Makefile).
@verbatim #! /bin/sh
## ident_rep.sh ## DIY representation "ident" for mtt # Copyright (C) 2002 by Peter J. Gawthrop
ps=ps
sys=$1 rep=ident lang=$2 mtt_parameters=$3 rep_parameters=$4
## Some names target=${sys}_${rep}.${lang} def_file=${sys}_def.r dat2_file=${sys}_ident.dat2 dat2s_file=${sys}_idents.dat2 ident_numpar_file=${sys}_ident_numpar.m option_file=${sys}_ident_mtt_options.txt
## Get system information if [ -f "${def_file}" ]; then echo Using ${def_file} else mtt -q ${sys} def r fi
ny=`mtt_getsize $1 y` nu=`mtt_getsize $1 u`
check_new_options() { if [ -f "${option_file}" ]; then old_options=`cat ${option_file}` if [ "${mtt_options}" != "${old_options}" ]; then echo ${mtt_options} > ${option_file} fi else echo ${mtt_options} > ${option_file} fi }
## Make the _ident.m file make_ident() { filename=${sys}_${rep}.m date=`date` echo Creating ${filename}
cat > ${filename} <<EOF function [epar,Y] = ${sys}_ident (y,u,t,par_names,Q,extras)
## usage: [epar,Y] = ${sys}_ident (y,u,t,par_names,Q,extras) ## ## last last time in run ## ppp_names Column vector of names of ppp params ## par_names Column vector of names of estimated params ## extras Structure containing additional info ## ## Created by MTT on ${date} ## Sensitivity system name system_name = "s${sys}"
##Sanity check if nargin<3 printf("Usage: [y,u,t] = ${sys}_ident(y,u,t,par_names,Q,extras);"); return endif
if nargin<6 ## Set up optional parameters extras.criterion = 1e-3; extras.emulate_timing = 0; extras.max_iterations = 10; extras.simulate = 2; extras.v = 1e-2; extras.verbose = 1; extras.visual = 1; endif ## System info [n_x,n_y,n_u,n_z,n_yz] = ${sys}_def; sympar = ${sys}_sympar; simpar = ${sys}_simpar; sympars = s${sys}_sympar; simpars = s${sys}_simpar;
## Parameter indices i_par = ppp_indices (par_names,sympar,sympars);
## Initial model state x_0 = zeros(2*n_x,1);
## Initial model parameters par_0 = s${sys}_numpar;
## Reset simulation parameters [n_data,m_data] = size(y); dt = t(2)-t(1); simpars.last = (n_data-1)*dt; simpars.dt = dt;
## Identification [epar,Par,Error,Y,iterations,x] = ppp_optimise(system_name,x_0,par_0,simpars,u,y,i_par,Q,extras); ## Do some plots figure(1); title("Comparison of data"); xlabel("t"); ylabel("y"); [N,M] = size(Y); plot(t,Y(:,M-n_y+1:M),"1;Estimated;", t,y,"3;Actual;"); figfig("${sys}_ident_comparison");
## Create a table of the parameters [n_par,m_par] = size(i_par); fid = fopen("${sys}_ident_par.tex", "w"); fprintf(fid,"\\\\begin{table}[htbp]\\n"); fprintf(fid," \\\\centering\\n"); fprintf(fid," \\\\begin{tabular}{|l|l|}\\n"); fprintf(fid," \\\\hline\\n"); fprintf(fid," Name & Value \\\\\\\\ \\n"); fprintf(fid," \\\\hline\\n"); for i = 1:n_par fprintf(fid,"$%s$ & %4.2f \\\\\\\\ \\n", par_names(i,:), epar(i_par(i,1))); endfor fprintf(fid," \\\\hline\\n"); fprintf(fid,"\\\\end{tabular}\\n"); fprintf(fid,"\\\\caption{Estimated Parameters}\\n"); fprintf(fid,"\\\\end{table}\\n"); fclose(fid);
endfunction EOF }
make_ident_numpar() { echo Creating ${ident_numpar_file} cat > ${sys}_ident_numpar.m <<EOF function [y,u,t,par_names,Q,extras] = ${sys}_ident_numpar;
## usage: [y,u,t,par_names,Q,extras] = ${sys}_ident_numpar; ## Edit for your own requirements ## Created by MTT on ${date}
## This section sets up the data source ## simulate = 0 Real data (you supply ${sys}_ident_data.dat) ## simulate = 1 Real data input, simulated output ## simulate = 2 Unit step input, simulated output simulate = 2;
## System info [n_x,n_y,n_u,n_z,n_yz] = ${sys}_def; simpars = s${sys}_simpar;
## Access or create data if (simulate<2) # Get the real data if (exist("${sys}_ident_data.dat")==2) printf("Loading ${sys}_ident_data.dat\n"); load ${sys}_ident_data.dat else printf("Please create a loadable file ${sys}_ident_data.dat containing y,u and t\n"); return endif else switch simulate case 2 # Step simulation t = [0:simpars.dt:simpars.last]'; u = ones(size(t)); otherwise error(sprintf("simulate = %i not implemented", simulate)); endswitch endif if (simulate>0) par = ${sys}_numpar(); x_0 = ${sys}_state(par); dt = t(2)-t(1); simpars.dt = dt; simpars.last = t(length(t)); y = ${sys}_sim(zeros(n_x,1), par, simpars, u); endif
## Default parameter names - Put in your own here sympar = ${sys}_sympar; # Symbolic params as structure par_names = struct_elements (sympar); # Symbolic params as strings [n,m] = size(par_names); # Size the string list
## Sort by index for [i,name] = sympar par_names(i,:) = sprintf("%s%s",name, blanks(m-length(name))); endfor ## Output weighting vector Q = ones(n_y,1); ## Extra parameters extras.criterion = 1e-5; extras.emulate_timing = 0; extras.max_iterations = 10; extras.simulate = simulate; extras.v = 1e-2; extras.verbose = 1; extras.visual = 1;
endfunction EOF }
make_dat2() {
## Inform user echo Creating ${dat2_file}
## Use octave to generate the data octave -q <<EOF [y,u,t,par_names,Q,extras] = ${sys}_ident_numpar; [epar,Y] = ${sys}_ident (y,u,t,par_names,Q,extras); [N,M] = size(Y); y_est = Y(:,M); data = [t,y_est,u]; save -ascii ${dat2_file} data EOF
## Tidy up the latex stuff - convert foo_123 to foo_{123} cat ${sys}_ident_par.tex > mtt_junk sed -e "s/_\([a-z0-9,]*\)/_{\1}/g" < mtt_junk >${sys}_ident_par.tex rm mtt_junk }
case ${lang} in numpar.m) ## Make the numpar stuff make_ident_numpar; ;; m) ## Make the code make_ident; ;; dat2) ## The dat2 language (output data) & fig file make_dat2; ;; gdat) cp ${dat2_file} ${dat2s_file} dat22dat ${sys} ${rep} dat2gdat ${sys} ${rep} ;; fig) gdat2fig ${sys}_${rep} ;; ps) figs=`ls ${sys}_ident*.fig | sed -e 's/\.fig//'` for fig in ${figs}; do fig2dev -Leps ${fig}.fig > ${fig}.ps done texs=`ls ${sys}_ident*.tex | sed -e 's/\.tex//'` for tex in ${texs}; do makedoc "" "${sys}" "ident_par" "tex" "" "" "$ps" doc2$ps ${sys}_ident_par "$documenttype" done ;; view) pss=`ls ${sys}_ident*.ps` echo Viewing ${pss} for ps in ${pss}; do gv ${ps}& done ;; *) echo Language ${lang} not supported by ${rep} representation exit 3 esac
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If MTT does not recognise a component (eg named MyComponent) as a simple component (see section 6.4.1.5 Simple components) or as already existing, it searches the library search path $MTT_COMPONENTS (see section 11.4.2 $MTT_COMPONENTS) for a directory called MyComponent containing MyComponent_lbl.txt. It then copies the entire directory into the current working directory. Thus, for example, the directory could contain MyComponent_desc.tex MyComponent_abg.fig MyComponent_lbl.txt and MyComponent_cr.r in addition to MyComponent_lbl.txt.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8.1 Manual | ||
8.2 On-line documentation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT is documented in this manual. The manual can be invoked in various ways:
mtt manual
mtt info
mtt hinfo
emacs
browser
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT components, constitutive relations, examples and representations in libraries (see section 7.3 Component library) are documented in two ways:
8.2.1 Brief on-line documentation | ||
8.2.2 Detailed on-line documentation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Documentation of DIY components, examples, constitutive relationships and representations is provides by the programmer by inserting code of the form
#SUMMARY One line summary #DESCRIPTION Multi-line #DESCRIPTION More detailed description |
within the appropriate file (usually at or near the top):
components
examples
constitutive
relations
representations
This documentation is accessed by the user in various ways
mtt help name
mtt system lbl
view
Including mtt system abg tex
in the _rep.txt file
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
DIY components, examples, constitutive relationships can be described textually in LaTeX (.tex) description file; this is the only language for this representation. This representation is used by the LaTeX language version (see section 6.4.4 Language tex (abg.tex)) of the acausal bond graph representation (see section 6.4 Acausal bond graph (abg)).
The file may contain any LaTeX commands valis for the "article" document type but must not contain:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.1 Fig | r | |
9.2 m | ||
9.3 Reduce | ||
9.4 c |
These are a number of languages used by MTT to implement the various representations. Each has associated Language tools (see section 10. Language tools) to manipulate and/or view the representation.
fig
Fig
a graphical
description language.m
octave
a high-level
interactive language for numerical computation.r
reduce
a high-level
interactive language for symbolic computation.tex
latex
a text
processor.dvi
xdvi
a document
viewer.ps
ghostview
another
document viewer.gdat
gnuplot
a data
viewer.c
gcc
a c compiler.sg
scigraphica
a plotting
package.These tools are automatically invoked as appropriate by MTT; but for more advanced use, these tools can be used directly on files (with the appropriate suffix) generated by MTT.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
10.1 Views | ||
10.2 Xfig | ||
10.3 Text editors | ||
10.4 Octave | ||
10.5 LaTeX |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A number of representations (see section 6. Representations) have a language representation which is particularly useful for viewing by the user. These views are invoked, where appropriate by the command:
mtt sys rep view |
sys
is the system name and rep
a
corresponding representation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Its up to you which text editor to use. I recommend emacs, but simpler (and less powerful) editors such as xedit, textedit and vi are also ok.
I usually run MTT out of an emacs shell window and keep the rest of the files in emacs buffers.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Octave is a numerical matrix-based language See section `Octave' in Octave. It is similar to Matlab in many ways. In most cases, m-files generated by MTT can be understood by both Matlab and Octave (and no doubt other Matlab lookalikes).
MTT provides the octave function mtt
. The
octave command
help mtt |
usage: mtt (system[,representation,language]) Invokes mtt from octave to generate system_representation.language Ie equivalent to "mtt system representation language" at the shell Representation and language defualt to "sm" and "m" respectively |
Thus for example, if octave is in the directory containing the system rc the following session generates the state matrices of the system "rc" with the defaut capacitance but resitance r=0.1.
octave> mtt("rc"); Creating rc_rbg.m Creating rc_cmp.m Creating rc_fig.fig Creating rc_sabg.fig Creating rc_alias.txt Creating rc_alias.m Creating rc_sub.sh Creating rc_abg.m Creating rc_cbg.m (maximise integral causality) Creating rc_type.sh Creating rc_ese.r Creating rc_def.r Creating rc_struc.txt Creating rc_rdae.r Creating rc_subs.r Creating rc_cr.txt Creating rc_cr.r Copying CR SS to here from Copying CR lin to here from Creating rc_dae.r Creating rc_sympar.txt Creating rc_sympar.r Creating rc_cse.r Creating rc_sspar.r Creating rc_csm.r Creating rc_ode.r Creating rc_ss.r Creating rc_sm.r Creating rc_switch.txt 0 switches found Creating rc_sympars.txt Creating rc_sm.m Copying rc_sm.m octave> mtt("rc","numpar"); Creating rc_numpar.txt Creating rc_numpar.m Copying rc_numpar.m octave> mtt("rc","sympar"); Creating rc_sympar.m Copying rc_sympar.m octave> par = rc_numpar par = 1 1 octave> sym = rc_sympar; octave> par(sym.r) = 0.1; octave> [A,B,C,D] = rc_sm(par) A = -10 B = 10 C = 1 D = 0 octave> |
step(rc); bode(rc); |
10.4.1 Octave control system toolbox (OCST) | ||
10.4.2 Creating GNU Octave .oct files | ||
10.4.3 Creating Matlab .mex files | ||
10.4.4 Embedding MTT models in Simulink |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT provides an interface to the Octave control system
toolbox (OCST) using the mfile mtt2sys
. the octave command
help mtt2sys |
usage: sys = mtt2sys (Name[,par]) Creates a sys structure for the Octave Control Systems Toolbox from an MTT system with name "Name" Optional second argument is system parameter list Assumes that Name_sm.m, Name_struc.m and Name_numpar.m exist |
Thus for example, if octave is in the directory containing the system rc:
rc = mtt2sys("rc"); |
step(rc); bode(rc); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
GNU Octave dynamically loaded functions (.oct files) can be created by instructing MTT to create the "oct" representation:
mtt [options] sys ode oct |
This will cause MTT to create the C++ representation of the system (sys_ode.cc) and to then compile it as a shared object suitable for use within Octave. The resultant file may be used in an identical manner to the equivalent, but generally slower, interpreted .m file.
Usage information for the function may be obtained within Octave in the usual manner:
octave:1> help rc_ode rc_ode is the dynamically-linked function from the file /home/mttuser/rc/rc_ode.oct Usage: [mttdx] = rc_ode(mttx,mttu,mttt,mttpar) Octave ode representation of system rc Generated by MTT on Fri Jul 5 11:23:08 BST 2002 |
Note that the first line of output from Octave identifies whether the compiled or interpreted function is being used.
Alternatively, standard representations may be generated using the Octave DLDs by use of the "-oct" switch:
mtt -oct rc odeso view |
In order to successfully generate .oct files, Octave must be correctly configured prior to compilation and certain headers and libraries must be correctly installed on the system (see section 11.3.2 .oct file dependencies).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
On GNU/Linux systems, Matlab dynamically linked executables (.mexglx files) can created by instructing MTT to create the "mexglx" representation:
mtt [options] sys ode mexglx |
This will cause MTT to create the C++ representation of the system (sys_ode.cc) and to then compile it as a shared object suitable for use within Matlab.
If it is necessary to compile mex files for another platform, then the usual C++ representation (generated with the -cc flag) can be created and the resultant file compiled with the -DCODEGENTARGET=MATLABMEX flag on the target platform.
mtt_machine: mtt -cc rc ode cc matlab_machine: matlab> mex -DCODEGENTARGET=MATLABMEX rc_ode.cc |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is possible to embed MTT functions or entire MTT models within Simulink simulations as Sfun blocks. If the zip package is installed on the system, the command
mtt sys sfun zip |
will create a compressed archive containing sys.mdl, which may be embedded into a larger Simulink model. Also contained within the archive will be four sys_sfun*.c files,
The last of these files must be edited to correctly map the inputs and outputs between the MTT and Simulink models. The two sections to edit are clearly marked with
|
These four files should then be compiled with the Matlab "mex" compiler as described in the README file in the archive.
If it is desired to compile the .mex files directly from within MTT on a machine which has the Matlab header files installed, this may be done with the command
mtt sys sfun mexglx |
which will generated the four .mex files and the .mdl file. In this case, the user must ensure that sys_sfun_interface.c has been correctly edited prior to compilation.
Note that solution of algebraic equations within Simulink is not possible unless the Matlab Optimisation Toolbox is installed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LaTeX is a powerful text processor which MTT uses to provide visual output.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
11.1 Software components | ||
11.2 REDUCE setup | ||
11.3 Octave setup | ||
11.4 Paths | ||
11.5 File structure | ||
A.1 GNU Free Documentation License | ||
A.2 GNU GENERAL PUBLIC LICENSE |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT is built from a set of readily-available software tools. These are:
The General purpose tools are (these will all be available with a standard Linux distribution):
sh
gmake
gawk
sed
grep
comm
xfig
fig2dev
ghostview
xdvi
dvips
latex
latex2html
perl
gnuplot
gnuscape
gcc
<A HREF="http://home.pages.de/~GNU/">GNU</A> documentation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Symbolic algebra is performed by REDUCE, which although not free software is the the result of international collaboration. The version I use is obtained from:
ZIB ( http://www.zib.de )<A HREF="http://www.rrz.uni-koeln.de/REDUCE/">REDUCE</A> documentation. <A HREF="http://www.zib.de">ZIB</A> documentation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Octave is available at various web sites including: http://www.octave.org
11.3.1 .octaverc | ||
11.3.2 .oct file dependencies |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The `.octaverc' file should contain the following lines:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Startup file for Octave for use with MTT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% implicit_str_to_num_ok = 1; empty_list_elements_ok = 1; |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
liboctave
, libcruft
and
liboctinterp
are available on the system.
This can be acheived by compiling Octave from the source code,
configured with the options --enable-shared
and
--enable-dl
.
A number of additional libraries and headers are also required to be installed on a system. These include,
Note that on many GNU/Linux distributions, the necessary headers are contained in development packages which must be installed in addition to the standard library package.
Further information on configuring and installing Octave to handle dynamic libraries (DLDs) can be found in the Octave documentation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are a number of paths that must be set correctely for
MTT to work. These are normally set up by sourcing the
file mttrc
that lives in the MTT home
directory.
11.4.1 $MTTPATH | ||
11.4.2 $MTT_COMPONENTS | ||
11.4.3 $MTT_CRS | ||
11.4.4 $MTT_EXAMPLES | ||
11.4.5 $OCTAVE_PATH |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
/usr/local/lib/mtt
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT_COMPONENTS=.:$MTT_LIB/lib/comp/ |
MTT_COMPONENTS=my_library_path:$MTT_COMPONENTS |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT_CRS=$MTTPATH/lib/cr |
MTT_CRS=my_cr_path:$MTT_CRS |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MTT_EXAMPLES=$MTTPATH/lib/examples |
MTT_EXAMPLES=my_examples_path:$MTT_EXAMPLES |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The $OCTAVE_PATH
path must include the relevant paths for
mtt to work properly. In particular, it must include:
$MTTPATH/trans/m $MTTPATH/lib/comp/simple $MTTPATH/lib/comp/compound |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mtt
is pointed to by $MTTPATH (see section 11.4.1 $MTTPATH).
m-files
associated
with the transformations.awk
scripts
associated with the transformations.m-files
defining the simple components. m-files
defining
the compound components.[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Copyright © 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. |
The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements."
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. |
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this:
with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. |
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Copyright © 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
one line to give the program's name and a brief idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. |
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice |
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | ' A B C D E F G I L M N O P R S T |
---|
Jump to: | ' A B C D E F G I L M N O P R S T |
---|
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | < A B C D E F G H I L M N O P Q R S T U V X |
---|
Jump to: | < A B C D E F G H I L M N O P Q R S T U V X |
---|
[Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
1.1 What is a representation?2. User interface
1.2 What is a transformation?
1.3 What is a bond graph?
1.4 Variables
1.5 Bonds
1.6 Components
1.6.1 Ports1.7 Algebraic loops
1.6.2 Constitutive relationship
1.6.3 Symbolic parameters
1.6.4 Numeric parameters
1.8 Switched systems
2.1 Menu-driven interface3. Creating Models
2.2 Command line interface
2.3 Options
2.4 Utilities
2.4.1 Help
2.4.1.1 help representations2.4.2 Copy
2.4.1.2 help components
2.4.1.3 help examples
2.4.1.4 help crs
2.4.1.5 help <name>
2.4.3 Clean
2.4.4 Version control
3.1 Quick start4. Simulation
3.2 Creating simple models
3.3 Creating complex models
3.3.1 Top level
4.1 Steady-state solutions5. Sensitivity models
4.1.1 Steady-state solutions (odess)4.2 Simulation parameters
4.1.2 Steady-state solutions (ss)
4.2.1 Euler integration4.3 Simulation input
4.2.2 Implicit integration
4.2.3 Runge Kutta IV integration
4.2.4 Hybrd algebraic solver
4.4 Simulation logic
4.5 Simulation initial state
4.6 Simulation code
4.6.1 Dynamically linked functions4.7 Simulation output
4.7.1 Viewing results with gnuplot
4.7.2 Exporting results to SciGraphica
6. Representations
6.1 Representation summary7. Extending MTT
6.2 Defining representations
6.3 Verbal description (desc)
6.4 Acausal bond graph (abg)
6.4.1 Language fig (abg.fig)6.5 Stripped acausal bond graph (sabg)
6.4.1.1 Icon library6.4.2 Language m (rbg.m)
6.4.1.2 Bonds
6.4.1.3 Strokes
6.4.1.4 Components
6.4.1.5 Simple components
6.4.1.6 SS components
6.4.1.7 Simple components - implementation
6.4.1.8 Compound components
6.4.1.9 Named SS components
6.4.1.10 Coerced bond direction
6.4.1.11 Port labels
6.4.1.12 Vector port labels
6.4.1.13 Port label defaults
6.4.1.14 Vector Components
6.4.1.15 Artwork
6.4.1.16 Valid Names
6.4.2.1 Transformation abg2rbg_fig2m6.4.3 Language m (abg.m)
6.4.3.1 Arrow-orientated causality6.4.4 Language tex (abg.tex)
6.4.3.2 Component-orientated causality
6.4.3.3 Transformation rbg2abg_m
6.5.1 Language fig (sabg.fig)6.6 Labels (lbl)
6.5.2 Stripped acausal bond graph (view)
6.6.1 SS component labels6.7 Structure (struc)
6.6.2 Other component labels
6.6.3 Component names
6.6.4 Component constitutive relationship
6.6.5 Component arguments
6.6.6 Parameter declarations
6.6.7 Units declarations
6.6.8 Interface Control Definition
6.6.9 Aliases
6.6.9.1 Port aliases6.6.10 Parameter passing
6.6.9.2 Parameter aliases
6.6.9.3 CR aliases
6.6.9.4 Component aliases
6.6.11 Old-style labels (lbl)
6.6.11.1 SS component labels (old-style)6.6.12 Language tex (desc.tex)
6.6.11.2 Other component labels (old-style)
6.6.11.3 Parameter passing (old-style)
6.7.1 Language txt (struc.txt)6.8 Constitutive relationship (cr)
6.7.2 Language tex (struc.tex)
6.7.3 Language tex (view)
6.8.1 Predefined constitutive relationships6.9 Parameters
6.8.1.1 lin6.8.2 DIY constitutive relationships
6.8.1.2 exotherm
6.8.3 Unresolved constitutive relationships
6.8.4 Unresolved constitutive relationships - Octave
6.8.5 Unresolved constitutive relationships - c++
6.9.1 Symbolic parameters (subs.r)6.10 Causal bond graph (cbg)
6.9.2 Symbolic parameters for simplification (simp.r)
6.9.3 Numeric parameters (numpar)
6.9.3.1 Text form (numpar.txt)
6.10.1 Language fig (cbg.fig)6.11 Elementary system equations (ese)
6.10.2 Language m (cbg.m)
6.10.2.1 Transformation abg2cbg_m
6.12 Differential-Algebraic Equations (dae)6.11.0.1 Transformation cbg2ese_m2r
6.12.1 Language reduce (dae.r)6.13 Constrained-state Equations (cse)
6.12.1.1 Transformation ese2dae_r6.12.2 Language m (dae.m)
6.12.2.1 Transformation dae_r2m
6.13.1 Language reduce (cse.r)6.14 Ordinary Differential Equations
6.13.1.1 Transformation dae2cse_r6.13.2 Language m (view)
6.14.1 Language reduce (ode.r)6.15 Descriptor matrices (dm)
6.14.1.1 Transformation cse2ode_r6.14.2 Language m (ode.m)
6.14.2.1 Transformation ode_r2m6.14.3 Language m (view)
6.15.1 Language reduce (dm.r)6.16 Report (rep)
6.15.2 Language m (dm.m)
6.16.1 Language text (rep.txt)
6.16.2 Language view
7.1 Makefiles8. Documentation
7.2 New (DIY) representations
7.2.1 Makefile7.3 Component library
7.2.2 Shell-script
7.2.3 Documentation
8.1 Manual9. Languages
8.2 On-line documentation
8.2.1 Brief on-line documentation
8.2.2 Detailed on-line documentation
9.1 Fig10. Language tools
9.2 m
9.3 Reduce
9.4 c
10.1 Views11. Administration
10.2 Xfig
10.3 Text editors
10.4 Octave
10.4.1 Octave control system toolbox (OCST)10.5 LaTeX
10.4.2 Creating GNU Octave .oct files
10.4.3 Creating Matlab .mex files
10.4.4 Embedding MTT models in Simulink
11.1 Software componentsA. Legal stuff
11.2 REDUCE setup
11.3 Octave setup
11.3.1 .octaverc11.4 Paths
11.3.2 .oct file dependencies
11.4.1 $MTTPATH11.5 File structure
11.4.2 $MTT_COMPONENTS
11.4.3 $MTT_CRS
11.4.4 $MTT_EXAMPLES
11.4.5 $OCTAVE_PATH
A.1 GNU Free Documentation LicenseGlossary
A.1.1 ADDENDUM: How to use this License for your documentsA.2 GNU GENERAL PUBLIC LICENSE
A.2.1 Preamble
A.2.2 Appendix: How to Apply These Terms to Your New Programs
Index
[Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
2. User interface
3. Creating Models
4. Simulation
5. Sensitivity models
6. Representations
7. Extending MTT
8. Documentation
9. Languages
10. Language tools
11. Administration
A. Legal stuff
Glossary
Index
[Top] | [Contents] | [Index] | [ ? ] |
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | beginning of this chapter or previous chapter | 1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next chapter | 2 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | concept index | |
[ ? ] | About | this page |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure: