︙ | | |
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
27
|
+
+
+
+
|
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997,1998,1999
###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.213 1999/09/02 23:24:40 peterg
## Now explicitly generates executable _ode2odes.out file
## Which takes command line arguments
##
## Revision 1.212 1999/08/18 06:20:32 peterg
## Put -u back again .....
##
## Revision 1.211 1999/08/17 04:10:38 peterg
## Removed the -u switch from cp - it doesnt work on non GNU cps
##
## Revision 1.210 1999/08/02 12:52:12 peterg
|
︙ | | |
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
|
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
|
-
+
+
+
|
###############################################################
#Check $MTTPATH has been set
mtt_check_var "$MTTPATH" "MTTPATH"
#Version
version='3.8++'
version='4.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
# By default, don't look for BG switches
switches=0
#By default, don't print the environment variables
print='';
|
︙ | | |
764
765
766
767
768
769
770
771
772
773
774
775
776
777
|
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
|
+
+
+
|
print='-p';;
-c )
mtt_switches="$mtt_switches $1";
computation=c ;;
-o )
mtt_switches="$mtt_switches $1";
dae_is_ode=1 ;;
-cse )
mtt_switches="$mtt_switches $1";
ode_is_cse=1 ;;
-ss )
mtt_switches="$mtt_switches $1";
steadystate_computation=yes ;;
-d )
directory=$2; cd $directory; shift ;;
-dc )
mtt_switches="$mtt_switches $1";
|
︙ | | |
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
|
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
|
-
+
|
-A )
mtt_switches="$mtt_switches $1";
Solve='-A';;
-abg )
mtt_switches="$mtt_switches $1";
start_at_abg='yes';;
--version)
echo 'MTT (Model Transformation Tools) version' $version; exit;;
echo 'MTT version' $version; exit;;
--versions)
mtt_versions; exit;;
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
shift
done
|
︙ | | |
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
|
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
-
+
+
-
+
+
|
echo Using directory $directory
echo
fi
fi
#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
echo Starting mtt $mtt_switches $1 $2 $3 $4
echo Starting mtt $mtt_switches $1 $2 $3 $4 at level $level
echo " " current wd $PWD
fi
#Check the principle paths
mtt_check_vars $print
# Exit if just printing paths
if [ "$print" != "" ]; then
exit
fi
if [ -z "$1" ]; then
if [ -z "$print" ]; then
echo 'Usage: mtt help -- mtt on-line help'
echo ' mtt find component -- find location of a compound component'
echo ' mtt info -- info-based manual'
echo ' mtt info topic'
echo ' mtt hinfo -- hypertext manual'
echo ' mtt manual -- pdf manual'
echo ' mtt manual -- ps manual'
echo ' mtt warranty'
echo ' mtt clean -- cleans up intermediate files'
echo ' mtt rclean -- recursively cleans up intermediate files'
echo ' mtt Clean -- cleans up all generated files'
echo ' mtt <system_name> clean'
echo ' mtt copy <system_name> <path_name>'
echo ' mtt rename <old_name> <new_name>'
echo ' mtt <system_name> <representation> vc'
echo ' mtt <system_name> <representation> <language>'
echo ' mtt <system_name> <representation> <language> <parameters>'
echo 'Options: -q quiet mode -- suppress MTT banner'
echo ' -A solve algebraic equations symbolically'
echo ' -D debug -- leave log files etc'
echo ' -I prints more information'
echo ' -abg start at abg.m representation'
echo ' -c c-code generation'
echo ' -d <dir> use directory <dir>'
echo ' -dc Maximise derivative (not integral) causality'
echo ' -o ode and dae are the same'
echo ' -cse ode is computed in cse form'
echo ' -p print environment variables'
echo ' -ss use steady-state info to initialise simulations'
echo ' -t tidy mode (default)'
echo ' -u untidy mode (leaves files in current dir)'
echo ' -v verbose mode'
echo ' --version print version and exit'
echo ' --versions print version of mtt and components and exit'
|
︙ | | |
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
|
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
|
-
-
-
+
+
+
|
echo Invoking $HTMLVIEW
mtt_check_var "$HTMLVIEW" HTMLVIEW
(cd $MTTPATH/doc; $HTMLVIEW ./mtt_toc.html)&
exit
fi
if [ "$1" = "manual" ] && [$2 = ""]; then
mtt_check_var "$PDFVIEW" PDFVIEW
echo Invoking $PDFVIEW
$PDFVIEW $MTTPATH/doc/mtt.PDF &
mtt_check_var "$PSVIEW" PSVIEW
echo Invoking $PSVIEW
$PSVIEW $MTTPATH/doc/mtt.ps &
exit
fi
if [ $1 = "find" ]&& [$3 = ""]; then
mtt_find $MTT_COMPONENTS $2
find_status=$?
if [ $find_status = "1" ]; then
|
︙ | | |
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
-
+
|
echo $1_abg.m does not exist
exit
fi
fi
# Clean up
if [ "$1" = "clean" ]; then
echo 'Removing intermediate files'
echo Removing intermediate files in `pwd`
rm -fr MTT_work
exit
fi
# Recursively clean up
if [ "$1" = "rclean" ]; then
echo 'Removing intermediate files recursively'
|
︙ | | |
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
|
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
|
-
+
+
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
|
if [ -n "$DIFF" ]; then
mv $1_args.new $1_args.m
fi
# Tidy mode - operate in the directory MTT-work
if [ "$tidy" = "tidy" ]; then
mkdir -p MTT_work
cp -p -u Makefile *.* .* MTT_work # 2>/dev/null
cp -p -u Makefile *.* .* MTT_work 2>/dev/null
cd MTT_work
if [ -z "$directory" ]; then
Directory=''
else
Directory=$directory/MTT_work
fi
mtt -u -q $mtt_switches -S "$Directory" $1 $2 $3 $4
mtt_status=$?
# Exit on failure
if [ "$mtt_status" != "0" ]; then
echo Exiting MTT with error $mtt_status
exit 1
fi
# Copy back form working directory
if [ "$3" != "view" ]; then
if [ "$3" != "hview" ]; then
if [ "$3" = "html" ]; then
echo Moving $1_$2
mv $1_$2 ..
else
echo Copying $1_$2.$3
cp -p -u $1_$2.$3 ..
fi
if [ "$PLOTTYPE" = "multiple" ]; then
echo Copying $1_$2$__ARGS.ps
cp $1_$2$__ARGS.ps ..
fi
fi
fi
# Remove the MTT_work directory if very tidy
if [ "$verytidy" = "verytidy" ]; then
echo Removing all working files
rm -rf ../MTT_work
fi
exit
fi
# User defined representations
if [ -f "$2_rep.make" ]; then
if [ -n "$4" ]; then
filename=$1_$2-$4.$3
else
filename=$1_$2.$3
fi
if [ -f "$filename" ]; then
echo $filename exists
else
echo make -f $2_rep.make "SYS=$1" "LANG=$3"
make -f $2_rep.make "SYS=$1" "LANG=$3"
echo make -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4"
make -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$"
if [ -n "$4" ]; then
echo Copying $1_$2_$4.ps
cp $1_$2_$4.ps ..
fi
fi
exit
fi
################################
# This is the main mtt programme
################################
|
︙ | | |
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
|
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
|
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
|
#SUMMARY cse constrained-state equations (r)
#SUMMARY cse* constrained-state equations (m)
#SUMMARY cse constrained-state equations (tex)
#SUMMARY cse* constrained-state equations (view)
#SUMMARY cse constrained-state equations (ps)
#Constrained-state equations
$1_cse.r: $1_dae.r $1_def.r $1_sympar.r
$1_cse.r: $1_dae.r $1_def.r $1_sympar.r $1_subs.r
dae2cse_r $Solve $1; tidy $1_cse.r $1_subs.r
$1_cse.m: $1_def.r $1_cse.r $1_sympar.r
$1_cse.m: $1_def.r $1_cse.r $1_sympar.r $1_subs.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
#SUMMARY ode ordinary differential equations (r)
#SUMMARY ode* ordinary differential equations (m)
#SUMMARY ode ordinary differential equations (c)
#SUMMARY ode ordinary differential equations (tex)
#SUMMARY ode* ordinary differential equations (view)
#SUMMARY ode ordinary differential equations (ps)
#Ordinary differential equations
ifeq ($dae_is_ode,0)
$1_ode.r: $1_cse.r $1_def.r $1_sympar.r $1_subs.r
cse2ode_r $1; tidy $1_ode.r
endif
ifeq ($dae_is_ode,1)
$1_ode.r: $1_dae.r
echo Copying $1_dae.r to $1_ode.r
cp $1_dae.r $1_ode.r
endif
ifeq ($ode_is_cse,1)
$1_ode.m: $1_def.m $1_cse.r $1_sympars.txt
mtt_r2m $1 cse; matlab_tidy $1_cse.m;
cp -v $1_cse.m $1_ode.m;
cp -v $1_cseo.m $1_odeo.m;
endif
ifeq ($ode_is_cse,0)
$1_ode.m: $1_def.m $1_ode.r $1_sympars.txt
mtt_r2m $1 ode m; matlab_tidy $1_ode.m
endif
$1_odea.m: $1_ode.m
touch $1_odea.m
$1_odeo.m: $1_ode.m
touch $1_odeo.m
#$1_ode.c: $1_def.r $1_ode.r $1_sympar.r $1_sympar.c
# ode_r2c $1
$1_ode.tex: $1_ode.r $1_sympar.r $1_simp.r
|
︙ | | |
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
|
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
|
-
+
|
mtt_m2p $1_ode.m
$1_odeo.p : $1_def.r $1_odeo.m
mtt_m2p $1_odeo.m
$1_smx.p : $1_def.r $1_smx.m
mtt_m2p $1_smx.m
$1_switchopen.p : $1_def.r $1_switchopen.m
mtt_m2p $1_switchopen.m
$1_ode2odes.p : $1_ode2odes.m $1_def.r\
$1_ode2odes.p : $1_ode2odes.m $1_def.r $1_smx.p\
$1_simpar.p $1_numpar.p $1_state.p $1_input.p \
$1_ode.p $1_odeo.p $1_switchopen.p
mtt_m2p $1_ode2odes.m
$1_ode2odes.c: $1_ode2odes.p
mtt_p2c $info_switch $1 ode2odes
|
︙ | | |
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
|
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
|
-
-
+
+
|
#SUMMARY smx state matrices with variable state x (r)
#SUMMARY smx state matrices with variable state x (m)
#SUMMARY smxx Sparse computation of Ax (m)
#SUMMARY smxtx Sparse computation of ATx (m)
$1_smx.r: $1_def.r $1_def.m $1_ode.r $1_subs.r
ode2smx_lang $1 r; tidy $1_smx.r
$1_smx.m: $1_def.r $1_def.m $1_ode.r $1_sympars.txt
ode2smx_lang $1 m;
$1_smx.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
cse2smx_lang $1 m;
$1_smxx.m: $1_smx.m
touch $1_smxx.m
$1_smxtx.m: $1_smx.m
touch $1_smxtx.m
#SUMMARY smc controller form state matrices etc. - siso only (r)
#SUMMARY smc controller form state matrices etc. - siso only (tex)
|
︙ | | |
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
|
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
|
-
+
|
echo Debugging - log files retained in LOGFILES
mkdir -p LOGFILES
mv -f *.log LOGFILES
fi
#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
echo Finishing mtt $mtt_switches $1 $2 $3 $4
echo Finishing mtt $mtt_switches $1 $2 $3 $4 at level $level
fi
if [ "$make_status" != "0" ]; then
echo Exiting MTT with error $make_status
exit 1
fi
|