Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | descendants | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3859bc701c8896883107189d76c8b9cc023b9b354fda8868b02843dced41a2b3
User & Date: gawthrop@users.sourceforge.net on 1996-08-04 17:29:42
Other Links: branch diff | manifest | tags
Context
1996-08-04
17:45:11
Initial revision check-in: a0d453e325 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:29:42
Initial revision check-in: 3859bc701c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/mtt version [d67af9928d].










































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt

# Usage: mtt system_name  representation_name
# E.g.: 
# 	mtt dc mtf
# converts dc to matlab transfer function form.
#
# P.J.Gawthrop Oct 1989, Dec 1989, 1990, 1991, Oct 1993, Dec 1993, Jan 1994, Dec 95
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
###############################################################


echo "     ###################################################"
echo "     ###### MTT (Model Transformation Tools) V2.0 ######"
echo "     ###################################################"

make  -s -f -  $1_$2.$3 << EOF

#Create PostScript version of abg fig file
$1_abg.ps: $1_abg.fig
	echo Creating $1_abg.ps
	fig2dev -Lps $1_abg.fig >$1_abg.ps

#Create PostScript version of cbg fig file
$1_cbg.ps: $1_cbg.fig
	echo Creating $1_cbg.ps
	fig2dev -Lps $1_cbg.fig >$1_cbg.ps

#Create empty files (with titles) if not already there
$1_lbl.txt:
	echo Creating $1_lbl.txt
	( \
	echo "%% Label file ($1_lbl.txt)"; \
	echo "%% Each line should be of one of the following forms:"; \
	echo "%	a comment (ie starting with %)"; \
	echo "%	Component-name	CR_name	arg1,arg2,..argn"; \
	echo "%	blank"; \
        )> $1_lbl.txt
$1_cr.r:
	makecr $1
$1_sympar.r:
	echo Creating $1_sympar.r
	( \
	echo "%% Symbolic parameter file ($1_sympar.r)"; \
	echo "%% Change the following line to reflect the number of variables"; \
	echo "MTTNVar := 0;"; \
	echo "IF MTTNVar>0 THEN MATRIX MTTVar(MTTNVar,1);"; \
 	echo "%% Add a statement here for each variable"; \
        )> $1_sympar.r
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce comands to simplify output ($1_simp.r)"; \
        )> $1_simp.r
$1_numpar.m:
	echo Creating $1_numpar.m
	( \
	echo "%% Numerical parameter file ($1_numpar.m)"; \
        )> $1_numpar.m
$1_sspar.r:
	echo Creating $1_sspar.r
	echo "%% Reduce steady-state parameter file ($1_sspar.r)" > $1_sspar.r

#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
	rbg_fig2m $1

#Bond graph conversions using matlab
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m
	rbg2abg_m $1

#Component file
$1_cmp.m: $1_rbg.m
	

#Causal bond graph: mfile to fig conversion
$1_cbg.fig: $1_cbg.m
	cbg_m2fig $1

#Causal bond graph: xfig display
#$1_cbg.view: $1_cbg.fig
#	echo "Creating view of $1_cbg"; xfig $1_cbg.fig &


#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1

#LaTex system summary
$1_sum.tex: $1_abg.pl
	abg2sum_pl2tex $1; latex_tidy $1_sum.tex

#Elementary system equations + definitions
$1_ese.r: $1_cbg.m
	   cbg2ese_m2r $1
 
$1_def.r: $1_ese.r

#Differential-algebraic equations
$1_dae.r:	$1_ese.r $1_cr.r $1_sympar.r
	ese2dae_r $1; tidy $1_dae.r
$1_dae.m: $1_def.r $1_dae.r  $1_sympar.r
	dae_r2m $1; matlab_tidy $1_dae.m
$1_dae.c: $1_def.r $1_dae.r  $1_sympar.r
	dae_r2c $1; c_tidy $1_dae.c
$1_dae.tex:	$1_dae.r $1_simp.r
	dae_r2tex $1; latex_tidy $1_dae.tex

#Constrained-state equations
$1_cse.r: $1_dae.r $1_def.r $1_sympar.r
	dae2cse_r $1; tidy $1_cse.r
$1_cse.m: $1_def.r $1_cse.r $1_sympar.r
	cse_r2m $1; matlab_tidy $1_cse.m
$1_cse.tex: $1_cse.r  $1_sympar.r
	cse_r2tex $1; latex_tidy $1_cse.tex

#Ordinary differential equations
$1_ode.r: $1_cse.r $1_def.r $1_sympar.r
	cse2ode_r $1; tidy $1_ode.r
$1_ode.m: $1_def.r $1_ode.r $1_sympar.r
	ode_r2m $1; matlab_tidy $1_ode.m
$1_ode.tex: $1_ode.r  $1_sympar.r $1_simp.r
	ode_r2tex $1; latex_tidy $1_ode.tex

#Observer functions for GPC
$1_obs.r: $1_ode.r $1_def.r $1_sympar.r
	ode2obs_r $1; tidy $1_obs.r
$1_obs.m: $1_def.r $1_obs.r $1_sympar.r
	obs_r2m $1; matlab_tidy $1_obs.m
$1_obs.tex: $1_obs.r  $1_sympar.r $1_simp.r
	obs_r2tex $1; latex_tidy $1_obs.tex


#Robot-form equations
$1_rfe.r: $1_cse.r $1_csm.r $1_def.r $1_sympar.r
	cse2rfe_r $1; tidy $1_rfe.r
$1_rfe.tex: $1_rfe.r  $1_sympar.r
	rfe_r2tex $1; latex_tidy $1_rfe.tex

#Steady-states
$1_ss.r: $1_def.r $1_sspar.r $1_sympar.r $1_cr.r $1_dae.r
	sspar2ss_r $1; tidy $1_ss.r
$1_ss.m: $1_def.r $1_sympar.r $1_ss.r 
	ss_r2m $1; matlab_tidy $1_ss.m
$1_ss.tex: $1_def.r $1_ss.r  $1_sympar.r $1_simp.r
	ss_r2tex $1; latex_tidy $1_ss.tex 


#Linearised system: descriptor matrices
$1_dm.r: $1_dae.r $1_def.r $1_cr.r  $1_ss.r $1_sympar.r
	dae2dm_r $1; tidy $1_dm.r
$1_dm.m: $1_def.r $1_dm.r $1_sympar.r
		dm_r2m $1; matlab_tidy $1_dm.m
$1_dm.tex: $1_dm.r $1_sympar.r $1_simp.r 
	dm_r2tex $1; latex_tidy $1_dm.tex


#Linearised system: constrained-state matrices
$1_csm.r: $1_cse.r $1_def.r $1_cr.r $1_ss.r $1_sympar.r
	cse2csm_r $1; tidy $1_csm.r
$1_csm.m: $1_def.r $1_csm.r
		csm_r2m $1;  matlab_tidy $1_csm.m
$1_csm.tex: $1_csm.r  $1_sympar.r $1_simp.r
	csm_r2tex $1; latex_tidy $1_csm.tex

#Linearised system: transfer function
$1_tf.r: $1_dm.r $1_sympar.r 
	dm2tf_r $1; tidy $1_tf.r
$1_tf.m: $1_def.r $1_tf.r
	tf_r2m $1; matlab_tidy $1_tf.m
$1_tf.tex: $1_def.r $1_tf.r $1_sympar.r $1_simp.r
	tf_r2tex $1; latex_tidy $1_tf.tex


#Partially-known system indentification structure matrices
$1_pkim.r: $1_tf.r $1_sympar.r 
	tf2pkim_r $1; tidy $1_pki.r
$1_pkim.tex: $1_def.r $1_pkim.r $1_sympar.r
	pkim_r2tex $1; latex_tidy $1_pkim.tex


#Generic conversion of Latex to visual image
$1_$2.view: $1_$2.tex
	echo Creating view of $1_$2 
	showtex $1 $2>$1_$2_view.log


#Report generation


$1_rep.tex: $1_sum.tex $1_dae.tex $1_lbl.txt $1_sympar.r $1_cr.r \
            $1_abg.ps
	echo Creating $1_rep.tex 
	make_report $1 > $1_rep.tex


$1_rep.dvi: $1_rep.tex 	
	echo Creating $1_rep.dvi 
	latex $1_rep; latex $1_rep

$1_rep.ps: $1_rep.dvi
	echo Creating $1_rep.ps 
	dvips -o $1_rep.ps $1_rep

$1_rep.html: $1_rep.dvi
	echo Creating $1_rep.html 
	latex2html $1_rep.tex

# Clean up all intermediate files
$1_clean.: 
	echo Cleaning up system $1
	rm -f  *.log *.old *.met *.dvi *.aux *.f2bd
	rm -f  $1_abg.pl $1_cbg.pl  $1_ese.r $1_def.r \
	$1_tf.r  \
	$1_dae.r \
	$1_cse.r $1_dm.r $1_csm.r \
	$1_*_rep.tex \
        $1_rbg.m $1_abg.m $1_cbg.m $1_cbg.fig $1_cbg?.fig

EOF


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