︙ | | |
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
+
+
+
|
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.
###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.21 1996/08/22 12:19:51 peter
## Added various document viewers.
##
## Revision 1.20 1996/08/20 08:24:53 peter
## Now with version control.
##
## Revision 1.19 1996/08/19 15:33:22 peter
## Included new state matric (sm) rep.
## Generate step response (sr) from sm.
##
|
︙ | | |
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
|
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
|
+
-
+
-
+
-
+
|
echo 'MTT (Model Transformation Tools) version 2.0'
echo 'This is free software with ABSOLUTELY NO WARRANTY.'
echo 'Type `mtt warranty'\' 'for details.'
echo
if [ "$1" = "" ]; then
echo 'Usage: mtt help'
echo ' mtt hinfo'
echo ' mtt info'
echo ' mtt info topic'
echo ' mtt manual'
echo ' mtt warranty'
echo ' mtt clean'
echo ' mtt system_name clean'
echo ' mtt system_name representation vc'
echo ' mtt system_name representation language'
echo ' mtt system_name representation language parameters'
exit
fi
if [ "$1" = "info" ] && [ "$3" = "" ]; then
echo Invoking info
info -f $MTTPATH/../doc/mtt.info $2
info -f $MTTPATH/doc/mtt.info $2
exit
fi
if [ "$1" = "hinfo" ] && [$2 = ""]; then
echo Invoking $HTMLVIEW
(cd $MTTPATH/../doc; $HTMLVIEW ./mtt.html)&
(cd $MTTPATH/doc; $HTMLVIEW ./mtt.html)&
exit
fi
if [ "$1" = "manual" ] && [$2 = ""]; then
echo Invoking $DVIVIEW
$DVIVIEW $MTTPATH/../doc/mtt.dvi &
$DVIVIEW $MTTPATH/doc/mtt.dvi &
exit
fi
if [ "$1" = "warranty" ] && [$2 = ""]; then
cat << EOF
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995,1996 Peter J. Gawthrop
This is free software with ABSOLUTELY NO WARRANTY.
|
︙ | | |
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
|
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
|
-
+
-
+
|
exit
fi
# Clean up
if [ "$1" = "clean" ] && [ "$2" = "" ]; then
echo 'Removing all generated files for all systems'
rm -f *.log mtt_info.txt warning.txt
rm -f *_abg.m *_args.*
rm -f *_abg.m *_args.* *_sympar.r
rm -f *_rbg.* *_cmp.* *_fig.fig *_*cbg.* *_ese.* *_def.*
rm -f *_dae*.* *_cse.* *_ode*.* *_obs.* *_rfe.* *_ss.*
rm -f *_dm.* *_csm.* *_sm.* *_tf.* *_sr*.* *_*fr.*
rm -f *_rep.*
exit
fi
# Clean up named system
if [ "$2" = "clean" ] && [ "$3" = "" ]; then
echo 'Removing all generated files for system ' $1
rm -f *.log mtt_info.txt warning.txt
rm -f $1_abg.m $1_args.*
rm -f $1_abg.m $1_args.* $1_sympar.r
rm -f $1_rbg.* $1_cmp.* $1_fig.fig $1_*cbg.* $1_ese.* $1_def.*
rm -f $1_dae*.* $1_cse.* $1_ode*.* $1_obs.* $1_rfe.* $1_ss.*
rm -f $1_dm.* $1_csm.* $1_sm.* $1_tf.* $1_sr*.* $1_*fr.*
rm -f $1_rep.*
exit
fi
|
︙ | | |
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
-
-
-
|
VCext='fig' ;;
lbl )
VC='ok'
VCext='txt' ;;
cr)
VC='ok'
VCext='r' ;;
sympar )
VC='ok'
VCext='r' ;;
simp )
VC='ok'
VCext='r' ;;
numpar )
VC='ok'
VCext='m' ;;
input )
|
︙ | | |
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
-
+
+
-
+
+
+
+
-
+
|
# Cancel implicit rules I don't want
%.dvi: %.tex
# Create an arg file if it doesn't exist
$1_args.m:
touch $1_args.m
#Create acausal bond graph figure using xfig
$1_abg.fig:
$FIG $1_abg.fig
#Create empty files (with titles) if not already there
$1_lbl.txt:
echo Creating $1_lbl.txt
( \
echo "%% Label file for system $1 ($1_lbl.txt)"; \
cat $MTTPATH/m/rcs_header.txt; \
cat $MTTPATH/trans/m/rcs_header.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 for system $1 ($1_sympar.r)"; \
cat $MTTPATH/m/rcs_header.txt; \
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 an assignment statement here for each variable"; \
echo "%% For example: MTTVar(1,1) := r"; \
)> $1_sympar.r
$1_simp.r:
echo Creating $1_simp.r
( \
echo "%% Reduce comands to simplify output for system $1 ($1_simp.r)"; \
cat $MTTPATH/m/rcs_header.txt; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo 'END;'; \
)> $1_simp.r
$1_numpar.m: $1_sympar.r
mknumpar $1; matlab_tidy $1_numpar.m;
mv $1_numpar.m junk; cat $MTTPATH/m/rcs_header.txt junk>$1_numpar.m
mv $1_numpar.m junk; cat $MTTPATH/trans/m/rcs_header.txt junk>$1_numpar.m
$1_input.m:
echo Creating $1_input.m
( \
echo "function u = $1_input(t)"; \
echo "%% Input file for system $1 ($1_input.m)"; \
echo "%% This file provides the system input for simulation:";\
cat $MTTPATH/m/rcs_header.txt; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo; \
echo "% Set up system definitions"; \
echo "[nx,ny,nu,nz,nyz] = $1_def;"; \
echo "% Change the following lines as you wish"; \
echo "u = zeros(nu,1);"; \
echo "u(1) = 1;"; \
)> $1_input.m
$1_sspar.r:
echo Creating $1_sspar.r
(\
echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)" \
cat $MTTPATH/m/rcs_header.txt; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo 'END;'; \
)> $1_sspar.r
$1_rep.txt:
echo Creating $1_rep.txt
( \
echo "%% Outline report file for system $1 ($1_rep.txt)"; \
cat $MTTPATH/m/rcs_header.txt; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo "abg ps"; \
echo "lbl txt"; \
echo "cbg ps"; \
echo "dae tex"; \
)> $1_rep.txt
#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
rbg_fig2m $1
$1_cmp.m: $1_rbg.m
$1_fig.fig: $1_rbg.m
# Lbl to sympar conversion
$1_sympar.r: $1_lbl.txt
lbl2sympar_txt2r $1
#Bond graph conversions using matlab
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m
rbg2abg_m $1
#Causal bond graph: mfile to fig conversion
$1_cbg.fig: $1_cbg.m $1_rbg.m $1_fig.fig
cbg_m2fig $1
|
︙ | | |
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
-
+
|
$1_def.r: $1_ese.r
touch $1_def.r
$1_def.m: $1_def.r
def_r2m $1; matlab_tidy $1_def.m;
#Differential-algebraic equations
$1_dae.r: $1_ese.r $1_cr.r $1_sympar.r
$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; matlab_tidy $1_daeo.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
|
︙ | | |