Overview
Comment:Generates c files using include statements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 95b6c7dce0b016db39ea47645864e34840fdeeba10760ff0de74f052214cd873
User & Date: gawthrop@users.sourceforge.net on 1997-03-20 16:53:01
Other Links: branch diff | manifest | tags
Context
1997-03-20
17:48:50
Better _input.c file default. check-in: 28e47527b8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:53:01
Generates c files using include statements. check-in: 95b6c7dce0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:17:45
All variables are in lower case. check-in: 600d128f3b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [7a866c9a48] to [ad67216230].

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.60  1997/03/20  10:25:41  peterg
# Generates a compehensive default params file.
#
# Revision 1.59  1997/03/19  10:14:04  peterg
# Now produces a stripped acausal bond graph.
#
# Revision 1.58  1997/03/18  17:58:12  peterg
# Generates label files containing all variables in fig file.
# Generates sympar file for all levels in system.
# Generates txt version of sympar file.
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
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







-
+














-
+







  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 *_abg.ps *_args.* *_cr.r
  rm -f *_abg.m *_abg.ps *_args.* *_cr.r *_cr.txt
  rm -f *_sympar.r *_sympar.c *_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 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 
  rm -f $1_abg.m $1_abg.ps $1_args.* $1_cr.r $1_cr.txt
  rm -f $1_sympar.r $1_sympar.c $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 mtt_error.txt mtt_info.txt a.out 
468
469
470
471
472
473
474
475
476


477
478

479
480
481

482
483
484
485

486
487
488

489
490
491
492

493
494
495
496
497
498



499
500
501
502
503
504
505
506
471
472
473
474
475
476
477


478
479


480
481
482

483
484



485
486
487

488
489
490
491

492

493
494



495
496
497

498
499
500
501
502
503
504







-
-
+
+
-
-
+


-
+

-
-
-
+


-
+



-
+
-


-
-
-
+
+
+
-







	touch $1_args.m

#Create empty files (with titles) if not already there
#SUMMARY lbl	label file (txt)
$1_lbl.txt:
	abg2lbl_fig2txt $1

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_sub.sh
#SUMMARY cr	constitutive relationship for each subsystem (txt)
$1_cr.txt: $1_sub.sh
	echo Creating $1_cr.r
	lbl2cr_txt2r $1
	lbl2cr_txt2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_cr.r MTT_cr.r; \
	  mv $1_cr.txt MTT_cr.txt; \
	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; \
	  cat $1_cr.txt >> MTT_cr.txt; \
	fi
 
	sh $1_sub.sh "mtt -q -l $level+1 " ' cr r'
	sh $1_sub.sh "mtt -q -l $level+1 " ' cr txt'
 
 
	if [ "$level" = "0" ]; then \
	  mv MTT_cr.r $1_cr.r; \
	  sort -u MTT_cr.txt> $1_cr.txt; \
	  echo 'END;' >> $1_cr.r; \
	fi

# Temporary fix - just copy everything here
# ## $1_cr.r: $1_sub.sh
# ## 	echo Creating $1_cr.r
#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1
# ## 	cat $MTTPATH/lib/cr/r/*.cr > $1_cr.r

#SUMMARY sympar	symbolic parameters (txt)
# Lbl to sympar conversion
$1_sympar.txt: $1_sub.sh
	lbl2sympar_txt2txt $1
 
	if [ "$level" = "0" ]; then \
523
524
525
526
527
528
529
530
531
532
533
534
535
536





537
538
539
540
541
542
543
521
522
523
524
525
526
527




528
529
530
531
532
533
534
535
536
537
538
539
540
541
542







-
-
-
-



+
+
+
+
+







# ## 	echo 'END;' >> $1_sympar.r

#SUMMARY sympar	symbolic parameters (r)
$1_sympar.r: $1_sympar.txt
	sympar_txt2r $1

#SUMMARY sympar	symbolic parameters (c)
# r to c sympar conversion -- its part of the ode_r2c tool
#$1_sympar.c: $1_sympar.r
#	sympar_r2c $1

# txt to c sympar conversion
$1_sympar.c: $1_sympar.txt
	sympar_txt2c $1

#SUMMARY sympar	symbolic parameters (h)
# txt to ch (c header file) sympar conversion
$1_sympar.h: $1_sympar.txt
	sympar_txt2h $1

#SUMMARY 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; \
880
881
882
883
884
885
886
887



888
889
890
891
892
893
894
879
880
881
882
883
884
885

886
887
888
889
890
891
892
893
894
895







-
+
+
+







$1_odes.c: $1_ode.c $1_def.r $1_sympar.r
	ode2odes_r2c $1
ifeq ($computation,octave)
$1_odes.m: $1_ode.m $1_numpar.m $1_params.m $1_args.m $1_def.m $1_input.m
	ode2odes_m $1 '$ARGS'
endif
ifeq ($computation,c)
$1_odes.m: $1_odes.c $1_ode.c $1_numpar.c $1_odes.h $1_params.c $1_input.c
$1_odes.m: $1_odes.c $1_ode.c $1_numpar.c $1_odes.h\
         $1_sympar.c $1_sympar.h\
         $1_params.c $1_input.c
	echo Creating $1_odes.m
	echo Creating $1_odeso.m
	echo 'Compiling ...'
	gcc $1_odes.c $1_ode.c $1_numpar.c $1_params.c $1_input.c -lm
	echo 'Running  ...'; ./a.out; echo 'Done.'
endif
$1_odeso.m: $1_odes.m


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