Overview
Comment: | Rationalised simulation modes to each return mtt_data |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
82f17ad042d15285187b321cbd0b560a |
User & Date: | gawthrop@users.sourceforge.net on 2001-03-30 15:13:58 |
Other Links: | branch diff | manifest | tags |
Context
2001-04-01
| ||
03:38:54 |
Reset row to zero after write to file, ready for subsequent runs. Eliminates SIGSEGV in Octave when _ode2odes called multiple times. check-in: 73e682b20b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2001-03-30
| ||
15:13:58 | Rationalised simulation modes to each return mtt_data check-in: 82f17ad042 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2001-03-29
| ||
19:24:14 | Can now use c representations of crs when using -c option check-in: d42eec3600 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/mttrc from [37b1cfbf51] to [4374f233f5].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.17.2.4 2001/03/06 03:48:43 geraint ## Print additional environment variable for "mtt -p". ## MTT_LDFLAGS defaults to " " to avoid installation warning. ## ## Revision 1.17.2.3 2001/03/01 05:05:53 geraint ## Minor revisions. ## | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.18 2001/03/19 02:28:52 geraint ## Branch merge: merging-ode2odes-exe back to MAIN. ## ## Revision 1.17.2.4 2001/03/06 03:48:43 geraint ## Print additional environment variable for "mtt -p". ## MTT_LDFLAGS defaults to " " to avoid installation warning. ## ## Revision 1.17.2.3 2001/03/01 05:05:53 geraint ## Minor revisions. ## |
︙ | ︙ | |||
153 154 155 156 157 158 159 | export MKOCTFILE=$MTT_LIB/octave/mkoctfile # ode2odes.exe stuff # local system PLAT="i686-pc-linux-gnu" | | > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | export MKOCTFILE=$MTT_LIB/octave/mkoctfile # ode2odes.exe stuff # local system PLAT="i686-pc-linux-gnu" # PREFIX="/usr/local" PREFIX="/usr" GCCVERS="2.95.2" SRCOCTAVE="/cvs/octave" # PLAT="mips-sgi-irix6.5" # PREFIX="/usr/people/bevangp/GNU" # GCCVERS="2.95.2" # SRCOCTAVE="${PREFIX}/../build/octave-2.1.33" # include paths IOCTAVE="-I${PREFIX}/include/octave" # library paths # LOCTAVE="-L${PREFIX}/lib/octave -loctave -lcruft -loctinterp" LOCTAVE="-L${PREFIX}/lib/octave -loctave -lcruft -loctinterp" LKPATHSEA="-L${SRCOCTAVE}/kpathsea -lkpathsea" LREADLINE=" -L${SRCOCTAVE}/readline -lreadline" LSYSTEM="-ldl -lm -lncurses" LF2C="-L${PREFIX}/lib/gcc-lib/${PLAT}/${GCCVERS} -lg2c" # compiler options |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/m/mtt_write.m from [360a19cdde] to [79505da971].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function mtt_write(t,x,y,nx,ny); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1999/03/15 21:57:00 peterg ## Removed the # symbol ## ############################################################### global MTT_data if t==0.0 MTT_data=[]; endif | > > > | < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function mtt_write(t,x,y,nx,ny); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.4 1999/03/15 23:05:29 peterg ## A complete rewrite - now puts into a Global matrix MTT_data ## ## Revision 1.3 1999/03/15 21:57:00 peterg ## Removed the # symbol ## ############################################################### global MTT_data if t==0.0 MTT_data=[]; endif MTT_data = [MTT_data; t,y',t,x']; endfunction |
Modified mttroot/mtt/bin/trans/make_ode2odes from [f5954cc958] to [da07b678d6].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.54 2001/03/27 01:14:27 geraint ## Improved determination of Octave version. ## ## Revision 1.53 2001/03/21 03:24:59 geraint ## Calculate inputs before outputs (.cc). ## ## Revision 1.52 2001/03/19 02:28:52 geraint | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.55 2001/03/27 13:21:59 geraint ## Octave version compatibility for save_ascii_data(_for_plotting). ## ## Revision 1.54 2001/03/27 01:14:27 geraint ## Improved determination of Octave version. ## ## Revision 1.53 2001/03/21 03:24:59 geraint ## Calculate inputs before outputs (.cc). ## ## Revision 1.52 2001/03/19 02:28:52 geraint |
︙ | ︙ | |||
245 246 247 248 249 250 251 | [simpar.dt] = mtt_simpar_update; endif if nargin<2 par = ${sys}_numpar(); [par] = mtt_numpar_update(par); endif if nargin<1 | | | > | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | [simpar.dt] = mtt_simpar_update; endif if nargin<2 par = ${sys}_numpar(); [par] = mtt_numpar_update(par); endif if nargin<1 [x0] = ${sys}_state(par); [x0] = mtt_state_update(x); endif ## Initialise t = 0.0; ddt = simpar.dt/simpar.stepfactor; ilast = round(simpar.last/ddt)+1; # Total number of steps x = x0; ## Following removed due to p2c bug ## [u] = zero_input($Nu); # Zero the input for MTTi=1:$Ny y(MTTi) = 0; endfor; |
︙ | ︙ | |||
303 304 305 306 307 308 309 | mttj = mttj+1; # Increment counter if mttj==simpar.stepfactor mttj = 0; # Reset counter endif endfor; # Integration loop | | | < < | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | mttj = mttj+1; # Increment counter if mttj==simpar.stepfactor mttj = 0; # Reset counter endif endfor; # Integration loop ## Create the output data mtt_data = MTT_data; endfunction EOF } # make_m make_cc() { |
︙ | ︙ | |||
732 733 734 735 736 737 738 | } int main (void) { set_signal_handlers (); #else DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system with $method integration method | | | | | | | > > > > > > | 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 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | } int main (void) { set_signal_handlers (); #else DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system with $method integration method Usage: mtt_data = ${sys}_ode2odes (x0, par, simpar) ") { static octave_value_list retval; #endif // STANDALONE static ColumnVector x0; static ColumnVector par; static Octave_map simpar; static double first = 0.0, dt = 0.0, last = 0.0, stepfactor = 0.0; #ifndef STANDALONE int nargin = args.length (); switch (nargin) { case 3: first = args (2).map_value ()["first"].double_value (); dt = args (2).map_value ()["dt"].double_value (); last = args (2).map_value ()["last"].double_value (); stepfactor = args (2).map_value ()["stepfactor"].double_value (); par = args (1).${vector_value} (); x0 = args (0).${vector_value} (); break; case 2: first = mtt_simpar ()["first"].double_value (); dt = mtt_simpar ()["dt"].double_value (); last = mtt_simpar ()["last"].double_value (); stepfactor = mtt_simpar ()["stepfactor"].double_value (); par = args (1).${vector_value} (); x0 = args (0).${vector_value} (); break; case 1: first = mtt_simpar ()["first"].double_value (); dt = mtt_simpar ()["dt"].double_value (); last = mtt_simpar ()["last"].double_value (); stepfactor = mtt_simpar ()["stepfactor"].double_value (); par = mtt_numpar (); x0 = args (0).${vector_value} (); break; case 0: #endif // ! STANDALONE first = mtt_simpar ()["first"].double_value (); dt = mtt_simpar ()["dt"].double_value (); last = mtt_simpar ()["last"].double_value (); stepfactor = mtt_simpar ()["stepfactor"].double_value (); par = mtt_numpar (); x0 = mtt_state (par); #ifndef STANDALONE break; default: usage("${sys}_ode2odes (x par simpar)", nargin); error("aborting."); } #endif // STANDALONE static ColumnVector dx (MTTNX); static ColumnVector x (MTTNX); static ColumnVector u (MTTNU); static ColumnVector y (MTTNY); static Matrix AA (MTTNX, MTTNX); static ColumnVector AAx (MTTNX); static ColumnVector open_switches (MTTNX); register double t = 0.0; const double ddt = dt / stepfactor; const int ilast = static_cast<int> (round ((last - first) / ddt)) + 1; const int nrows = static_cast<int> (round ((last - first) / dt)) + 1; for (register int i = 0; i < MTTNY; i++) { y (i) = 0.0; } for (register int i = 0; i < MTTNX; i++) { x (i) = x0 (i); } for (register int j = 0, i = 1; i <= ilast; i++) { u = mtt_input (x, y, t, par); y = mtt_${odeo} (x, u, t, par); if (0 == j) { |
︙ | ︙ | |||
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | j++; j = (j == static_cast<int> (stepfactor)) ? 0 : j; } #ifdef STANDALONE return 0; #else retval (0) = octave_value (y); retval (1) = octave_value (x); retval (2) = octave_value (t); return (retval); #endif // STANDALONE } EOF } case ${lang} in | > > > | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | j++; j = (j == static_cast<int> (stepfactor)) ? 0 : j; } #ifdef STANDALONE return 0; #else /* retval (0) = octave_value (y); retval (1) = octave_value (x); retval (2) = octave_value (t); */ retval = octave_value (get_global_value ("MTT_data")); return (retval); #endif // STANDALONE } EOF } case ${lang} in |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/mtt_header from [0e3dd0e69d] to [61f3b439e7].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.28 2001/02/17 03:48:17 geraint ## Use assignment LHS to gather tmp variable names. ## Prevents collection of long expressions, eg: tmp34*(tmp75 ## ## Revision 1.27 2001/02/14 06:06:34 geraint ## Removed octave_value_list wrappers from standalone.exe - speed improvements ## | > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.29 2001/03/27 13:10:23 geraint ## Improved determination of Octave version. ## ## Revision 1.28 2001/02/17 03:48:17 geraint ## Use assignment LHS to gather tmp variable names. ## Prevents collection of long expressions, eg: tmp34*(tmp75 ## ## Revision 1.27 2001/02/14 06:06:34 geraint ## Removed octave_value_list wrappers from standalone.exe - speed improvements ## |
︙ | ︙ | |||
221 222 223 224 225 226 227 | output='mtty' args=$eqnargs ;; ode2odes) states=no; inputs=no; parameters=no; | | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | output='mtty' args=$eqnargs ;; ode2odes) states=no; inputs=no; parameters=no; output='mtt_data' args='x0,par,simpar' ;; simpar) states=no; inputs=no; parameters=no; output='mttsimpar' ;; |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/mtt_m2p from [44cf73e41f] to [e3345e4426].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.64 2001/02/03 14:00:01 gawthrop ## Geraint's temp. variable patch applied ## ## Revision 1.63 2000/12/04 08:24:29 peterg ## Added swithc logic declarations ## ## Revision 1.62 2000/12/03 17:15:18 peterg | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.65 2001/02/09 02:56:46 geraint ## Translate some binary operators ## Allows use of ! in logic.txt ## ## Revision 1.64 2001/02/03 14:00:01 gawthrop ## Geraint's temp. variable patch applied ## ## Revision 1.63 2000/12/04 08:24:29 peterg ## Added swithc logic declarations ## ## Revision 1.62 2000/12/03 17:15:18 peterg |
︙ | ︙ | |||
356 357 358 359 360 361 362 | echo " glnpbynp = StateMatrix;" echo " glmpbynp = StateMatrix;" ## echo " IntegrationMethod = 1..4;" echo "" echo "VAR" echo " simpar : SimulationParameters;" echo " t,ddt : REAL;" | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | echo " glnpbynp = StateMatrix;" echo " glmpbynp = StateMatrix;" ## echo " IntegrationMethod = 1..4;" echo "" echo "VAR" echo " simpar : SimulationParameters;" echo " t,ddt : REAL;" echo " x,x0,dx,AAx : StateVector;" echo " mttx,mttdx,mttAAx,mttedx : StateVector;" echo " u,mttu : InputVector;" echo " y,mtty : OutputVector;" echo " par : ParameterVector;" echo " mttpar : ParameterVector;" echo " mttnpar : INTEGER;" echo " AA,mtte : StateMatrix;" |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/octave_ode2odes from [0f25571f14] to [6a41dad2b5].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop 1999 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 2000/05/11 13:43:14 peterg ## No change ## ## Revision 1.1 1999/03/15 23:27:16 peterg ## Initial revision ## ############################################################### echo Creating $1_odes.dat2 $MATRIX <<EOF >octave_ode2odes.log 2>mtt_error.txt | > > > < < | | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # Copyright (c) P.J.Gawthrop 1999 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 2000/05/19 17:47:56 peterg ## Agument to state ## ## Revision 1.2 2000/05/11 13:43:14 peterg ## No change ## ## Revision 1.1 1999/03/15 23:27:16 peterg ## Initial revision ## ############################################################### echo Creating $1_odes.dat2 $MATRIX <<EOF >octave_ode2odes.log 2>mtt_error.txt ## Set up the simulation parameters par = $1_numpar; x_0 = $1_state(par); simpar = $1_simpar; mtt_data = $1_ode2odes(x_0,par,simpar); if is_complex(mtt_data) mtt_error("octave_ode2odes: Simulated data is complex - something is wrong!"); mtt_data = real(mtt_data); endif; save -ascii $1_odes.dat2 mtt_data EOF mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/rbg2abg_m from [8935ad4917] to [dfb39a93d4].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: rbg2abg_m # ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.16 2000/12/05 09:04:08 peterg ## Fixed function () compatibility problem. ## ## Revision 1.15 2000/11/03 14:53:33 peterg ## Copy NOTPAR as well ## ## Revision 1.14 2000/09/14 08:41:35 peterg | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: rbg2abg_m # ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.17 2000/12/05 12:04:03 peterg ## Changed function name to name() ## ## Revision 1.16 2000/12/05 09:04:08 peterg ## Fixed function () compatibility problem. ## ## Revision 1.15 2000/11/03 14:53:33 peterg ## Copy NOTPAR as well ## ## Revision 1.14 2000/09/14 08:41:35 peterg |
︙ | ︙ | |||
221 222 223 224 225 226 227 | if mtt_error mtt_error.txt then exit 0 else exit 1 fi | < < < < < < | 224 225 226 227 228 229 230 | if mtt_error mtt_error.txt then exit 0 else exit 1 fi |