Differences From Artifact [2a67a3fad5]:

To Artifact [27ccd43894]:


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, 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 .....
##







>
>
>







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, 1997,1998,1999

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.214  1999/11/14 21:27:11  peterg
## *** empty log message ***
##
## 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 .....
##
733
734
735
736
737
738
739

740
741
742
743
744
745
746
747
748
749
750
751
752
753
754



755
756
757
758
759
760
761
762
763
764
765
766
767




768
769
770
771
772
773
774
775
776



777


778
779








780
781
782
783
784
785
786
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='';

# By default, make it tidy
tidy=tidy;

# Default not verbose
verbose=' -s'




# Default no info
info_switch=''

#Initialise list
mtt_switches='';


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




	-p )
                mtt_switches="$mtt_switches $1";
		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";







>















>
>
>













>
>
>
>









>
>
>
|
>
>
|
|
>
>
>
>
>
>
>
>







736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
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='';

# By default, make it tidy
tidy=tidy;

# Default not verbose
verbose=' -s'

# Default integration method
integration_method=implicit;

# Default no info
info_switch=''

#Initialise list
mtt_switches='';


#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-q )
                mtt_switches="$mtt_switches $1";
		quiet=quiet;;  
	-r )
                mtt_switches="$mtt_switches $1";
		reset=reset;;  

	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                mtt_switches="$mtt_switches $1";
		computation=c ;;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in
		    euler)
			integration_method=euler;
                        mtt_switches="$mtt_switches euler";
			;;
		    implicit)
			integration_method=implicit;
                        mtt_switches="$mtt_switches implicit";
			;;
		    *)
			echo $1 is an unknown integration method - use euler or implicit;
                        exit;;
		esac;;
	-ss )
                mtt_switches="$mtt_switches $1";
		steadystate_computation=yes ;;
	-d )
		directory=$2; cd $directory; shift ;;
	-dc )
		mtt_switches="$mtt_switches $1";
875
876
877
878
879
880
881

882
883
884

885
886
887
888
889
890
891
    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'
    exit







>
|
|

>







899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
    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 '         -dc Maximise derivative (not integral) causality'
    echo '         -i implicit   Use implicit integration'
    echo '         -i euler      Use Euler integration'
    echo '         -p  print environment variables'
    echo '         -r  reset time stamp on representation
    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'
    exit
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
   # 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







|
<
<












<







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
   # 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" ] && [ "$3" != "hview" ] && [ -z "$reset" ]; 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


   # Remove the MTT_work directory if very tidy
   if [ "$verytidy" = "verytidy" ]; then
    echo Removing all working files
    rm -rf ../MTT_work
  fi
exit
1346
1347
1348
1349
1350
1351
1352















1353






1354
1355
1356
1357
1358
1359
1360
         echo Copying  $1_$2_$4.ps
         cp  $1_$2_$4.ps ..
      fi
   fi
    exit
fi























################################
# This is the main mtt programme
################################

$MAKE -S $verbose  -f  -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want







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

>
>
>
>
>
>







1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
         echo Copying  $1_$2_$4.ps
         cp  $1_$2_$4.ps ..
      fi
   fi
    exit
fi

## Check for pre version 4.0 integration method specification.
if [ $level = "0" ]; then
  if [ -f "$1_simpar.txt" ]; then
    method_line=`grep -i METHOD  $1_simpar.txt`
    if [ -n "`echo $method_line | grep -i euler`" ]; then
      echo Obsolete $1_simpar.txt contains: $method_line
      echo "    please use mtt -i euler in future"
      mtt_switches="$mtt_switches -i euler";
    elif [ -n "`echo $method_line | grep -i implicit`" ]; then
      echo Obsolete $1_simpar.txt contains: $method_line
      echo "    please use mtt -i implicit in future"
      mtt_switches="$mtt_switches -i implicit";
    fi
  fi
fi

if [ -n "$reset" ]; then
echo $reset
  echo Resetting $1_$2.$3;
  touch $1_$2.$3;
  exit;    
fi
################################
# This is the main mtt programme
################################

$MAKE -S $verbose  -f  -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
	echo "# Simulation parameters for system $1 ($1_simpar.txt)"; \
	echo "# Generated by MTT on" `date`.; \
	cat $MTTPATH/trans/rcs_header.sh; \
        echo ;\
	echo 'LAST        = 10.0;       # Last time in simulation'; \
	echo 'DT          = 0.1;        # Print interval'; \
	echo 'STEPFACTOR  = 1;          # Integration steps per print interval'; \
	echo 'METHOD      = Implicit;   # Integration method'; \
	echo 'WMIN        = -1;         # Minimum frequency = 10^WMIN'; \
	echo 'WMAX        = 2;          # Maximum frequency = 10^WMAX'; \
	echo 'WSTEPS      = 100;        # Number of frequency steps'; \
	echo 'INPUT       = 1;          # Index of the input'; \
        )> $1_simpar.txt

#SUMMARY simpar	simulation information (m)







<







1591
1592
1593
1594
1595
1596
1597

1598
1599
1600
1601
1602
1603
1604
	echo "# Simulation parameters for system $1 ($1_simpar.txt)"; \
	echo "# Generated by MTT on" `date`.; \
	cat $MTTPATH/trans/rcs_header.sh; \
        echo ;\
	echo 'LAST        = 10.0;       # Last time in simulation'; \
	echo 'DT          = 0.1;        # Print interval'; \
	echo 'STEPFACTOR  = 1;          # Integration steps per print interval'; \

	echo 'WMIN        = -1;         # Minimum frequency = 10^WMIN'; \
	echo 'WMAX        = 2;          # Maximum frequency = 10^WMAX'; \
	echo 'WSTEPS      = 100;        # Number of frequency steps'; \
	echo 'INPUT       = 1;          # Index of the input'; \
        )> $1_simpar.txt

#SUMMARY simpar	simulation information (m)
1806
1807
1808
1809
1810
1811
1812

1813
1814



1815
1816
1817
1818
1819
1820
1821
#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_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_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)







>
|
|
>
>
>







1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
#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_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_subs.r 
#	cse_r2m $1; matlab_tidy $1_cse.m
$1_cse.m: $1_def.m $1_cse.r $1_sympars.txt
	mtt_r2m $1 cse;  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.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)
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
1854
1855








1856


1857


1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875




1876
1877
1878
1879


1880
1881






1882
1883

1884
1885
1886
1887
1888
1889
1890

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
	ode_r2tex $1; latex_tidy $1_ode.tex









$1_ode2odes.m : $1_def.r $1_sympars.txt


	make_ode2odes $1



#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_m2p $1_simpar.m
$1_numpar.p : $1_def.r $1_numpar.m
	mtt_m2p $1_numpar.m
$1_state.p : $1_def.r $1_state.m
	mtt_m2p $1_state.m
$1_input.p : $1_def.r $1_input.m
	mtt_m2p $1_input.m
$1_ode.p : $1_def.r $1_ode.m
	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_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

#SUMMARY obs	observer equations for CGPC (r)
#SUMMARY obs*	observer equations for CGPC (m)
#SUMMARY obs	observer equations for CGPC (tex)







<
<
<
<
<
<
<


<










>
>
>
>
>
>
>
>
|
>
>
|
>
>


















>
>
>
>




>
>


>
>
>
>
>
>

|
>







1876
1877
1878
1879
1880
1881
1882







1883
1884

1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954

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








$1_ode.m: $1_def.m $1_ode.r $1_sympars.txt
	mtt_r2m $1 ode m; matlab_tidy $1_ode.m


$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
	ode_r2tex $1; latex_tidy $1_ode.tex

# The main simulation programme
ifeq ($integration_method,implicit)
$1_ode2odes.m : $1_def.r $1_sympars.txt $1_smx.m\
                $1_simpar.m $1_numpar.m $1_state.m $1_input.m \
                $1_cse.m $1_cseo.m  $1_switchopen.m
	make_ode2odes $1 $integration_method
endif
ifeq ($integration_method,euler)
$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_switchopen.m
	make_ode2odes $1 $integration_method
endif


#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_m2p $1_simpar.m
$1_numpar.p : $1_def.r $1_numpar.m
	mtt_m2p $1_numpar.m
$1_state.p : $1_def.r $1_state.m
	mtt_m2p $1_state.m
$1_input.p : $1_def.r $1_input.m
	mtt_m2p $1_input.m
$1_ode.p : $1_def.r $1_ode.m
	mtt_m2p $1_ode.m
$1_odeo.p : $1_def.r $1_odeo.m
	mtt_m2p $1_odeo.m
$1_cse.p : $1_def.r $1_cse.m
	mtt_m2p $1_cse.m
$1_cseo.p : $1_def.r $1_cseo.m
	mtt_m2p $1_cseo.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

ifeq ($integration_method,implicit)
$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_cse.p $1_cseo.p  $1_switchopen.p
	mtt_m2p $1_ode2odes.m $integration_method
endif
ifeq ($integration_method,euler)
$1_ode2odes.p : $1_ode2odes.m $1_def.r\
                $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 $integration_method
endif

$1_ode2odes.c: $1_ode2odes.p 
	mtt_p2c $info_switch $1 ode2odes

#SUMMARY obs	observer equations for CGPC (r)
#SUMMARY obs*	observer equations for CGPC (m)
#SUMMARY obs	observer equations for CGPC (tex)

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