Differences From Artifact [3829e4b168]:

To Artifact [10040b2307]:


10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

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



## Revision 1.35  1996/11/02 10:19:19  peterg
## Constitutive Relationship generation from lbl file
##
## Revision 1.34  1996/11/01 13:34:35  peterg
## -q (quiet) switch added
##
## Revision 1.33  1996/11/01 12:34:45  peterg







>
>
>







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.36  1996/11/03  21:19:02  peterg
# Recursice generation of Constitutive Relationship files.
#
## Revision 1.35  1996/11/02 10:19:19  peterg
## Constitutive Relationship generation from lbl file
##
## Revision 1.34  1996/11/01 13:34:35  peterg
## -q (quiet) switch added
##
## Revision 1.33  1996/11/01 12:34:45  peterg
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
		quiet=quiet ;;
	-l )
		level=$2; shift ;;
  esac
  shift
done

echo $level

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
  echo 'MTT (Model Transformation Tools) version 2.0++'
  echo 'This is free software with ABSOLUTELY NO WARRANTY.'
  echo 'Type `mtt warranty'\' 'for details.'
  echo
fi

if [ "$1" = "" ]; then
  echo 'Usage: mtt help'
  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
  exit
fi

if [ "$1" = "help" ]; then
  if [ "$2" = "" ]; then
    echo 'Usage: mtt help reps'
    echo '       mtt help comps'
    echo '       mtt help crs'
    echo '       mtt help reps <string>'
    echo '       mtt help comps <string>'
    echo '       mtt help crs <string>'
    echo '       mtt help <component or cr name>'
  else
    mtt_help $2 $3
  fi
  exit
fi

if [ "$1" = "hinfo" ] && [$2 = ""]; then
   echo Invoking $HTMLVIEW
   (cd $MTTPATH/doc; $HTMLVIEW ./mtt_toc.html)&
   exit







<
<

















>














<
<
<
<
<
<
<
<
<
|
<







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
		quiet=quiet ;;
	-l )
		level=$2; shift ;;
  esac
  shift
done



#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
  echo 'MTT (Model Transformation Tools) version 2.0++'
  echo 'This is free software with ABSOLUTELY NO WARRANTY.'
  echo 'Type `mtt warranty'\' 'for details.'
  echo
fi

if [ "$1" = "" ]; then
  echo 'Usage: mtt help'
  echo '       mtt info'
  echo '       mtt info topic'
  echo '       mtt manual'
  echo '       mtt warranty'
  echo '       mtt clean'
  echo '       mtt <system_name> clean'
  echo '       mtt copy <system_name> <path_name>'
  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
  exit
fi

if [ "$1" = "help" ]; then









  mtt_help $2 $3

  exit
fi

if [ "$1" = "hinfo" ] && [$2 = ""]; then
   echo Invoking $HTMLVIEW
   (cd $MTTPATH/doc; $HTMLVIEW ./mtt_toc.html)&
   exit
250
251
252
253
254
255
256



















257
258
259
260
261
262
263

# Invoke explicit requests for modification
if [ "$2" = "abg" ] && [ "$3" = "fig" ]; then
  echo Editing $1_$2.$3
  ($FIG $1_$2.$3; cp $1_abg.fig $1_$1_abg.fig) &
  exit
fi





















# Save up the argument list in a file; but only if argument has changed
ARGS=$4;
cat > $1_args.new <<EOF
$ARGS
EOF







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

# Invoke explicit requests for modification
if [ "$2" = "abg" ] && [ "$3" = "fig" ]; then
  echo Editing $1_$2.$3
  ($FIG $1_$2.$3; cp $1_abg.fig $1_$1_abg.fig) &
  exit
fi

# Copy systems from the library
if [ "$1" = "copy" ]; then
  # check that its not here already
  file_exists=`ls $2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo $2_abg.fig exists already - no action taken
    fi
  else
    path_name=$3
    if [ "$path_name" = "" ]; then
      path_name=$MTTPATH/examples
    fi
    echo Copying system $2 to here
    find $path_name -name "$2_*.*" -exec cp {} . \;
  fi
  exit
fi


# Save up the argument list in a file; but only if argument has changed
ARGS=$4;
cat > $1_args.new <<EOF
$ARGS
EOF
339
340
341
342
343
344
345







346
347
348
349
350
351
352

# This is the main mtt programme
 
gmake -s  -f -  $1_$2.$3 << EOF

# 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 empty files (with titles) if not already there
#REPRESENTATION lbl	label file (txt)







>
>
>
>
>
>
>







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370

# This is the main mtt programme
 
gmake -s  -f -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# If level>0, try and get subsystem files
ifneq ($level,"0")
$1_abg.fig:
	mtt -q copy $1 $MTTPATH/comp/compound
endif


# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m

#Create empty files (with titles) if not already there
#REPRESENTATION lbl	label file (txt)
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408










409
410
411
412
413
414
415
	lbl2cr_txt2r $1

	if [ "$level" = "0" ]; then \
	  mv $1_cr.r MTT_cr.r; \
	else \
	  echo >>  MTT_cr.r; \
	  echo "%% CRs for subsystem $1" >>  MTT_cr.r; \
	  cat $1_cr.r >> MTT_cr.r; \
	fi

	echo Creating subsystem cr files for system $1 ...; \
	sh $1_sub.sh "mtt -q -l $level+1 " ' cr r'; \
	echo Finished creating subsystem cr files for system $1; \

	if [ "$level" = "0" ]; then \
	  mv MTT_cr.r $1_cr.r; \
	  echo 'END;' >> $1_cr.r; \
	fi

#REPRESENTATION simp	simplification information (r)
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce comands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
        )> $1_simp.r

#REPRESENTATION numpar	numerical parameter declaration (m) 
$1_numpar.m: $1_sympar.r
	sympar2numpar_r2m $1

#REPRESENTATION params	numerical parameter setting (m)
 $1_params.m: 
	echo Creating $1_params.m
	( \
	echo "%% Parameter file for system $1 ($1_params.m)"; \
	echo "%% This file provides the system params for simulation:";\
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo; \
        )> $1_params.m











#REPRESENTATION input	input signal definition (m)
$1_input.m:
	echo Creating $1_input.m
	( \
	echo "function u = $1_input(t)"; \
	echo "%% Input file for system $1 ($1_input.m)"; \







|


<
|
|
















|











>
>
>
>
>
>
>
>
>
>







386
387
388
389
390
391
392
393
394
395

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
	lbl2cr_txt2r $1

	if [ "$level" = "0" ]; then \
	  mv $1_cr.r MTT_cr.r; \
	else \
	  echo >>  MTT_cr.r; \
	  echo "%% CRs for subsystem $1" >>  MTT_cr.r; \
	  cat $1_cr.r >> MTT_cr.r; rm -f $1_cr.r; \
	fi


	sh $1_sub.sh "mtt -q -l $level+1 " ' cr r'


	if [ "$level" = "0" ]; then \
	  mv MTT_cr.r $1_cr.r; \
	  echo 'END;' >> $1_cr.r; \
	fi

#REPRESENTATION simp	simplification information (r)
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce comands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
        )> $1_simp.r

#REPRESENTATION numpar	numerical parameter declaration (m) 
$1_numpar.m: $1_sympar.r $1_params.m
	sympar2numpar_r2m $1

#REPRESENTATION params	numerical parameter setting (m)
 $1_params.m: 
	echo Creating $1_params.m
	( \
	echo "%% Parameter file for system $1 ($1_params.m)"; \
	echo "%% This file provides the system params for simulation:";\
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo; \
        )> $1_params.m

#REPRESENTATION params	symbolic parameter setting (r)
 $1_params.r: 
	echo Creating $1_params.r
	( \
	echo "%% Parameter file for system $1 ($1_params.r)"; \
	echo "%% This file provides symbolic parameters for simplification";\
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
        )> $1_params.r

#REPRESENTATION input	input signal definition (m)
$1_input.m:
	echo Creating $1_input.m
	( \
	echo "function u = $1_input(t)"; \
	echo "%% Input file for system $1 ($1_input.m)"; \
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
	echo "u(1) = 1;"; \
        )> $1_input.m

#REPRESENTATION sspar	steady-state definition (r)
$1_sspar.r:
	echo Creating $1_sspar.r
	(\
	echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)" \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
	)> $1_sspar.r

#REPRESENTATION rep	report (txt)
#REPRESENTATION rep	report (tex)
#REPRESENTATION rep	report (view)







|







450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
	echo "u(1) = 1;"; \
        )> $1_input.m

#REPRESENTATION sspar	steady-state definition (r)
$1_sspar.r:
	echo Creating $1_sspar.r
	(\
	echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
	)> $1_sspar.r

#REPRESENTATION rep	report (txt)
#REPRESENTATION rep	report (tex)
#REPRESENTATION rep	report (view)
455
456
457
458
459
460
461
462
463


464
465
466
467
468
469
470
471
472
473
474
475
476
477

#Subsystem creation commands
$1_sub.sh: $1_cmp.m
	cmp2sub_m2sh $1

#REPRESENTATION sympar	symbolic parameters (r)
# Lbl to sympar conversion
$1_sympar.r: $1_lbl.txt
	lbl2sympar_txt2r $1



#REPRESENTATION abg	acausal bond graph (m)
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m $1_sub.sh
	echo Creating subsystem abg files for system $1 ...
	sh $1_sub.sh 'mtt -q ' ' abg m'
	echo Finished creating subsystem abg files for system $1
	rbg2abg_m $1


#REPRESENTATION cbg	causal bond graph (m)
#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1







|

>
>




<
|
<







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496

497

498
499
500
501
502
503
504

#Subsystem creation commands
$1_sub.sh: $1_cmp.m
	cmp2sub_m2sh $1

#REPRESENTATION sympar	symbolic parameters (r)
# Lbl to sympar conversion
$1_sympar.r: $1_lbl.txt $1_params.r
	lbl2sympar_txt2r $1
	# echo "IN \"$1_params.r\";" >> $1_sympar.r
	echo 'END;' >> $1_sympar.r

#REPRESENTATION abg	acausal bond graph (m)
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m $1_sub.sh

	sh $1_sub.sh "mtt -q -l $level+1 " ' abg m'

	rbg2abg_m $1


#REPRESENTATION cbg	causal bond graph (m)
#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
#REPRESENTATION cse	constrained-state equations (view)
#REPRESENTATION cse	constrained-state equations (ps)
#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

#REPRESENTATION ode	ordinary differential equations (r)
#REPRESENTATION ode	ordinary differential equations (m)
#REPRESENTATION ode	ordinary differential equations (tex)
#REPRESENTATION ode	ordinary differential equations (view)
#REPRESENTATION ode	ordinary differential equations (ps)







|







539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
#REPRESENTATION cse	constrained-state equations (view)
#REPRESENTATION cse	constrained-state equations (ps)
#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 $1_simp.r
	cse_r2tex $1; latex_tidy $1_cse.tex

#REPRESENTATION ode	ordinary differential equations (r)
#REPRESENTATION ode	ordinary differential equations (m)
#REPRESENTATION ode	ordinary differential equations (tex)
#REPRESENTATION ode	ordinary differential equations (view)
#REPRESENTATION ode	ordinary differential equations (ps)

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