Differences From Artifact [9fa2c5a807]:

To Artifact [43b80dfb35]:


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.239  2000/04/11 18:08:33  peterg
## Fixed cse.tex bug
##
## Revision 1.238  2000/04/10 10:06:41  peterg
## Sorted out implicit rules for p2oct conversion
##
## Revision 1.237  2000/04/07 19:10:24  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.240  2000/05/10 09:38:58  peterg
## Added Make to list of copied files.
##
## Revision 1.239  2000/04/11 18:08:33  peterg
## Fixed cse.tex bug
##
## Revision 1.238  2000/04/10 10:06:41  peterg
## Sorted out implicit rules for p2oct conversion
##
## Revision 1.237  2000/04/07 19:10:24  peterg
863
864
865
866
867
868
869

870
871
872
873
874
875
876
		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;







>







866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
		reset=reset;;  

	-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;
1705
1706
1707
1708
1709
1710
1711
1712
1713

1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
	echo Creating $1_simpar.txt
	( \
	echo '# -*-octave-*- Put Emacs into octave-mode'; \
	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)
$1_simpar.m: $1_simpar.txt
	txt2m $1 simpar


#SUMMARY numpar	numerical parameter declaration -- default (txt) 
$1_numpar.txt:
	mtt $mtt_switches -q -u $1 sympar txt; 
	sympar2numpar_txt2txt $1

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympars.txt
	txt2m $1 numpar

#SUMMARY numpar	numerical parameter declaration (c) 
#SUMMARY numpar	numerical parameter declaration (view) 
$1_numpar.c:  $1_numpar.txt $1_sympar.c
	txt2c $1 numpar

#SUMMARY input	numerical input declaration  -- default (txt)







|

>









|









|







1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
	echo Creating $1_simpar.txt
	( \
	echo '# -*-octave-*- Put Emacs into octave-mode'; \
	echo "# Simulation parameters for system $1 ($1_simpar.txt)"; \
	echo "# Generated by MTT on" `date`.; \
	cat $MTTPATH/trans/rcs_header.sh; \
	echo ;\
	echo 'FIRST        = 0.0;       # First time in simulation output'; \
	echo 'DT          = 0.1;        # Print interval'; \
	echo 'LAST        = 10.0;       # Last time in simulation'; \
	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)
$1_simpar.m: $1_simpar.txt
	mtt_txt2m $1 simpar


#SUMMARY numpar	numerical parameter declaration -- default (txt) 
$1_numpar.txt:
	mtt $mtt_switches -q -u $1 sympar txt; 
	sympar2numpar_txt2txt $1

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympars.txt
	mtt_txt2m $1 numpar

#SUMMARY numpar	numerical parameter declaration (c) 
#SUMMARY numpar	numerical parameter declaration (view) 
$1_numpar.c:  $1_numpar.txt $1_sympar.c
	txt2c $1 numpar

#SUMMARY input	numerical input declaration  -- default (txt)
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
#	mtt $mtt_switches -q -u $1 switch txt; 	
#	struc2input_txt2txt -s $1
#endif


#SUMMARY input	numerical input declaration (m) 
$1_input.m:  $1_input.txt $1_sympars.txt
	txt2m $1 input

#SUMMARY state	state declaration  -- default (txt)
#$1_state.txt: 
#	mtt $mtt_switches $1 struc txt; 
#	mtt $mtt_switches $1 ss r; 
#	struc2state_txt2txt $1

#SUMMARY state	state declaration (m) 
$1_state.m:  $1_state.txt $1_sympars.txt
	txt2m $1 state

#SUMMARY state	state declaration (c) 
#$1_state.c:  $1_state.txt $1_sympar.txt
#	txt2c $1 state

#SUMMARY input	numerical input declaration (c) 
#ifeq ($switches,0)







|









|







1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
#	mtt $mtt_switches -q -u $1 switch txt; 	
#	struc2input_txt2txt -s $1
#endif


#SUMMARY input	numerical input declaration (m) 
$1_input.m:  $1_input.txt $1_sympars.txt
	mtt_txt2m $1 input

#SUMMARY state	state declaration  -- default (txt)
#$1_state.txt: 
#	mtt $mtt_switches $1 struc txt; 
#	mtt $mtt_switches $1 ss r; 
#	struc2state_txt2txt $1

#SUMMARY state	state declaration (m) 
$1_state.m:  $1_state.txt $1_sympars.txt
	mtt_txt2m $1 state

#SUMMARY state	state declaration (c) 
#$1_state.c:  $1_state.txt $1_sympar.txt
#	txt2c $1 state

#SUMMARY input	numerical input declaration (c) 
#ifeq ($switches,0)
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
#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 -parameters -noglobal $1 cse;  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.m; 
$1_cseo.m: $1_cse.m
	touch $1_cseo.m
$1_cse.tex: $1_cse.r  $1_sympar.r $1_simp.r
	cse_r2tex $1 $2; latex_tidy $1_cse.tex

## Implicit oct rules
%.oct:  %.p







|







1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
#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 -parameters  $1 cse;  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.m; 
$1_cseo.m: $1_cse.m
	touch $1_cseo.m
$1_cse.tex: $1_cse.r  $1_sympar.r $1_simp.r
	cse_r2tex $1 $2; latex_tidy $1_cse.tex

## Implicit oct rules
%.oct:  %.p
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
#$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







|

|







2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
#$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_smxa.$m $1_smxax.$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
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083

2084


2085




2086
2087
2088
2089
2090
2091
2092
	mtt_m2p $1_smxa.m
$1_smxax.p : $1_def.r $1_smxax.m
	mtt_m2p $1_smxax.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 $stdin
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 $stdin
endif

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

#SUMMARY sim Octave simulation function (m)
$1_sim.m: $1_def.r $1_cse.$m $1_cseo.$m $1_smxa.$m $1_smxax.$m 

	mtt_make_sim $1; cp -v $1_cse.$m $1_cseo.$m $1_smxa.$m $1_smxax.$m ..








#SUMMARY obs	observer equations for CGPC (r)
#SUMMARY obs*	observer equations for CGPC (m)
#SUMMARY obs	observer equations for CGPC (tex)
#SUMMARY obs*	observer equations for CGPC (view)
#SUMMARY obs	observer equations for CGPC (ps)
#Observer functions for GPC







|















|
>
|
>
>

>
>
>
>







2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
	mtt_m2p $1_smxa.m
$1_smxax.p : $1_def.r $1_smxax.m
	mtt_m2p $1_smxax.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_smxa.p $1_smxax.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 $stdin
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 $stdin
endif

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

#SUMMARY sim Octave simulation function (m)

ifeq ($computation,octave)
$1_sim.m: $1_def.r $1_sympar.txt $1_cse.$m $1_cseo.$m $1_smxa.$m $1_smxax.$m $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif

ifeq ($computation,c)
$1_sim.m: $1_def.r $1_sympar.txt $1_ode2odes.out $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif

#SUMMARY obs	observer equations for CGPC (r)
#SUMMARY obs*	observer equations for CGPC (m)
#SUMMARY obs	observer equations for CGPC (tex)
#SUMMARY obs*	observer equations for CGPC (view)
#SUMMARY obs	observer equations for CGPC (ps)
#Observer functions for GPC
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
#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_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang -parameters -noglobal $1 smx m

$1_smxa.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang $1 smxa m

$1_smxax.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang $1 smxax m

#SUMMARY smc	controller form state matrices etc. - siso only (r)
#SUMMARY smc	controller form state matrices etc. - siso only (tex)
#SUMMARY smc*	controller form state matrices etc. - siso only (m)
#SUMMARY smc*	controller form state matrices etc. - siso only (view)
#SUMMARY smc	controller form state matrices etc. - siso only (ps)
#Linearised system: controller form state matrices etc.







|


|


|







2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
#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_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang -parameters $1 smx m

$1_smxa.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang -parameters $matrix_smxa $1 smxa m

$1_smxax.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang -parameters $1 smxax m

#SUMMARY smc	controller form state matrices etc. - siso only (r)
#SUMMARY smc	controller form state matrices etc. - siso only (tex)
#SUMMARY smc*	controller form state matrices etc. - siso only (m)
#SUMMARY smc*	controller form state matrices etc. - siso only (view)
#SUMMARY smc	controller form state matrices etc. - siso only (ps)
#Linearised system: controller form state matrices etc.
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
	     $1_def.m $1_input.m $1_state.m $1_simpar.m
	time octave_ode2odes $1
endif

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c  -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







|







2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
	     $1_def.m $1_input.m $1_state.m $1_simpar.m
	time octave_ode2odes $1
endif

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c   /usr/lib/libp2c.a -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

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