Overview
Comment:Added -s switch to get mtt to search for (Bond Graph) switches
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c730c8ef17231414ce8f32228eeb4f9425cffc4f99e14be0ff2d065a277a9648
User & Date: gawthrop@users.sourceforge.net on 1997-05-13 16:58:02
Other Links: branch diff | manifest | tags
Context
1997-05-13
16:58:59
Initial revision check-in: 082b84d788 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:58:02
Added -s switch to get mtt to search for (Bond Graph) switches check-in: c730c8ef17 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-05-12
16:00:54
Removed itime again., check-in: 0e8d161965 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [be3a75cf54] to [038bda2a7a].

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.72  1997/05/06  13:54:21  peterg
# Changed gcc arguments for the ode simulation -- all files now included
# in the _odes.c file
#
# Revision 1.71  1997/05/03  15:50:18  peterg
# c functions not included in gcc arg list -- they are now included in
# the main prog.







>
>
>







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.73  1997/05/09 09:18:45  peterg
## Put ./ in front of a.out (again)
##
# Revision 1.72  1997/05/06  13:54:21  peterg
# Changed gcc arguments for the ode simulation -- all files now included
# in the _odes.c file
#
# Revision 1.71  1997/05/03  15:50:18  peterg
# c functions not included in gcc arg list -- they are now included in
# the main prog.
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
level=0

#Computation mode is octave by default
computation=octave

#By default, the dae and ode representations are different
dae_is_ode=0




#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-q )
		quiet=quiet ;;
	-c )
		computation=c ;;
	-o )
		dae_is_ode=1 ;;


	-l )
		level=$2; shift ;;


  esac
  shift
done

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo







>
>
>










>
>


>
>







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
level=0

#Computation mode is octave by default
computation=octave

#By default, the dae and ode representations are different
dae_is_ode=0

# By default, don't look for BG switches
switches=0

#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-q )
		quiet=quiet ;;
	-c )
		computation=c ;;
	-o )
		dae_is_ode=1 ;;
	-s )
		switches=1 ;;
	-l )
		level=$2; shift ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
359
360
361
362
363
364
365
366
367
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
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 *_abg.ps *_args.* *_cr.r *_cr.txt
  rm -f *_sabg.fig *_sabg.ps
  rm -f *_sympar.r *_sympar.c *_sympar.h *_sympar.txt
  rm -f *_rbg.* *_cmp.* *_fig.fig *_*cbg.* *_ese.* *_def.* 
  rm -f *_sub.sh *_type.sh
  rm -f *_dae*.* *_cse.* *_ode*.c *_ode*.m *_obs.* *_rfe.* *_ss.*

  rm -f *_dm.* *_csm.* *_sm.* *_tf.* *_sr*.* *_ir*.* *_*fr.*
  rm -f  *_numpar.m *_numpar.c


  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  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_abg.ps $1_args.* $1_cr.r $1_cr.txt
  rm -f $1_sabg.fig $1_sabg.ps
  rm -f $1_sympar.r $1_sympar.c $1_sympar.h $1_sympar.txt
  rm -f $1_rbg.* $1_cmp.* $1_fig.fig $1*_*cbg.* $1*_ese.* $1_def.* 
  rm -f $1_sub.sh $1_type.sh
  rm -f $1_dae*.* $1_cse.* $1_ode*.c $1_ode*.m $1_obs.* $1_rfe.* $1_ss.*
  rm -f $1_dm.* $1_csm.* $1_sm.* $1_tf.* $1_sr*.* $1_ir*.* $1_*fr.*
  rm -f $1_numpar.m $1_numpar.c


  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  exit
fi

#SUMMARY abg	acausal bond graph (fig)
#SUMMARY abg	acausal bond graph (ps)







|



|
>


>
>










|



|


>
>







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
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 *_abg.ps *_args.* *_cr.r *_cr.txt
  rm -f *_sabg.fig *_sabg.ps *_head.fig *_bnd.fig 
  rm -f *_sympar.r *_sympar.c *_sympar.h *_sympar.txt
  rm -f *_rbg.* *_cmp.* *_fig.fig *_*cbg.* *_ese.* *_def.* 
  rm -f *_sub.sh *_type.sh
  rm -f *_dae*.* *_cse.* *_ode.*
  rm -f *_obs.* *_rfe.* *_ss.*
  rm -f *_dm.* *_csm.* *_sm.* *_tf.* *_sr*.* *_ir*.* *_*fr.*
  rm -f  *_numpar.m *_numpar.c
  rm -f *_sm*.*
  rm -f *_struc.*
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  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_abg.ps $1_args.* $1_cr.r $1_cr.txt
  rm -f $1_sabg.fig $1_sabg.ps $1_head.fig $1_bnd.fig 
  rm -f $1_sympar.r $1_sympar.c $1_sympar.h $1_sympar.txt
  rm -f $1_rbg.* $1_cmp.* $1_fig.fig $1*_*cbg.* $1*_ese.* $1_def.* 
  rm -f $1_sub.sh $1_type.sh
  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_ir*.* $1_*fr.*
  rm -f $1_numpar.m $1_numpar.c
  rm -f $1_sm*.*
  rm -f $1_struc.*
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  exit
fi

#SUMMARY abg	acausal bond graph (fig)
#SUMMARY abg	acausal bond graph (ps)
574
575
576
577
578
579
580

581
582
583
584
585
586
587
588
589
590
591
592
593
594
595

























596
597
598
599
600
601
602

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1

#SUMMARY sympar	symbolic parameters (txt)
# Lbl to sympar conversion

$1_sympar.txt: $1_sub.sh
	lbl2sympar_txt2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_sympar.txt MTT_sympar.txt; \
	else \
	  cat $1_sympar.txt >> MTT_sympar.txt; \
	fi
 
	sh $1_sub.sh "rm -f " '_sympar.txt' # Delete sympar files
	sh $1_sub.sh "mtt -q -l $level+1 " ' sympar txt' # and recreate them
 
	if [ "$level" = "0" ]; then \
	  sort -u MTT_sympar.txt> $1_sympar.txt; \
	fi


























# ## Old version -- just looks on top level
# ## $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








>















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







589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1

#SUMMARY sympar	symbolic parameters (txt)
# Lbl to sympar conversion
ifeq ($switches,0)
$1_sympar.txt: $1_sub.sh
	lbl2sympar_txt2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_sympar.txt MTT_sympar.txt; \
	else \
	  cat $1_sympar.txt >> MTT_sympar.txt; \
	fi
 
	sh $1_sub.sh "rm -f " '_sympar.txt' # Delete sympar files
	sh $1_sub.sh "mtt -q -l $level+1 " ' sympar txt' # and recreate them
 
	if [ "$level" = "0" ]; then \
	  sort -u MTT_sympar.txt> $1_sympar.txt; \
	fi
endif
ifeq ($switches,1)
$1_sympar.txt: $1_sub.sh $1_struc.txt
	lbl2sympar_txt2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_sympar.txt MTT_sympar.txt; \
	else \
	  cat $1_sympar.txt >> MTT_sympar.txt; \
	fi
 
	sh $1_sub.sh "rm -f " '_sympar.txt' # Delete sympar files
	sh $1_sub.sh "mtt -q -l $level+1 " ' sympar txt' # and recreate them
 
	if [ "$level" = "0" ]; then \
	  sort -u MTT_sympar.txt> $1_sympar.txt1; \
	  struc2switch_txt $1; \
	  echo "Appending switch declarations"; \
	  cat $1_sympar.txt1 $1_switch.txt> $1_sympar.txt; \
	fi

$1_switch.c: $1_sub.sh
	struc2switch_txt2c $1
endif


# ## Old version -- just looks on top level
# ## $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

640
641
642
643
644
645
646

647
648







649
650
651
652
653
654
655
	mtt $1 struc txt; struc2input_txt2txt $1

#SUMMARY input	numerical input declaration (m) 
$1_input.m:  $1_input.txt $1_sympar.txt
	input_txt2m $1

#SUMMARY input	numerical input declaration (c) 

$1_input.c:  $1_input.txt $1_sympar.c
	input_txt2c $1









#SUMMARY odes ODE simulation header file (h)
 $1_odes.h: 
	echo Creating $1_odes.h
	( \
	echo '/*'; \







>


>
>
>
>
>
>
>







681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
	mtt $1 struc txt; struc2input_txt2txt $1

#SUMMARY input	numerical input declaration (m) 
$1_input.m:  $1_input.txt $1_sympar.txt
	input_txt2m $1

#SUMMARY input	numerical input declaration (c) 
ifeq ($switches,0)
$1_input.c:  $1_input.txt $1_sympar.c
	input_txt2c $1
endif

ifeq ($switches,1)
$1_input.c:  $1_input.txt $1_sympar.c
	input_txt2c -s $1
endif



#SUMMARY odes ODE simulation header file (h)
 $1_odes.h: 
	echo Creating $1_odes.h
	( \
	echo '/*'; \


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