Overview
Comment:Added rule to create dae from sorted equations (sese) if sorting is requested.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1b03b6423eaf37700393666c30d6a4ed8dd4136f746101d6e667f52b1d233c4e
User & Date: geraint@users.sourceforge.net on 2004-08-29 14:39:23
Other Links: branch diff | manifest | tags
Context
2004-08-29
16:04:44
Fixed ae for non-sorted code. check-in: 0fae1be0b9 user: geraint@users.sourceforge.net tags: origin/master, trunk
14:39:23
Added rule to create dae from sorted equations (sese) if sorting is requested. check-in: 1b03b6423e user: geraint@users.sourceforge.net tags: origin/master, trunk
14:38:21
Added -sort option to use sorted equation (sese.r) instead of ese.r check-in: 06fb453a1a user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

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

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.396  2004/08/29 02:59:30  geraint
## Added -make-sort option and rules to generate simulation using sesx and sesy.
##
## Revision 1.395  2004/08/28 23:48:06  geraint
## Removed dependency of ae.r on cse.r if -ae is not specified as an option.
## This prevents an implicit -A and thus removes a dependency on cse
## (and hence Reduce) for sorted systems.







>
>
>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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.
##
## Revision 1.396  2004/08/29 02:59:30  geraint
## Added -make-sort option and rules to generate simulation using sesx and sesy.
##
## Revision 1.395  2004/08/28 23:48:06  geraint
## Removed dependency of ae.r on cse.r if -ae is not specified as an option.
## This prevents an implicit -A and thus removes a dependency on cse
## (and hence Reduce) for sorted systems.
1444
1445
1446
1447
1448
1449
1450
1451

1452
1453
1454
1455
1456
1457
1458
eps=eps
psview=$PSVIEW

# Default declare 500 temporary variables
num_tmp_var=500

# Default no equation sorting
use_sorted_equations=''


#Initialise list of switches
mtt_switches='';

#Initialise read dirs
read_dirs=''








|
>







1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
eps=eps
psview=$PSVIEW

# Default declare 500 temporary variables
num_tmp_var=500

# Default no equation sorting
do_sort=''
sort_method=''

#Initialise list of switches
mtt_switches='';

#Initialise read dirs
read_dirs=''

1544
1545
1546
1547
1548
1549
1550

1551
1552
1553
1554
1555

1556
1557
1558
1559
1560
1561
1562
1563
	        esac;;
	-s )
                sensitivity_switch='-s';
                mtt_switches="$mtt_switches $1";
		sensitivity=sensitivity ;;
	-make-sort )
		mtt_switches="$mtt_switches $1";

		use_sorted_equations="make";
		num_tmp_var=0;
		integration_method="euler";;
	-sort )
                mtt_switches="$mtt_switches $1";

		use_sorted_equations="seqn";
		integration_method="sorted_euler";;
	-ss )
                mtt_switches="$mtt_switches $1";
		steadystate_computation=yes ;;
	-d )
		directory=$2; cd $directory; shift ;;
	-dc )







>
|




>
|







1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
	        esac;;
	-s )
                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";
		steadystate_computation=yes ;;
	-d )
		directory=$2; cd $directory; shift ;;
	-dc )
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
	mtt_make_sympar $1

#SUMMARY sympar	symbolic parameters (r)
$1_sympar.r: $1_sympar.txt
	sympar_txt2r $1
$1_sympar.m: $1_sympar.txt
	sympar_txt2m $1
ifneq ($use_sorted_equations,make)
$1_sympar.h: $1_sympar.txt
	sympar_txt2h.sh $1 $num_tmp_var
else
$1_sympar.h: $1_sympar.txt $1_sese.make
	sympar_txt2h.sh $1 $num_tmp_var
	declaration="static double" \
	make -f $1_sese.make declare_tmpvars |\







|







2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
	mtt_make_sympar $1

#SUMMARY sympar	symbolic parameters (r)
$1_sympar.r: $1_sympar.txt
	sympar_txt2r $1
$1_sympar.m: $1_sympar.txt
	sympar_txt2m $1
ifneq ($sort_method,make)
$1_sympar.h: $1_sympar.txt
	sympar_txt2h.sh $1 $num_tmp_var
else
$1_sympar.h: $1_sympar.txt $1_sese.make
	sympar_txt2h.sh $1 $num_tmp_var
	declaration="static double" \
	make -f $1_sese.make declare_tmpvars |\
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
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
else
	mtt_update $1 logic
endif

# Dummy target
FORCE:

ifeq ($use_sorted_equations,)
$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_sorted_equations,)
$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 ($use_sorted_equations,)
$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







|













|



















|







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
3014
3015
3016
3017
3018
3019
3020

3021



3022
3023
3024
3025
3026
3027

3028
3029
3030
3031
3032
3033
3034
#SUMMARY dae	differential-algebraic equations (r)
#SUMMARY dae*	differential-algebraic equations (m)
#SUMMARY dae	differential-algebraic equations (tex)
#SUMMARY dae*	differential-algebraic equations (view)
#SUMMARY dae	differential-algebraic equations (ps)
#Differential-algebraic equations


${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r



ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} rdae r
endif
	mtt_prepend.sh -p $1_modpar.r $1_ese.r # Add modulated parameters to start
	ese2rdae_r ${cr_first} ${fixcc} ${Subsystem}; tidy ${Subsystem}_rdae.r


${sys}_dae.r: ${Subsystem}_rdae.r ${Subsystem}_def.r ${Subsystem}_subs.r ${Subsystem}_cr.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} dae r
endif
ifeq ($rdae_is_dae,1)







>

>
>
>





|
>







3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
#SUMMARY dae	differential-algebraic equations (r)
#SUMMARY dae*	differential-algebraic equations (m)
#SUMMARY dae	differential-algebraic equations (tex)
#SUMMARY dae*	differential-algebraic equations (view)
#SUMMARY dae	differential-algebraic equations (ps)
#Differential-algebraic equations

ifeq ($do_sort,)
${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r
else
${sys}_rdae.r: ${sys}_sese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r
endif
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} rdae r
endif
	mtt_prepend.sh -p $1_modpar.r $1_ese.r # Add modulated parameters to start
	ese2rdae_r ${cr_first} ${fixcc} ${do_sort} ${Subsystem}
	tidy ${Subsystem}_rdae.r

${sys}_dae.r: ${Subsystem}_rdae.r ${Subsystem}_def.r ${Subsystem}_subs.r ${Subsystem}_cr.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} dae r
endif
ifeq ($rdae_is_dae,1)
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
                $1_smxa.m $1_smxax.m\
                $1_simpar.m $1_numpar.m $1_state.m $1_input.m \
                $1_csex.m $1_cseo.m  $1_logic.m
ifeq ($using_oct,yes)
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver $use_sorted_equations
endif
endif
ifneq ($integration_method,implicit)
ifeq ($use_sorted_equations,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_sorted_equations,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
endif
endif
ifeq ($using_oct,yes)
	echo "*** Warning: Shouldn't be here! Creating dummy $1_ode2odes.m"
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver $use_sorted_equations
endif
endif

#SUMMARY ode2odes Simulation function (m)
#SUMMARY ode2odes Simulation function (cc)
#SUMMARY ode2odes Simulation function (oct)
#SUMMARY ode2odes Simulation function (exe)







|



|




|














|







3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
                $1_smxa.m $1_smxax.m\
                $1_simpar.m $1_numpar.m $1_state.m $1_input.m \
                $1_csex.m $1_cseo.m  $1_logic.m
ifeq ($using_oct,yes)
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver $sort_method
endif
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
endif
endif
ifeq ($using_oct,yes)
	echo "*** Warning: Shouldn't be here! Creating dummy $1_ode2odes.m"
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver $sort_method
endif
endif

#SUMMARY ode2odes Simulation function (m)
#SUMMARY ode2odes Simulation function (cc)
#SUMMARY ode2odes Simulation function (oct)
#SUMMARY ode2odes Simulation function (exe)
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
	${MTT_LIB}/cc/mtt_kpathsea.cc ${MTT_LIB}/cc/mtt_matlab_octave.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common_m.stamp $1_ode2odes_common_cc.stamp\
		$1_ode2odes_${integration_method}_m.stamp $1_ode2odes_${integration_method}_cc.stamp\
		mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver $use_sorted_equations

#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 
#SUMMARY state	state declaration (p) 
$1_simpar.p : $1_def.r $1_simpar.m







|







3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
	${MTT_LIB}/cc/mtt_kpathsea.cc ${MTT_LIB}/cc/mtt_matlab_octave.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common_m.stamp $1_ode2odes_common_cc.stamp\
		$1_ode2odes_${integration_method}_m.stamp $1_ode2odes_${integration_method}_cc.stamp\
		mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver $sort_method

#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 
#SUMMARY state	state declaration (p) 
$1_simpar.p : $1_def.r $1_simpar.m


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