Overview
Comment:-partition now partially works up to cse.m
but need to think about indexing, struc files etc for subsystems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 625f96e7516e1b6f63d8bb2d791fd51057b476a7606201155c7cb6be73ae1b6b
User & Date: gawthrop@users.sourceforge.net on 2000-12-01 14:18:44
Other Links: branch diff | manifest | tags
Context
2000-12-01
14:22:15
*** empty log message *** check-in: a49daaeeff user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:18:44
-partition now partially works up to cse.m
but need to think about indexing, struc files etc for subsystems.
check-in: 625f96e751 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:15:31
Initial revision check-in: 9384c87968 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [9d9d858402] to [8411417dd6].

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.284  2000/11/27 10:33:35  peterg
## -pdf option now coerces ps-->pdf
##
## Revision 1.283  2000/11/24 15:11:50  peterg
## -pdf switch for simple displays
##
## Revision 1.282  2000/11/24 14:53:53  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.285  2000/11/27 11:51:21  peterg
## Fixed a few pdf /fig bugs
##
## Revision 1.284  2000/11/27 10:33:35  peterg
## -pdf option now coerces ps-->pdf
##
## Revision 1.283  2000/11/24 15:11:50  peterg
## -pdf switch for simple displays
##
## Revision 1.282  2000/11/24 14:53:53  peterg
1068
1069
1070
1071
1072
1073
1074
1075


1076
1077
1078
1079
1080
1081
1082
		info_switch='-I' ;;
	-t )
		tidy=tidy ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;;


	-l )
                mtt_switches="$mtt_switches $1 $2";
		level=$2; shift ;;
	-A )
                mtt_switches="$mtt_switches $1";
                Solve='-A';;
	-abg )







|
>
>







1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
		info_switch='-I' ;;
	-t )
		tidy=tidy ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;
                mtt_switches="$mtt_switches $1";
                ;;
	-l )
                mtt_switches="$mtt_switches $1 $2";
		level=$2; shift ;;
	-A )
                mtt_switches="$mtt_switches $1";
                Solve='-A';;
	-abg )
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624


1625

1626
1627

1628
1629
1630
1631
1632
1633
1634
lang=$3

## Make ps pdf if -pdf set
if [ "$lang" == "ps" ]; then
  lang=$ps
fi

## Create the make target name
target=$1_$2.$lang

# Create some strings
Subsystem=$1$subsystem;

Subsystem_=$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"
Subsystem_cbg=$Subsystem"_cbg"



# Save up the argument list in a file; but only if argument has changed

#ARGS=$4; _ARGS=-$4; __ARGS=`echo $_ARGS | tr ',' '-'`


#DIFF doesn't like empty files - so put a blank if empty
#if [ -z "$ARGS" ]; then
#  ARGS=' ';
#  _ARGS='';
#fi

#cat > $1_args.new <<EOF







<
<













>
>
|
>
|

>







1608
1609
1610
1611
1612
1613
1614


1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
lang=$3

## Make ps pdf if -pdf set
if [ "$lang" == "ps" ]; then
  lang=$ps
fi




# Create some strings
Subsystem=$1$subsystem;

Subsystem_=$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"
Subsystem_cbg=$Subsystem"_cbg"

## Create the make target name
target=${sys}_${rep}.${lang}

## Arguments
ARGS=$4; _ARGS=-$4; __ARGS=`echo $_ARGS | tr ',' '-'`

# Save up the argument list in a file; but only if argument has changed
#DIFF doesn't like empty files - so put a blank if empty
#if [ -z "$ARGS" ]; then
#  ARGS=' ';
#  _ARGS='';
#fi

#cat > $1_args.new <<EOF
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690




1691
1692
1693
1694
1695
1696
1697

  # 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.$lang
          cp  -p -u $1$subsystem"_"$2.$lang ..
      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







<
<
<
|
|
|
>
>
>
>







1685
1686
1687
1688
1689
1690
1691



1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705

  # 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



        if [ "$PLOTTYPE" = "multiple" ]; then
          echo Copying  $1_$2$__ARGS.$ps
          cp  $1_$2$__ARGS.$ps ..
        else
          echo Copying  $1$subsystem"_"$2.$lang
          cp  -p -u $1$subsystem"_"$2.$lang ..
        fi
      fi
    fi

   # Remove the MTT_work directory if very tidy
   if [ "$verytidy" = "verytidy" ]; then
    echo Removing all working files
    rm -rf ../MTT_work
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
fi

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


## echo Target is $target, Subsystem is $Subsystem, switches are $mtt_switches
$MAKE -S $verbose  -f  -  $target << EOF

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

# MTT implicit rules
## .oct files
ifneq ($2,ode2odes)
%.oct:  %.cc $1_def.h $1_sympar.h
	echo Creating $1_$2.oct; mkoctfile  $< 
endif

## .cc files
ifneq ($2,ode2odes)
%.cc:  %.m
	mtt_m2cc.sh  $1 $2 cat 
endif







|









|







1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
fi

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


##echo Target is $target, Subsystem is $Subsystem, options are $mtt_switches
$MAKE -S $verbose  -f  -  $target << EOF

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

# MTT implicit rules
## .oct files
ifneq ($2,ode2odes)
%.oct:  %.cc $1_def.h $1_sympar.h
	echo Creating $1_$2.oct; $MKOCTFILE  $< 
endif

## .cc files
ifneq ($2,ode2odes)
%.cc:  %.m
	mtt_m2cc.sh  $1 $2 cat 
endif
2241
2242
2243
2244
2245
2246
2247
2248
2249

2250
2251
2252
2253
2254
2255
2256
#SUMMARY def	definitions - system orders etc. (r)
#SUMMARY def	definitions - system orders etc. (m)
#SUMMARY def	definitions - system orders etc. (h)
#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_aliased.txt: $1_ese.r
	touch $1_aliased.txt
$1_struc.tex: $1_struc.txt







|

>







2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
#SUMMARY def	definitions - system orders etc. (r)
#SUMMARY def	definitions - system orders etc. (m)
#SUMMARY def	definitions - system orders etc. (h)
#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: $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_aliased.txt: $1_ese.r
	touch $1_aliased.txt
$1_struc.tex: $1_struc.txt
2265
2266
2267
2268
2269
2270
2271
2272

2273




2274

2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300




2301
2302
2303
2304
2305
2306
2307
2308
2309





2310
2311
2312
2313
2314
2315
2316
2317
#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 $Subsystem_cr.r

ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems $1 dae r
endif
ifeq ($rdae_is_dae,1)
	echo Copying $1_rdae.r to $1_dae.r
	cp $1_rdae.r  $1_dae.r
else
	rdae2dae_r $partition $Subsystem; tidy $Subsystem_dae.r
endif

$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_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)
#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_csex.r: $1_cse.r
	touch $1_csex.r
$1_cseo.r: $1_cse.r
	touch $1_cseo.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.r $1_cse.r $1_sympars.txt





	mtt_r2m $optimise -parameters  $1 cse;#  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.m; 
$1_csex.m: $1_def.r $1_csex.r $1_sympars.txt
	mtt_r2m $1 csex
$1_cseo.m: $1_def.r $1_cseo.r $1_sympars.txt
	mtt_r2m $optimise -parameters  $1 cseo;#  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 $2; latex_tidy $1_cse.tex








|
>
|
>
>
>
>
|
>


|





|
















|
>
>
>
>
|







|
>
>
>
>
>
|







2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
#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

${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} rdae r
endif
	ese2rdae_r ${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)
	echo Copying $1_rdae.r to $1_dae.r
	cp $1_rdae.r  $1_dae.r
else
	rdae2dae_r ${Subsystem}; tidy ${Subsystem}_dae.r
endif

$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_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)
#Constrained-state equations
${sys}_cse.r: ${Subsystem}_dae.r ${Subsystem}_dae.r ${Subsystem}_def.r ${Subsystem}_subs.r 
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} cse r
endif
	dae2cse_r $Solve ${Subsystem}; tidy ${Subsystem}_cse.r #$1_subs.r
$1_csex.r: $1_cse.r
	touch $1_csex.r
$1_cseo.r: $1_cse.r
	touch $1_cseo.r

#$1_cse.m: $1_def.r $1_cse.r $1_sympar.r  $1_subs.r 
#	cse_r2m $1; matlab_tidy $1_cse.m
${sys}_cse.m: ${Subsystem}_def.r ${Subsystem}_cse.r ${Subsystem}_sympar.txt
ifneq ($partition,)
	echo Doing subsystems
	## mtt_cp_subrep ${sys} sympar txt
	mtt_make_subsystems  ${sys} cse m
endif
	mtt_r2m  -parameters  ${Subsystem} cse;#  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.m; 
$1_csex.m: $1_def.r $1_csex.r $1_sympars.txt
	mtt_r2m $1 csex
$1_cseo.m: $1_def.r $1_cseo.r $1_sympars.txt
	mtt_r2m $optimise -parameters  $1 cseo;#  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 $2; latex_tidy $1_cse.tex

2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903







2904

2905
2906
2907






2908
2909
2910
2911
2912
2913
2914
	dat22dat $1 odes so
$1_odess.dat: $1_odess.dat2 $1_def.r
	echo Creating $1_odess.dat
	dat22dat $1 odes s

#Generic conversion of data files from dat to (gplot) gdat format 
$1_$2.gdat: $1_$2.dat $1_struc.txt  $1_args.m
	dat2gdat $1 $2 "$4" "$NyquistStyle"


ifeq ($REPTYPE,data)
## Conversion of gdat to fig files
$1_$2.fig: $1_$2.gdat
	gdat2fig $1_$2 "$ARGS"







## Conversion of gdat fig files to ps/pdf

$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2.$ps
	fig2dev -L$eps $1_$2.fig > $1_$2.$ps






endif


#Generic conversion of Latex to latex document
mtt.sty:
	echo Copying mtt.sty to here
	cp $MTTPATH/trans/mtt.sty .







|

|

<

|
>
>
>
>
>
>
>

>



>
>
>
>
>
>







2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924

2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
	dat22dat $1 odes so
$1_odess.dat: $1_odess.dat2 $1_def.r
	echo Creating $1_odess.dat
	dat22dat $1 odes s

#Generic conversion of data files from dat to (gplot) gdat format 
$1_$2.gdat: $1_$2.dat $1_struc.txt  $1_args.m
	dat2gdat $1 $2 "$ARGS" "$NyquistStyle"

## Conversion of gdat to fig files
ifeq ($REPTYPE,data)

$1_$2.fig: $1_$2.gdat
	gdat2fig $1_$2

ifneq ($ARGS,) ## Multiple plots
	echo Creating $1_$2$__ARGS.fig
	mv $1_$2.fig $1_$2$__ARGS.fig
	rm -f $1_$2.gdat
endif

## Conversion of gdat fig files to ps/pdf
ifeq ($ARGS,) # single plot
$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2.$ps
	fig2dev -L$eps $1_$2.fig > $1_$2.$ps
else ## Multiple plots
$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2$__ARGS.$ps
	fig2dev -L$eps $1_$2$__ARGS.fig > $1_$2$__ARGS.$ps
endif

endif


#Generic conversion of Latex to latex document
mtt.sty:
	echo Copying mtt.sty to here
	cp $MTTPATH/trans/mtt.sty .
2961
2962
2963
2964
2965
2966
2967

2968
2969




2970
2971
2972
2973
2974
2975
2976
#Default view
ifeq ($REPTYPE,bg)
$1_$2.view : $Subsystem_$2.pview
endif

ifeq ($REPTYPE,data)
$1_$2.view: $1_$2.$ps

	echo Creating view of $1_$2 - $ps file
	$psview $1_$2.$ps&




endif

ifeq ($REPTYPE,tex)
$1_$2.view : $1_$2.pview
endif

ifeq ($REPTYPE,txt)







>


>
>
>
>







2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
#Default view
ifeq ($REPTYPE,bg)
$1_$2.view : $Subsystem_$2.pview
endif

ifeq ($REPTYPE,data)
$1_$2.view: $1_$2.$ps
ifeq ($ARGS,) # single plot
	echo Creating view of $1_$2 - $ps file
	$psview $1_$2.$ps&
else
	echo Creating view of $1_$2$__ARGS - $ps file
	$psview $1_$2$__ARGS.$ps&
endif
endif

ifeq ($REPTYPE,tex)
$1_$2.view : $1_$2.pview
endif

ifeq ($REPTYPE,txt)


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