Overview
Comment:Added option -no-reduce

Code sorting can now be used with Reduce (via sese.r) so that existing CRs
work with sorted code (using -make-sort or -sort), or without by using
-no-reduce; this option implies -make-sort.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 9c3c6b8bfc72ae46b93e174ed24986fe32cb6e44a5f247979ced081eee4672e4
User & Date: geraint@users.sourceforge.net on 2004-08-29 16:09:49
Other Links: branch diff | manifest | tags
Context
2004-08-29
17:25:46
Accept component types in upper or lower case. check-in: ceef333d87 user: geraint@users.sourceforge.net tags: origin/master, trunk
16:09:49
Added option -no-reduce

Code sorting can now be used with Reduce (via sese.r) so that existing CRs
work with sorted code (using -make-sort or -sort), or without by using
-no-reduce; this option implies -make-sort. check-in: 9c3c6b8bfc user: geraint@users.sourceforge.net tags: origin/master, trunk

16:04:44
Fixed ae for non-sorted code. check-in: d420d498e1 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [7fb8954f46] to [ff17076521].

13
14
15
16
17
18
19



20
21
22
23
24
25
26
# Copyright (C) 2001 by Peter J. Gawthrop

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



## Revision 1.397  2004/08/29 13:17:30  geraint
## Added rules to use sae (sorted algebraic equations) instead
## of ae if sorted equations are being used.
##
## Converted temporary variable names to lowercase in sorted
## sympar.h to match code output from mtt_r2m.
##







>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.398  2004/08/29 14:39:23  geraint
## Added rule to create dae from sorted equations (sese) if sorting is requested.
##
## Revision 1.397  2004/08/29 13:17:30  geraint
## Added rules to use sae (sorted algebraic equations) instead
## of ae if sorted equations are being used.
##
## Converted temporary variable names to lowercase in sorted
## sympar.h to match code output from mtt_r2m.
##
1410
1411
1412
1413
1414
1415
1416







1417
1418
1419
1420
1421
1422
1423
version='5.0'

# MTT recursion level is zero unless explicitly set
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, the ode and cse reps are different
ode_is_cse=0








>
>
>
>
>
>
>







1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
version='5.0'

# MTT recursion level is zero unless explicitly set
level=0

#Computation mode is octave by default
computation=octave

#By default, Reduce is used if available
if [ -n "$SYMBOLIC" ]; then
    use_reduce='yes'
else
    use_reduce='no'
fi

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

#By default, the ode and cse reps are different
ode_is_cse=0

1494
1495
1496
1497
1498
1499
1500










1501
1502
1503
1504
1505
1506
1507
                cr_first='-cr';;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-nocr )
                mtt_switches="$mtt_switches $1";
		rdae_is_dae=1 ;;










	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in
		    dassl)
			integration_method=dassl;
			mtt_switches="$mtt_switches dassl";







>
>
>
>
>
>
>
>
>
>







1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
                cr_first='-cr';;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-nocr )
                mtt_switches="$mtt_switches $1";
		rdae_is_dae=1 ;;
	-no-reduce )
                mtt_switches="$mtt_switches $1";
                use_reduce='no';
                do_sort='-sort';
                sort_method='make';
                rdae_is_dae=1 ;
                cr_first='-cr';
                Solve='';
                num_tmp_var=0 ;
                integration_method="euler" ;;
	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in
		    dassl)
			integration_method=dassl;
			mtt_switches="$mtt_switches dassl";
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
                sensitivity_switch='-s';
                mtt_switches="$mtt_switches $1";
		sensitivity=sensitivity ;;
	-make-sort )
		mtt_switches="$mtt_switches $1";
		do_sort='-sort';
		sort_method="make";
		num_tmp_var=0;
		integration_method="euler";;
	-sort )
                mtt_switches="$mtt_switches $1";
		do_sort='-sort';
		sort_method="seqn";
		integration_method="sorted_euler";;
	-ss )
                mtt_switches="$mtt_switches $1";







|
<







1574
1575
1576
1577
1578
1579
1580
1581

1582
1583
1584
1585
1586
1587
1588
                sensitivity_switch='-s';
                mtt_switches="$mtt_switches $1";
		sensitivity=sensitivity ;;
	-make-sort )
		mtt_switches="$mtt_switches $1";
		do_sort='-sort';
		sort_method="make";
		num_tmp_var=0 ;;

	-sort )
                mtt_switches="$mtt_switches $1";
		do_sort='-sort';
		sort_method="seqn";
		integration_method="sorted_euler";;
	-ss )
                mtt_switches="$mtt_switches $1";
1727
1728
1729
1730
1731
1732
1733

1734
1735
1736
1737
1738
1739
1740
1741
    echo '         -i <implicit|euler|rk4|dassl>   Use implicit, euler, rk4 or dassl integration'
    echo '         -ae <reduce|hybrd|dassl|hooke>   Solve algebraic equations with specified solver'
    echo '         -o ode is same as dae'
    echo '         -oct use oct files in place of m files where appropriate'
    echo '         -opt optimise code generation (equivalent to -optl)'
    echo '         -optl optimise code generation (local  : line-by-line)'
    echo '         -optg optimise code generation (global : full vector) (EXPERIMENTAL)'

    echo "         -ntmpvar <N>  declare N temporary variables (default=$num_tmp_var)"
    echo '         -p  print environment variables'
    echo '         -partition partition hierachical system'
    echo '         -pdf generate pdf in place of ps'
    echo '         -r  reset time stamp on representation'
    echo '         -s  generate sensitivity BG (use mtt -s sSys rep lang)'
    echo '         -make-sort use sorted equations (sese, generated by make) and Euler integration (EXPERIMENTAL)'
    echo '         -sort use sorted equations (sese, generated by seqn) and Euler integration (EXPERIMENTAL)'







>
|







1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
    echo '         -i <implicit|euler|rk4|dassl>   Use implicit, euler, rk4 or dassl integration'
    echo '         -ae <reduce|hybrd|dassl|hooke>   Solve algebraic equations with specified solver'
    echo '         -o ode is same as dae'
    echo '         -oct use oct files in place of m files where appropriate'
    echo '         -opt optimise code generation (equivalent to -optl)'
    echo '         -optl optimise code generation (local  : line-by-line)'
    echo '         -optg optimise code generation (global : full vector) (EXPERIMENTAL)'
    echo '         -no-reduce try not to use symbolic algebra (EXPERIMENTAL)'
    echo '         -ntmpvar <N>  declare N temporary variables (default=$num_tmp_var)'
    echo '         -p  print environment variables'
    echo '         -partition partition hierachical system'
    echo '         -pdf generate pdf in place of ps'
    echo '         -r  reset time stamp on representation'
    echo '         -s  generate sensitivity BG (use mtt -s sSys rep lang)'
    echo '         -make-sort use sorted equations (sese, generated by make) and Euler integration (EXPERIMENTAL)'
    echo '         -sort use sorted equations (sese, generated by seqn) and Euler integration (EXPERIMENTAL)'
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787

2788
2789
2790
2791
2792

2793
2794
2795
2796
2797
2798
2799
2800
2801
else
	mtt_update $1 logic
endif

# Dummy target
FORCE:

ifeq ($do_sort,)
$1_ode2odes_common_%.stamp: $1_ae.% $1_input.% $1_logic.% $1_numpar.% $1_simpar.% $1_state.%
	touch \$@
$1_ode2odes_common.o: $1_ae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o
	@echo "Creating $1_ode2odes_common.o"
	ar -cr \$@ \$^
else
$1_ode2odes_common_%.stamp: $1_sae.% $1_input.% $1_logic.% $1_numpar.% $1_simpar.% $1_state.%
	touch \$@
$1_ode2odes_common.o: $1_sae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o
	@echo "Creating $1_ode2odes_common.o"
	ar -cr \$@ \$^
endif

ifeq ($do_sort,)
$1_ode2odes_euler_%.stamp $1_ode2odes_rk4_%.stamp: $1_ode.% $1_odeo.%
	touch \$@
$1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_ode.o $1_odeo.o mtt_euler.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
else
$1_ode2odes_euler_%.stamp $1_ode2odes_rk4_%.stamp: $1_sesx.% $1_sesy.%
	touch \$@
$1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_sesx.o $1_sesy.o mtt_euler.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
endif


$1_ode2odes_implicit_%.stamp: $1_cseo.% $1_csex.% $1_smxa.% $1_smxax.%
	touch \$@
$1_ode2odes_implicit.o: $1_cseo.o $1_csex.o $1_smxa.o $1_smxax.o mtt_implicit.o
	@echo "Creating $1_ode2odes_implicit.o"
	ar -cr \$@ \$^


ifeq ($do_sort,)
$1_ode2odes_dassl_oct.stamp: $1_ode.oct $1_odeo.oct mtt_dassl.oct
	touch \$@
$1_ode2odes_dassl_o.stamp: $1_ode.o $1_odeo.o mtt_dassl.o
	touch \$@
$1_ode2odes_dassl_%.stamp: $1_ode.% $1_odeo.%
	touch \$@
$1_ode2odes_dassl.o: $1_ode.o $1_odeo.o mtt_dassl.o







|













|













>





>

|







2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
else
	mtt_update $1 logic
endif

# Dummy target
FORCE:

ifeq ($use_reduce,yes)
$1_ode2odes_common_%.stamp: $1_ae.% $1_input.% $1_logic.% $1_numpar.% $1_simpar.% $1_state.%
	touch \$@
$1_ode2odes_common.o: $1_ae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o
	@echo "Creating $1_ode2odes_common.o"
	ar -cr \$@ \$^
else
$1_ode2odes_common_%.stamp: $1_sae.% $1_input.% $1_logic.% $1_numpar.% $1_simpar.% $1_state.%
	touch \$@
$1_ode2odes_common.o: $1_sae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o
	@echo "Creating $1_ode2odes_common.o"
	ar -cr \$@ \$^
endif

ifeq ($use_reduce,yes)
$1_ode2odes_euler_%.stamp $1_ode2odes_rk4_%.stamp: $1_ode.% $1_odeo.%
	touch \$@
$1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_ode.o $1_odeo.o mtt_euler.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
else
$1_ode2odes_euler_%.stamp $1_ode2odes_rk4_%.stamp: $1_sesx.% $1_sesy.%
	touch \$@
$1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_sesx.o $1_sesy.o mtt_euler.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
endif

ifeq ($use_reduce,yes)
$1_ode2odes_implicit_%.stamp: $1_cseo.% $1_csex.% $1_smxa.% $1_smxax.%
	touch \$@
$1_ode2odes_implicit.o: $1_cseo.o $1_csex.o $1_smxa.o $1_smxax.o mtt_implicit.o
	@echo "Creating $1_ode2odes_implicit.o"
	ar -cr \$@ \$^
endif				# no alternative

ifeq ($use_reduce,yes)
$1_ode2odes_dassl_oct.stamp: $1_ode.oct $1_odeo.oct mtt_dassl.oct
	touch \$@
$1_ode2odes_dassl_o.stamp: $1_ode.o $1_odeo.o mtt_dassl.o
	touch \$@
$1_ode2odes_dassl_%.stamp: $1_ode.% $1_odeo.%
	touch \$@
$1_ode2odes_dassl.o: $1_ode.o $1_odeo.o mtt_dassl.o
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980

2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992




2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
#SUMMARY struc*	structure - list of inputs, outputs and states (txt)
#SUMMARY struc	structure - list of inputs, outputs and states (tex)
#SUMMARY struc*	structure - list of inputs, outputs and states (view)
#Elementary system equations + definitions
${sys}_ese.r: ${sys}_cbg.m
	   cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1

# sorted equations generated from seqn
${sys}_sese.m: ${sys}_def.r ${sys}_sese.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sese m
${sys}_sese.r: ${sys}_cbg.m ${sys}_struc.m
	echo Creating \$@
	cbg2sese_m2r $info_switch $Subsystem


# sorted equations generated by make
${sys}_sesx.m: ${sys}_def.r ${sys}_sesx.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sesx m
${sys}_sesy.m: ${sys}_def.r ${sys}_sesy.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sesy m
${sys}_sae.m: ${sys}_def.r ${sys}_sae.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sae m





${sys}_sesx.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTdX > \$@
${sys}_sesy.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTy > \$@
${sys}_sae.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTyz > \$@

${sys}_sese.make: ${sys}_ese.r
	echo Creating \$@
	ese_r2make.pl --sys=${sys} --outfile=\$@ --$debug


$1_def.r: $1_ese.r
	touch $1_def.r
$1_struc.txt: $1_ese.r
	touch $1_struc.txt
$1_aliased.txt: $1_ese.r
	touch $1_aliased.txt







|






>

|










>
>
>
>













|







2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
#SUMMARY struc*	structure - list of inputs, outputs and states (txt)
#SUMMARY struc	structure - list of inputs, outputs and states (tex)
#SUMMARY struc*	structure - list of inputs, outputs and states (view)
#Elementary system equations + definitions
${sys}_ese.r: ${sys}_cbg.m
	   cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1

ifeq ($sort_method,seqn)
${sys}_sese.m: ${sys}_def.r ${sys}_sese.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sese m
${sys}_sese.r: ${sys}_cbg.m ${sys}_struc.m
	echo Creating \$@
	cbg2sese_m2r $info_switch $Subsystem
endif

ifeq ($sort_method,make)
${sys}_sesx.m: ${sys}_def.r ${sys}_sesx.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sesx m
${sys}_sesy.m: ${sys}_def.r ${sys}_sesy.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sesy m
${sys}_sae.m: ${sys}_def.r ${sys}_sae.r ${sys}_sympar.txt
	echo Creating \$@
	mtt_r2m ${sys} sae m

${sys}_sese.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< all > \$@
	echo ";end;" >> \$@
${sys}_sesx.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTdX > \$@
${sys}_sesy.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTy > \$@
${sys}_sae.r: ${sys}_sese.make
	echo Creating \$@
	make -f \$< MTTyz > \$@

${sys}_sese.make: ${sys}_ese.r
	echo Creating \$@
	ese_r2make.pl --sys=${sys} --outfile=\$@ --$debug
endif

$1_def.r: $1_ese.r
	touch $1_def.r
$1_struc.txt: $1_ese.r
	touch $1_struc.txt
$1_aliased.txt: $1_ese.r
	touch $1_aliased.txt
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
endif
ifneq ($integration_method,implicit)
ifeq ($sort_method,seqn)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_sese.m $1_logic.m
else
ifeq ($sort_method,make)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_sesx.m $1_sesy.m $1_logic.m
else
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_ode.m $1_odeo.m  $1_logic.m







|







3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
endif
ifneq ($integration_method,implicit)
ifeq ($sort_method,seqn)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_sese.m $1_logic.m
else
ifeq ($use_reduce,no)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_sesx.m $1_sesy.m $1_logic.m
else
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_ode.m $1_odeo.m  $1_logic.m


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