︙ | | | ︙ | |
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.225 2000/02/10 15:03:10 peterg
## Put subs.r file into the m-code generation -- allows the off exp;
## switch for simpler expresions.
##
## Revision 1.224 2000/02/08 10:27:04 peterg
## Removed obselete .h stuff
##
|
>
>
>
|
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.226 2000/02/10 18:51:31 peterg
## Included OFF exp; in subs.r default
##
## Revision 1.225 2000/02/10 15:03:10 peterg
## Put subs.r file into the m-code generation -- allows the off exp;
## switch for simpler expresions.
##
## Revision 1.224 2000/02/08 10:27:04 peterg
## Removed obselete .h stuff
##
|
︙ | | | ︙ | |
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
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
|
>
>
>
|
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
|
verbose=' -s'
# Default integration method
integration_method=implicit;
# Default no info
info_switch=''
# Default use m, not oct files
m='m';
#Initialise list
mtt_switches='';
#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
|
︙ | | | ︙ | |
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
Solve='-A';;
-abg )
mtt_switches="$mtt_switches $1";
start_at_abg='yes';;
-stdin )
mtt_switches="$mtt_switches $1";
stdin=stdin;;
--version)
echo 'MTT version' $version; exit;;
--versions)
mtt_versions; exit;;
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
|
>
>
>
|
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
|
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';;
--version)
echo 'MTT version' $version; exit;;
--versions)
mtt_versions; exit;;
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
|
︙ | | | ︙ | |
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
|
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 ' -o ode is same as dae'
echo ' -p print environment variables'
echo ' -r reset time stamp on representation'
echo ' -s try to generate sensitivity BG (experimental)'
echo ' -ss use steady-state info to initialise simulations'
echo ' -stdin read input data from standard input for simulations'
echo ' -t tidy mode (default)'
echo ' -u untidy mode (leaves files in current dir)'
|
|
>
|
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
|
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 ' -o ode is same as dae'
echo ' -oct use oct files in place of m files where appropriate'
echo ' -p print environment variables'
echo ' -r reset time stamp on representation'
echo ' -s try to generate sensitivity BG (experimental)'
echo ' -ss use steady-state info to initialise simulations'
echo ' -stdin read input data from standard input for simulations'
echo ' -t tidy mode (default)'
echo ' -u untidy mode (leaves files in current dir)'
|
︙ | | | ︙ | |
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
|
#SUMMARY simp simplification information (r)
$1_simp.r:
echo Creating $1_simp.r
( \
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:
echo Creating $1_subs.r
( \
echo "%% Reduce substitution statements for system $1 ($1_subs.r)"; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo "OFF exp; % Don't expand expressions"; \
echo 'END;'; \
)> $1_subs.r
#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; \
|
|
|
|
|
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
|
#SUMMARY simp simplification information (r)
$1_simp.r:
echo Creating $1_simp.r
( \
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:
echo Creating $1_subs.r
( \
echo "%% Reduce substitution statements for system $1 ($1_subs.r)"; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo "OFF exp; % Don't expand expressions"; \
echo 'END;'; \
)> $1_subs.r
#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; \
|
︙ | | | ︙ | |
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
|
echo 'Matrix MTTUU(1,5);'; \
echo 'MTTUU(1,1) := MTTu1;'; \
echo 'MTTUU(1,2) := MTTu11;'; \
echo 'MTTUU(1,3) := MTTu12;'; \
echo 'MTTUU(1,4) := MTTu13;'; \
echo 'MTTUU(1,5) := MTTu14;'; \
echo 'END;'; \
)> $1_obspar.r
#SUMMARY simpar simulation information (txt)
$1_simpar.txt:
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)
|
|
|
|
|
|
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
|
echo 'Matrix MTTUU(1,5);'; \
echo 'MTTUU(1,1) := MTTu1;'; \
echo 'MTTUU(1,2) := MTTu11;'; \
echo 'MTTUU(1,3) := MTTu12;'; \
echo 'MTTUU(1,4) := MTTu13;'; \
echo 'MTTUU(1,5) := MTTu14;'; \
echo 'END;'; \
)> $1_obspar.r
#SUMMARY simpar simulation information (txt)
$1_simpar.txt:
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)
|
︙ | | | ︙ | |
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
|
$1_params.r:
echo Creating $1_params.r
( \
echo "%% Parameter file for system $1 ($1_params.r)"; \
echo "%% This file provides symbolic parameters for simplification";\
cat $MTTPATH/trans/m/rcs_header.txt; \
echo 'END;'; \
)> $1_params.r
#SUMMARY sspar steady-state definition (r)
$1_sspar.r:
struc2sspar_txt2r $1
#SUMMARY sspar steady-state parameters (tex)
|
|
|
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
|
$1_params.r:
echo Creating $1_params.r
( \
echo "%% Parameter file for system $1 ($1_params.r)"; \
echo "%% This file provides symbolic parameters for simplification";\
cat $MTTPATH/trans/m/rcs_header.txt; \
echo 'END;'; \
)> $1_params.r
#SUMMARY sspar steady-state definition (r)
$1_sspar.r:
struc2sspar_txt2r $1
#SUMMARY sspar steady-state parameters (tex)
|
︙ | | | ︙ | |
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
|
endif
$1_ode.m: $1_def.m $1_ode.r $1_subs.r $1_sympars.txt
mtt_r2m $1 ode m; matlab_tidy $1_ode.m
$1_ode.oct: $1_def.r $1_ode.p $1_sympars.txt
mtt_p2oct $1 ode
$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)
|
>
>
>
|
|
|
|
|
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
|
endif
$1_ode.m: $1_def.m $1_ode.r $1_subs.r $1_sympars.txt
mtt_r2m $1 ode m; matlab_tidy $1_ode.m
$1_ode.oct: $1_def.r $1_ode.p $1_sympars.txt
mtt_p2oct $1 ode
$1_odeo.oct: $1_def.r $1_odeo.p $1_sympars.txt
mtt_p2oct $1 odeo
$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)
|
︙ | | | ︙ | |
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
|
$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 $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 obs observer equations for CGPC (r)
|
|
|
|
|
|
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
|
$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 $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 obs observer equations for CGPC (r)
|
︙ | | | ︙ | |
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
|
1_odes.c: $1_ode.c $1_def.r $1_sympar.r
ode2odes_r2c $1
$1_sms.c: $1_sm.c $1_def.r $1_sympar.r
sm2sms_r2c $1
ifeq ($computation,octave)
$1_odes.dat2: $1_ode2odes.m $1_ode.m $1_numpar.m $1_switchopen.m \
$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
|
|
|
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
|
1_odes.c: $1_ode.c $1_def.r $1_sympar.r
ode2odes_r2c $1
$1_sms.c: $1_sm.c $1_def.r $1_sympar.r
sm2sms_r2c $1
ifeq ($computation,octave)
$1_odes.dat2: $1_ode2odes.m $1_ode.m $1_numpar.m $1_switchopen.m \
$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
|
︙ | | | ︙ | |