Overview
Comment:-sub switch introduced - works up to dae.r
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d8733a4781538804c5b5a6d44ec22fa435b91334805ad72ce8f1e282c131e50c
User & Date: gawthrop@users.sourceforge.net on 2000-09-02 14:24:06
Other Links: branch diff | manifest | tags
Context
2000-09-02
14:46:43
Initial revision check-in: 9e50e5fe64 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:24:06
-sub switch introduced - works up to dae.r check-in: d8733a4781 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-09-01
13:36:15
Added -partition option check-in: 3028566550 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [a1fe408d09] to [3f8b7fa802].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (C) 2000 by Peter J. Gawthrop

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



## Revision 1.254  2000/08/29 09:59:47  peterg
## Version 4.5 -- includes code optimisation using the "Scope" package in reduce
##
## Revision 1.253  2000/08/24 08:53:35  peterg
## New makesubs to create a .subs.r file with output switches to simplify output.
##
## Revision 1.252  2000/08/09 10:31:17  peterg







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.255  2000/08/30 11:43:04  peterg
## Put in the -opt switch for code optimisation
##
## Revision 1.254  2000/08/29 09:59:47  peterg
## Version 4.5 -- includes code optimisation using the "Scope" package in reduce
##
## Revision 1.253  2000/08/24 08:53:35  peterg
## New makesubs to create a .subs.r file with output switches to simplify output.
##
## Revision 1.252  2000/08/09 10:31:17  peterg
914
915
916
917
918
919
920




921
922
923
924
925
926
927
	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                mtt_switches="$mtt_switches $1";
                matrix_smxa="-matrix";
		computation=c ;;




	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in







>
>
>
>







917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                mtt_switches="$mtt_switches $1";
                matrix_smxa="-matrix";
		computation=c ;;
	-cc )
                mtt_switches="$mtt_switches $1";
                matrix_smxa="-matrix";
		computation=cc ;;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in
976
977
978
979
980
981
982




983
984
985
986
987


988
989
990
991
992
993
994
                Solve='-A';;
	-abg )
                mtt_switches="$mtt_switches $1";
                start_at_abg='yes';;
	-stdin )
                mtt_switches="$mtt_switches $1";
                stdin=stdin;;




	-oct )
                mtt_switches="$mtt_switches $1";
                m='oct';;
	-opt )  mtt_switches="$mtt_switches $1";
                optimise='-optimise';;


        --version)                
                  echo 'MTT version' $version; exit;;
        --versions)                
                mtt_versions; exit;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac







>
>
>
>





>
>







983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
                Solve='-A';;
	-abg )
                mtt_switches="$mtt_switches $1";
                start_at_abg='yes';;
	-stdin )
                mtt_switches="$mtt_switches $1";
                stdin=stdin;;
	-sub )  mtt_switches="$mtt_switches $1 $2";
                sub='-sub'; 
                subsystem="_"$2;
                shift ;;
	-oct )
                mtt_switches="$mtt_switches $1";
                m='oct';;
	-opt )  mtt_switches="$mtt_switches $1";
                optimise='-optimise';;
	-partition )  mtt_switches="$mtt_switches $1";
                partition='-partition';;
        --version)                
                  echo 'MTT version' $version; exit;;
        --versions)                
                mtt_versions; exit;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500

  # 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








|
|







1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513

  # 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$subsystem"_"$2.$3
          cp  -p -u $1$subsystem"_"$2.$3 ..
      fi
      if [ "$PLOTTYPE" = "multiple" ]; then
        echo Copying  $1_$2$__ARGS.ps
        cp  $1_$2$__ARGS.ps ..
      fi
    fi

1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
    
   if [ -f "$filename" ]; then
      echo $filename exists
   else
     if [ -n "$Verbose" ]; then
      echo make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4" 
     fi
      make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$"
      if [ -n "$4" ]; then
         echo Copying  $1_$2$__ARGS.ps
         cp  $1_$2$__ARGS.ps ..
      fi
   fi
    exit
fi







|







1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
    
   if [ -f "$filename" ]; then
      echo $filename exists
   else
     if [ -n "$Verbose" ]; then
      echo make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4" 
     fi
      make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4"
      if [ -n "$4" ]; then
         echo Copying  $1_$2$__ARGS.ps
         cp  $1_$2$__ARGS.ps ..
      fi
   fi
    exit
fi
1571
1572
1573
1574
1575
1576
1577













1578
1579
1580
1581
1582
1583
1584
1585
  sys_abg=$sys"_abg"
fi

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














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

# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files
%.oct:  %.cc







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







1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
  sys_abg=$sys"_abg"
fi

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

target=$1_$2.$3

# Create some strings
Subsystem=$1$subsystem;

Subsystem_ese=$Subsystem"_ese"
Subsystem_def=$Subsystem"_def"
Subsystem_rdae=$Subsystem"_rdae"
Subsystem_dae=$Subsystem"_dae"
Subsystem_subs=$Subsystem"_subs"
Subsystem_cr=$Subsystem"_cr"

echo Target is $target, Subsystem is $Subsystem
$MAKE -S $verbose  -f  -  $target << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files
%.oct:  %.cc
1649
1650
1651
1652
1653
1654
1655
1656



1657
1658
1659
1660
1661
1662
1663
	if [ "$level" = "0" ]; then \
	  sort -u MTT_cr.txt> $1_cr.txt; \
	fi

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1




#SUMMARY cr	constitutive relationship for each subsystem (tex)
#SUMMARY cr	constitutive relationship for each subsystem (view)
$1_cr.tex: $1_cr.r
	txt2tex $1 cr r

#SUMMARY sympar	symbolic parameters (txt)
#SUMMARY sympar*	symbolic parameters (view)







|
>
>
>







1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
	if [ "$level" = "0" ]; then \
	  sort -u MTT_cr.txt> $1_cr.txt; \
	fi

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1
# Cheat a bit and use the top level cr file for the subsystem as well
ifneq ($sub,)
	cp $1_cr.r $Subsystem_cr.r
endif
#SUMMARY cr	constitutive relationship for each subsystem (tex)
#SUMMARY cr	constitutive relationship for each subsystem (view)
$1_cr.tex: $1_cr.r
	txt2tex $1 cr r

#SUMMARY sympar	symbolic parameters (txt)
#SUMMARY sympar*	symbolic parameters (view)
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
	( \
	echo "%% Reduce commands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
	)> $1_simp.r

#SUMMARY subs  algebraic substitution (r)
$1_subs.r: 
	mtt $mtt_switches -q -u $1 sympar txt; 
	makesubs $1;

#SUMMARY obspar  GPC observability function parameters (r)
$1_obspar.r:
	echo Creating $1_obspar.r
	( \
	echo "%% Reduce  GPC observability function parameters for system $1 ($1_obspar.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \







|

|







1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
	( \
	echo "%% Reduce commands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
	)> $1_simp.r

#SUMMARY subs  algebraic substitution (r)
$Subsystem_subs.r: 
	mtt $mtt_switches -q -u $1 sympar txt; 
	makesubs $Subsystem;

#SUMMARY obspar  GPC observability function parameters (r)
$1_obspar.r:
	echo Creating $1_obspar.r
	( \
	echo "%% Reduce  GPC observability function parameters for system $1 ($1_obspar.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
#SUMMARY ese	elementary system equations (r)
#SUMMARY def	definitions - system orders etc. (r)
#SUMMARY def	definitions - system orders etc. (m)
#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
$1_ese.r: $1_cbg.m
	   cbg2ese_m2r $info_switch $1; ese_tidy $1
$1_def.r: $1_ese.r
	touch $1_def.r
$1_struc.txt: $1_ese.r
	touch $1_struc.txt
$1_struc.tex: $1_struc.txt
	struc_txt2tex $1
$1_struc.m: $1_struc.txt 
	struc_txt2m $1
$1_def.m: $1_def.r
	def_r2m $1; matlab_tidy $1_def.m;

#SUMMARY rdae	raw differential-algebraic equations (r)
#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
$1_rdae.r: $1_ese.r $1_def.r
	ese2rdae_r $1; tidy $1_rdae.r
$1_dae.r: $1_rdae.r $1_def.r $1_subs.r $1_cr.r
	rdae2dae_r $1; tidy $1_dae.r
$1_dae.m: $1_def.r $1_dae.r  $1_sympars.txt 
	dae_r2m $1; matlab_tidy $1_dae.m; matlab_tidy $1_daeo.m
$1_dae.c: $1_def.r $1_dae.r  $1_sympar.r
	dae_r2c $1; c_tidy $1_dae.c
$1_dae.tex:	$1_dae.r $1_simp.r
	dae_r2tex $1; latex_tidy $1_dae.tex

#SUMMARY cse	constrained-state equations (r)
#SUMMARY cse*	constrained-state equations (m)
#SUMMARY cse*	constrained-state equations (oct)
#SUMMARY cse	constrained-state equations (tex)
#SUMMARY cse*	constrained-state equations (view)
#SUMMARY cse	constrained-state equations (ps)







|
|


















|
|
|
|





|







2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
#SUMMARY ese	elementary system equations (r)
#SUMMARY def	definitions - system orders etc. (r)
#SUMMARY def	definitions - system orders etc. (m)
#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
$Subsystem_ese.r: $1_cbg.m
	   cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1
$1_def.r: $1_ese.r
	touch $1_def.r
$1_struc.txt: $1_ese.r
	touch $1_struc.txt
$1_struc.tex: $1_struc.txt
	struc_txt2tex $1
$1_struc.m: $1_struc.txt 
	struc_txt2m $1
$1_def.m: $1_def.r
	def_r2m $1; matlab_tidy $1_def.m;

#SUMMARY rdae	raw differential-algebraic equations (r)
#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
$Subsystem_rdae.r: $Subsystem_ese.r $Subsystem_def.r
	ese2rdae_r $partition $Subsystem; tidy $1_rdae.r
$1_dae.r: $Subsystem_rdae.r $Subsystem_def.r $Subsystem_subs.r $1_cr.r
	rdae2dae_r $partition $Subsystem; tidy $Subsystem_dae.r
$1_dae.m: $1_def.r $1_dae.r  $1_sympars.txt 
	dae_r2m $1; matlab_tidy $1_dae.m; matlab_tidy $1_daeo.m
$1_dae.c: $1_def.r $1_dae.r  $1_sympar.r
	dae_r2c $1; c_tidy $1_dae.c
$1_dae.tex:	$1_dae.r $1_simp.r
	dae_r2tex $partition $1; latex_tidy $1.tex

#SUMMARY cse	constrained-state equations (r)
#SUMMARY cse*	constrained-state equations (m)
#SUMMARY cse*	constrained-state equations (oct)
#SUMMARY cse	constrained-state equations (tex)
#SUMMARY cse*	constrained-state equations (view)
#SUMMARY cse	constrained-state equations (ps)
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474











2475
2476
2477
2478
2479
2480
2481

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c -lp2c -lm -o $1_ode2odes.out

$1_odes.dat2: $1_ode2odes.out
	echo Creating $1_odes.dat2
	    time ./$1_ode2odes.out>$1_odes.dat2
endif











$1_odeso.m: $1_odes.m
	touch $1_odeso.m
$1_smso.m: $1_sms.m
	touch $1_smso.m
$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
	dae2daes_m $1 '$ARGS'
$1_daeso.m: $1_daes.m







|


>
>
>
>
>
>
>
>
>
>
>







2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c -lp2c -lm -o $1_ode2odes.out

$1_odes.dat2: $1_ode2odes.out
	echo Creating $1_odes.dat2 using c version
	    time ./$1_ode2odes.out>$1_odes.dat2
endif

ifeq ($computation,cc)
$1_sim.exe: $1_ese.r 
	mtt $mtt_switches -q $1 sim exe

$1_odes.dat2: $1_sim.exe 
	echo Creating $1_odes.dat2 using cc version $ARGS
	    time ./$1_sim.exe $ARGS >$1_odes.dat2
endif


$1_odeso.m: $1_odes.m
	touch $1_odeso.m
$1_smso.m: $1_sms.m
	touch $1_smso.m
$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
	dae2daes_m $1 '$ARGS'
$1_daeso.m: $1_daes.m


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