From: Geraint P. B. <ge...@us...> - 2005-11-16 00:43:23
|
Update of /cvsroot/mtt/mttroot/mtt/bin/trans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6672/bin/trans Modified Files: make_ode2odes mtt_header sympar2rtxi_txt2cc sympar2rtxi_txt2h Log Message: rtxi Index: make_ode2odes =================================================================== RCS file: /cvsroot/mtt/mttroot/mtt/bin/trans/make_ode2odes,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** make_ode2odes 26 Apr 2005 23:43:34 -0000 1.90 --- make_ode2odes 16 Nov 2005 00:43:15 -0000 1.91 *************** *** 10,13 **** --- 10,16 ---- ## $Id$ ## $Log$ + ## Revision 1.91 2005/11/16 00:43:15 geraint + ## rtxi + ## ## Revision 1.90 2005/04/26 23:43:34 geraint ## Reset open switches after update to eliminate overshoots. *************** *** 560,563 **** --- 563,567 ---- #define OCTAVEDLD 1 #define MATLABMEX 2 + #define RTXI 3 #if (! defined (CODEGENTARGET)) #define CODEGENTARGET STANDALONE *************** *** 578,582 **** #include <fstream> ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) extern ColumnVector ${sys}_${ae} ( --- 582,586 ---- #include <fstream> ! #if (CODEGENTARGET != OCTAVEDLD) extern ColumnVector ${sys}_${ae} ( *************** *** 675,679 **** cat <<EOF >> $filename ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) ColumnVector --- 679,683 ---- cat <<EOF >> $filename ! #endif // (CODEGENTARGET != OCTAVEDLD) ColumnVector *************** *** 683,687 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_${ae}(x,u,t,par); #elif (CODEGENTARGET == OCTAVEDLD) --- 687,691 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${ae}(x,u,t,par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 693,697 **** f = feval ("${sys}_${ae}", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 697,701 ---- f = feval ("${sys}_${ae}", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 732,736 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_logic (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) --- 736,740 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_logic (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 742,746 **** f = feval ("${sys}_logic", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 746,750 ---- f = feval ("${sys}_logic", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 748,752 **** mtt_numpar (void) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_numpar (); #elif (CODEGENTARGET == OCTAVEDLD) --- 752,756 ---- mtt_numpar (void) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_numpar (); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 754,758 **** f = feval ("${sys}_numpar", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 758,762 ---- f = feval ("${sys}_numpar", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 760,764 **** mtt_simpar (void) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_simpar (); #elif (CODEGENTARGET == OCTAVEDLD) --- 764,768 ---- mtt_simpar (void) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_simpar (); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 766,770 **** f = feval ("${sys}_simpar", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 770,774 ---- f = feval ("${sys}_simpar", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 772,776 **** mtt_state (const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_state (par); #elif (CODEGENTARGET == OCTAVEDLD) --- 776,780 ---- mtt_state (const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_state (par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 779,783 **** f = feval ("${sys}_state", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 783,787 ---- f = feval ("${sys}_state", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 788,792 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_${ode} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) --- 792,796 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${ode} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 798,802 **** f = feval ("${sys}_${ode}", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 802,806 ---- f = feval ("${sys}_${ode}", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 807,811 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_${odeo} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) --- 811,815 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${odeo} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 817,821 **** f = feval ("${sys}_${odeo}", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 821,825 ---- f = feval ("${sys}_${odeo}", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 847,851 **** const ColumnVector &open_switches) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) --- 851,855 ---- const ColumnVector &open_switches) { ! #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 860,864 **** f = feval ("mtt_implicit", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 864,868 ---- f = feval ("mtt_implicit", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 869,873 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_smxa (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) --- 873,877 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_smxa (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 879,883 **** f = feval ("${sys}_smxa", args, 1); return f(0).matrix_value (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 883,887 ---- f = feval ("${sys}_smxa", args, 1); return f(0).matrix_value (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 888,892 **** const ColumnVector &par) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_smxax (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) --- 892,896 ---- const ColumnVector &par) { ! #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_smxax (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 898,902 **** f = feval ("${sys}_smxax", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 902,906 ---- f = feval ("${sys}_smxax", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 916,920 **** const ColumnVector &open_switches) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return Fmtt_dassl (x, u, t, par, dx, ddt, nx, nyz, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) --- 920,924 ---- const ColumnVector &open_switches) { ! #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_dassl (x, u, t, par, dx, ddt, nx, nyz, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 931,938 **** f = feval ("mtt_dassl", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) ColumnVector Fmtt_residual (const ColumnVector &X, --- 935,942 ---- f = feval ("mtt_dassl", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } ! #if (CODEGENTARGET != OCTAVEDLD) ColumnVector Fmtt_residual (const ColumnVector &X, *************** *** 953,957 **** t = args(2).double_value (); ires = static_cast<int>(args(3).double_value ()); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) static ColumnVector residual (MTTNX+MTTNYZ); --- 957,961 ---- t = args(2).double_value (); ires = static_cast<int>(args(3).double_value ()); ! #endif // (CODEGENTARGET != OCTAVEDLD) static ColumnVector residual (MTTNX+MTTNYZ); *************** *** 972,976 **** ui = X.extract (MTTNX,MTTNX+MTTNYZ-1); ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) par = ${sys}_numpar(); u = ${sys}_input(x,y,t,par); --- 976,980 ---- ui = X.extract (MTTNX,MTTNX+MTTNYZ-1); ! #if (CODEGENTARGET != OCTAVEDLD) par = ${sys}_numpar(); u = ${sys}_input(x,y,t,par); *************** *** 982,986 **** new_args(3) = octave_value (par); u = feval ("${sys}_input", new_args, 1)(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) U.insert (u,0); --- 986,990 ---- new_args(3) = octave_value (par); u = feval ("${sys}_input", new_args, 1)(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) U.insert (u,0); *************** *** 988,992 **** U.insert (ui,MTTNU); ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) dx = ${sys}_${ode} (x,U,t,par); yz = ${sys}_${ae} (x,U,t,par); --- 992,996 ---- U.insert (ui,MTTNU); ! #if (CODEGENTARGET != OCTAVEDLD) dx = ${sys}_${ode} (x,U,t,par); yz = ${sys}_${ae} (x,U,t,par); *************** *** 995,999 **** dx = feval ("${sys}_${ode}", new_args, 1)(0).${vector_value} (); yz = feval ("${sys}_${ae}", new_args, 1)(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) for (register int i = 0; i < MTTNX; i++) --- 999,1003 ---- dx = feval ("${sys}_${ode}", new_args, 1)(0).${vector_value} (); yz = feval ("${sys}_${ae}", new_args, 1)(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) for (register int i = 0; i < MTTNX; i++) *************** *** 1021,1029 **** } ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return residual; #elif (CODEGENTARGET == OCTAVEDLD) return octave_value (residual); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 1025,1033 ---- } ! #if (CODEGENTARGET != OCTAVEDLD) return residual; #elif (CODEGENTARGET == OCTAVEDLD) return octave_value (residual); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 1039,1043 **** const ColumnVector &open_switches) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return Fmtt_euler (x, dx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) --- 1043,1047 ---- const ColumnVector &open_switches) { ! #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_euler (x, dx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) *************** *** 1050,1054 **** f = feval ("mtt_euler", args, 1); return f(0).${vector_value} (); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } --- 1054,1058 ---- f = feval ("mtt_euler", args, 1); return f(0).${vector_value} (); ! #endif // (CODEGENTARGET != OCTAVEDLD) } *************** *** 1113,1117 **** if (nrows == row) { ! #if (CODEGENTARGET == STANDALONE) file $insertor "# name: mtt_dump" $insertor std::endl $insertor "# type: matrix" $insertor std::endl --- 1117,1121 ---- if (nrows == row) { ! #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == RTXI)) file $insertor "# name: mtt_dump" $insertor std::endl $insertor "# type: matrix" $insertor std::endl *************** *** 1122,1126 **** #elif ((CODEGENTARGET == OCTAVEDLD) || (CODEGENTARGET == MATLABMEX)) set_global_value ("MTT_data", data); ! #endif // (CODEGENTARGET == STANDALONE) row = 0; fcputime.close(); --- 1126,1130 ---- #elif ((CODEGENTARGET == OCTAVEDLD) || (CODEGENTARGET == MATLABMEX)) set_global_value ("MTT_data", data); ! #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == RTXI)) row = 0; fcputime.close(); *************** *** 1128,1131 **** --- 1132,1148 ---- } + #if (CODEGENTARGET == RTXI) + #include "${sys}_rtxi.h" + void + ${sys}::execute(void) + { + static ColumnVector simpar (8), par (MTTNPAR), state0 (MTTNX); + + simpar = mtt_simpar (); + par = mtt_numpar (); + state0 = mtt_state (par); + + #else + void ${sys}_ode2odes (const ColumnVector &state0, *************** *** 1133,1136 **** --- 1150,1154 ---- const ColumnVector &simpar) { + #endif // (CODEGENTARGET == RTXI) static double first, dt, last, stepfactor; first = simpar (0); *************** *** 1158,1161 **** --- 1176,1182 ---- { y (i) = 0.0; + #if (CODEGENTARGET == RTXI) + output(i) = y(i); + #endif // (CODEGENTARGET == RTXI) } *************** *** 1167,1175 **** for (register int j = 0, i = 1; i <= ilast; i++) { u = mtt_input (x, y, t, par); y = mtt_output (x, u, t, par); if (0 == j) { ! mtt_write (t, x, y, first, nrows); } EOF --- 1188,1208 ---- for (register int j = 0, i = 1; i <= ilast; i++) { + #if (CODEGENTARGET != RTXI) u = mtt_input (x, y, t, par); + #else + for (register int i = 0; i < MTTNU; i++) { + u(i) = input(i); + } + #endif // (CODEGENTARGET != RTXI) y = mtt_output (x, u, t, par); if (0 == j) { ! #if (CODEGENTARGET != RTXI) ! mtt_write (t, x, y, first, nrows); ! #else ! for (register int i = 0; i < MTTNU; i++) { ! output(i) = y(i); ! } ! #endif // (CODEGENTARGET != RTXI) } EOF *************** *** 1382,1385 **** --- 1415,1419 ---- } } + #endif // (CODEGENTARGET == STANDALONE) Index: sympar2rtxi_txt2cc =================================================================== RCS file: /cvsroot/mtt/mttroot/mtt/bin/trans/sympar2rtxi_txt2cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sympar2rtxi_txt2cc 13 Nov 2005 18:15:27 -0000 1.1 --- sympar2rtxi_txt2cc 16 Nov 2005 00:43:15 -0000 1.2 *************** *** 2,10 **** sys=$1 - Sys=$(capitalise_initial $sys) struc=${sys}_struc.txt sympar=${sys}_sympar.txt ! RTXI_H="${Sys}_rtxi.h" ! RTXI_CC="${Sys}_rtxi.cc" program=$(basename $0) date=$(date) --- 2,9 ---- sys=$1 struc=${sys}_struc.txt sympar=${sys}_sympar.txt ! RTXI_H="${sys}_rtxi.h" ! RTXI_CC="${sys}_rtxi.cc" program=$(basename $0) date=$(date) *************** *** 20,24 **** extern "C" Plugin::Object *createRTXIPlugin(void) { ! return new ${Sys}(); } --- 19,23 ---- extern "C" Plugin::Object *createRTXIPlugin(void) { ! return new ${sys}(); } *************** *** 70,80 **** static long i_count = 0; ! ${Sys}::~${Sys}(void) {} ! void ${Sys}::execute(void) { ! // TODO: call ode2odes functions ! } ! void ${Sys}::update(DefaultGUIModel::update_flags_t flag) { setCaption("${sys}"); switch(flag) { --- 69,77 ---- static long i_count = 0; ! ${sys}::~${sys}(void) {} ! // ${sys}::execute(void) is defined in ${sys}_ode2odes.cc ! void ${sys}::update(DefaultGUIModel::update_flags_t flag) { setCaption("${sys}"); switch(flag) { Index: sympar2rtxi_txt2h =================================================================== RCS file: /cvsroot/mtt/mttroot/mtt/bin/trans/sympar2rtxi_txt2h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sympar2rtxi_txt2h 13 Nov 2005 18:15:27 -0000 1.1 --- sympar2rtxi_txt2h 16 Nov 2005 00:43:15 -0000 1.2 *************** *** 2,8 **** sys=$1 - Sys=$(capitalise_initial $sys) sympar=${sys}_sympar.txt ! RTXI_H="${Sys}_rtxi.h" program=$(basename $0) date=$(date) --- 2,7 ---- sys=$1 sympar=${sys}_sympar.txt ! RTXI_H="${sys}_rtxi.h" program=$(basename $0) date=$(date) *************** *** 18,28 **** #include <default_gui_model.h> ! class $Sys : public DefaultGUIModel { public: ! $Sys(void); ! virtual ~$Sys(void); virtual void execute(void); --- 17,27 ---- #include <default_gui_model.h> ! class $sys : public DefaultGUIModel { public: ! $sys(void); ! virtual ~$sys(void); virtual void execute(void); Index: mtt_header =================================================================== RCS file: /cvsroot/mtt/mttroot/mtt/bin/trans/mtt_header,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** mtt_header 17 Feb 2005 18:54:23 -0000 1.66 --- mtt_header 16 Nov 2005 00:43:15 -0000 1.67 *************** *** 13,16 **** --- 13,19 ---- ## $Id$ ## $Log$ + ## Revision 1.67 2005/11/16 00:43:15 geraint + ## rtxi + ## ## Revision 1.66 2005/02/17 18:54:23 geraint ## Fixed a bash-sim: replaced let with $(( )) *************** *** 930,933 **** --- 933,937 ---- #define OCTAVEDLD 1 #define MATLABMEX 2 + #define RTXI 3 #ifndef CODEGENTARGET #define CODEGENTARGET STANDALONE |