Overview
Comment: | rtxi |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
aca770446bc58057f1117aab4326218d |
User & Date: | geraint@users.sourceforge.net on 2005-11-16 00:43:15 |
Other Links: | branch diff | manifest | tags |
Context
2005-11-18
| ||
17:23:19 | rtxi. check-in: 37b5fb06f3 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2005-11-16
| ||
00:43:15 | rtxi check-in: aca770446b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2005-11-13
| ||
18:15:27 | *** empty log message *** check-in: 8d4d0bc2dc user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/mtt from [e0d9c1bc61] to [98626a6b53].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.411 2005/03/15 15:03:28 gawthrop ## Now works for Hierarchical systems ## ## Revision 1.410 2005/03/15 13:35:50 gawthrop ## Pretty abg figure in reports. ## ## Revision 1.409 2005/03/15 12:03:17 gawthrop | > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.412 2005/09/29 13:46:25 gawthrop ## Converts labg.fig -> ps/eps correctly (using fig2ps) ## ## Revision 1.411 2005/03/15 15:03:28 gawthrop ## Now works for Hierarchical systems ## ## Revision 1.410 2005/03/15 13:35:50 gawthrop ## Pretty abg figure in reports. ## ## Revision 1.409 2005/03/15 12:03:17 gawthrop |
︙ | ︙ | |||
1777 1778 1779 1780 1781 1782 1783 | mtt copy <system_name> <path_name> mtt rename <old_name> <new_name> mtt <system_name> <representation> vc mtt <system_name> <representation> <language> mtt <system_name> <representation> <language> <parameters> Options: | | | 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 | mtt copy <system_name> <path_name> mtt rename <old_name> <new_name> mtt <system_name> <representation> vc mtt <system_name> <representation> <language> mtt <system_name> <representation> <language> <parameters> Options: -A solve algebraic equations symbolically -abg start at abg.m representation -ae <method> algebraic equation solver: reduce|hybrd|dassl|hooke -cc C++ code generation -cr use cr before resolving equations -D debug -- leave log files etc -d <dir> use directory <dir> -dc maximise derivative (not integral) causality |
︙ | ︙ | |||
3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | make_ode2odes $1 m $integration_method $algebraic_solver $sort_method endif endif #SUMMARY ode2odes Simulation function (m) #SUMMARY ode2odes Simulation function (cc) #SUMMARY ode2odes Simulation function (oct) #SUMMARY ode2odes Simulation function (exe) $1_ode2odes.exe: $1_def.h $1_sympar.h\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o echo Creating $1_ode2odes.exe ${MTT_CXX} ${MTT_CXXFLAGS} -o $1_ode2odes.exe\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o\ ${MTT_LDFLAGS} ${MTT_CXXLIBS} | > | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 | make_ode2odes $1 m $integration_method $algebraic_solver $sort_method endif endif #SUMMARY ode2odes Simulation function (m) #SUMMARY ode2odes Simulation function (cc) #SUMMARY ode2odes Simulation function (oct) #SUMMARY ode2odes_rtxi Simulation function (o) #SUMMARY ode2odes Simulation function (exe) $1_ode2odes.exe: $1_def.h $1_sympar.h\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o echo Creating $1_ode2odes.exe ${MTT_CXX} ${MTT_CXXFLAGS} -o $1_ode2odes.exe\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o\ ${MTT_LDFLAGS} ${MTT_CXXLIBS} |
︙ | ︙ | |||
3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 | touch $1_ode2odes.m echo Creating $1_ode2odes.mexglx ${MTT_CXX} -DCODEGENTARGET=MATLABMEX -o $1_ode2odes.mexglx $1_ode2odes.cc \ $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o \ ${MTT_MATLAB_FLAGS} ${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} \ ${MTT_LIB}/cc/mtt_kpathsea.cc ${MTT_LIB}/cc/mtt_matlab_octave.cc $1_ode2odes.cc: $1_def.r $1_sympars.txt\ $1_ode2odes_common_m.stamp $1_ode2odes_common_cc.stamp\ $1_ode2odes_${integration_method}_m.stamp $1_ode2odes_${integration_method}_cc.stamp\ mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh touch $1_ode2odes.m make_ode2odes $1 cc $integration_method $algebraic_solver $sort_method #Conversion of m to p to c #SUMMARY ode ordinary differential equations (c) #SUMMARY ode ordinary differential equations (p) #SUMMARY state state declaration (c) #SUMMARY state state declaration (p) $1_simpar.p : $1_def.r $1_simpar.m | > > > > > > > > > > > > > > > > > > > | 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 | touch $1_ode2odes.m echo Creating $1_ode2odes.mexglx ${MTT_CXX} -DCODEGENTARGET=MATLABMEX -o $1_ode2odes.mexglx $1_ode2odes.cc \ $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o \ ${MTT_MATLAB_FLAGS} ${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} \ ${MTT_LIB}/cc/mtt_kpathsea.cc ${MTT_LIB}/cc/mtt_matlab_octave.cc $1_ode2odes_rtxi.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o \ $1_rtxi.cc $1_rtxi.h echo Creating $1_ode2odes_rtxi.o ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} ${MTT_RTXI_FLAGS} -c $1_ode2odes.cc -DCODEGENTARGET=RTXI -o \$@ $1_ode2odes.cc: $1_def.r $1_sympars.txt\ $1_ode2odes_common_m.stamp $1_ode2odes_common_cc.stamp\ $1_ode2odes_${integration_method}_m.stamp $1_ode2odes_${integration_method}_cc.stamp\ mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh touch $1_ode2odes.m make_ode2odes $1 cc $integration_method $algebraic_solver $sort_method #SUMMARY rtxi real time module (cc) #$1_rtxi.o: $1_rtxi.cc $1_rtxi.h # ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c \$^ $1_rtxi.cc: $1_struc.txt $1_sympar.txt echo Creating \$@ sympar2rtxi_txt2cc $1 $1_rtxi.h: $1_sympar.txt echo Creating \$@ sympar2rtxi_txt2h $1 #Conversion of m to p to c #SUMMARY ode ordinary differential equations (c) #SUMMARY ode ordinary differential equations (p) #SUMMARY state state declaration (c) #SUMMARY state state declaration (p) $1_simpar.p : $1_def.r $1_simpar.m |
︙ | ︙ |
Modified mttroot/mtt/bin/mttrc from [f035813035] to [8403c03a9c].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.40 2003/09/23 15:57:18 gawthrop ## And back to gv ## ## Revision 1.39 2003/09/22 17:38:56 gawthrop ## gv --> ghostview ## ## Revision 1.38 2003/07/13 21:53:24 geraint | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.41 2004/02/17 17:53:34 geraint ## Fixed [ 898739 ] libhdf5 dependency breaks -cc reps. ## Now uses mkoctfile to determine include and library flags. ## ## Revision 1.40 2003/09/23 15:57:18 gawthrop ## And back to gv ## ## Revision 1.39 2003/09/22 17:38:56 gawthrop ## gv --> ghostview ## ## Revision 1.38 2003/07/13 21:53:24 geraint |
︙ | ︙ | |||
297 298 299 300 301 302 303 304 305 306 307 | MATLAB_LIBS="-Wl,--rpath-link,${MATLAB_ROOT}/extern/lib/${MATLAB_ARCH},--rpath-link,${MATLAB_ROOT}/bin/${MATLAB_ARCH} -L${MATLAB_ROOT}/bin/${MATLAB_ARCH} -lmx -lmex -lm" # exported variables export MTT_MATLAB_FLAGS="${MATLAB_FLAGS} ${MATLAB_INCS} ${MATLAB_LIBS}" ## End of Matlab environment configuration ## ############################################################# fi | > > > > > > > > > > > > > > | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | MATLAB_LIBS="-Wl,--rpath-link,${MATLAB_ROOT}/extern/lib/${MATLAB_ARCH},--rpath-link,${MATLAB_ROOT}/bin/${MATLAB_ARCH} -L${MATLAB_ROOT}/bin/${MATLAB_ARCH} -lmx -lmex -lm" # exported variables export MTT_MATLAB_FLAGS="${MATLAB_FLAGS} ${MATLAB_INCS} ${MATLAB_LIBS}" ## End of Matlab environment configuration ## ############################################################# ####################################################### ## ## Configure environment for compilation of RTXI module RTXI_INCS="-I/usr/local/src/mtt/rtxi/rtxi_cvs_30Sep05/include -I/usr/include/qt3" # MORE_RTXI_INCS="-I/usr/realtime/include -I/usr/src/linux/include" RTXI_FLAGS="-DHAVE_CONFIG_H -D_REENTRANT -DQT_THREAD_SUPPORT" export MTT_RTXI_FLAGS="${RTXI_INCS}" ## End of RTXI environment configuration ## ############################################################# fi |
Modified mttroot/mtt/bin/trans/make_ode2odes from [24363b5ab0] to [4c433b0d7e].
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.89 2004/08/29 16:04:44 geraint ## Fixed ae for non-sorted code. ## ## Revision 1.88 2004/08/29 13:15:28 geraint ## Uses sys_sae instead of sys_ae if sorted equations are being used. ## ## Revision 1.87 2004/08/29 01:46:56 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.90 2005/04/26 23:43:34 geraint ## Reset open switches after update to eliminate overshoots. ## ## Revision 1.89 2004/08/29 16:04:44 geraint ## Fixed ae for non-sorted code. ## ## Revision 1.88 2004/08/29 13:15:28 geraint ## Uses sys_sae instead of sys_ae if sorted equations are being used. ## ## Revision 1.87 2004/08/29 01:46:56 geraint |
︙ | ︙ | |||
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | cat <<EOF > $filename // Code generation directives #define STANDALONE 0 #define OCTAVEDLD 1 #define MATLABMEX 2 #if (! defined (CODEGENTARGET)) #define CODEGENTARGET STANDALONE #endif // (! defined (CODEGENTARGET)) #include <octave/oct.h> #include <octave/lo-mappers.h> #include <octave/variables.h> #if (CODEGENTARGET == OCTAVEDLD) #include <octave/${feval_header}> #endif // (CODEGENTARGET == OCTAVEDLD) #include "${sys}_def.h" #include "${sys}_sympar.h" #include "mtt_${algebraic_solver}.hh" #include <fstream> | > | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | cat <<EOF > $filename // Code generation directives #define STANDALONE 0 #define OCTAVEDLD 1 #define MATLABMEX 2 #define RTXI 3 #if (! defined (CODEGENTARGET)) #define CODEGENTARGET STANDALONE #endif // (! defined (CODEGENTARGET)) #include <octave/oct.h> #include <octave/lo-mappers.h> #include <octave/variables.h> #if (CODEGENTARGET == OCTAVEDLD) #include <octave/${feval_header}> #endif // (CODEGENTARGET == OCTAVEDLD) #include "${sys}_def.h" #include "${sys}_sympar.h" #include "mtt_${algebraic_solver}.hh" #include <fstream> #if (CODEGENTARGET != OCTAVEDLD) extern ColumnVector ${sys}_${ae} ( const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par); |
︙ | ︙ | |||
667 668 669 670 671 672 673 | const ColumnVector &open_switches); EOF ;; esac cat <<EOF >> $filename | | | | | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | const ColumnVector &open_switches); EOF ;; esac cat <<EOF >> $filename #endif // (CODEGENTARGET != OCTAVEDLD) ColumnVector mtt_ae (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${ae}(x,u,t,par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_${ae}", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_input (const ColumnVector &x, const ColumnVector &y, const double &t, const ColumnVector &par) |
︙ | ︙ | |||
724 725 726 727 728 729 730 | inline ColumnVector mtt_logic (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { | | | | | | | | | | | | | | 728 729 730 731 732 733 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 | inline ColumnVector mtt_logic (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_logic (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_logic", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_numpar (void) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_numpar (); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; f = feval ("${sys}_numpar", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_simpar (void) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_simpar (); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; f = feval ("${sys}_simpar", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_state (const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_state (par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (par); f = feval ("${sys}_state", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_rate (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${ode} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_${ode}", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_output (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_${odeo} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_${odeo}", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_zeroswitches (ColumnVector &x, const int Nx, const ColumnVector &openx) { |
︙ | ︙ | |||
839 840 841 842 843 844 845 | ColumnVector &dx, Matrix &AA, ColumnVector &AAx, const double &ddt, const int &nx, const ColumnVector &open_switches) { | | | | | | | | | | | | | | | | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | ColumnVector &dx, Matrix &AA, ColumnVector &AAx, const double &ddt, const int &nx, const ColumnVector &open_switches) { #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (dx); args (2) = octave_value (AA); args (3) = octave_value (AAx); args (4) = octave_value (ddt); args (5) = octave_value ((double)nx); args (6) = octave_value (open_switches); f = feval ("mtt_implicit", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline Matrix mtt_smxa (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_smxa (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_smxa", args, 1); return f(0).matrix_value (); #endif // (CODEGENTARGET != OCTAVEDLD) } inline ColumnVector mtt_smxax (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { #if (CODEGENTARGET != OCTAVEDLD) return ${sys}_smxax (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_smxax", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } EOF ;; "dassl") cat <<EOF >> $filename inline ColumnVector mtt_dassl (ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par, const ColumnVector &dx, const double &ddt, const int &nx, const int &nyz, const ColumnVector &open_switches) { #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_dassl (x, u, t, par, dx, ddt, nx, nyz, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); args (4) = octave_value (dx); args (5) = octave_value (ddt); args (6) = octave_value (static_cast<double> (nx)); args (7) = octave_value (static_cast<double> (nyz)); args (8) = octave_value (open_switches); f = feval ("mtt_dassl", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } #if (CODEGENTARGET != OCTAVEDLD) ColumnVector Fmtt_residual (const ColumnVector &X, const ColumnVector &DX, double t, int &ires) { #elif (CODEGENTARGET == OCTAVEDLD) DEFUN_DLD (mtt_residual, args, , "mtt_residual") { static ColumnVector X (MTTNX+MTTNYZ); static ColumnVector DX (MTTNX+MTTNYZ); static double t; static int ires; X = args(0).${vector_value} (); DX = args(1).${vector_value} (); t = args(2).double_value (); ires = static_cast<int>(args(3).double_value ()); #endif // (CODEGENTARGET != OCTAVEDLD) static ColumnVector residual (MTTNX+MTTNYZ); static ColumnVector U (MTTNU+MTTNYZ); static ColumnVector u (MTTNU); static ColumnVector y (MTTNY,0.0); static ColumnVector par (MTTNPAR); static ColumnVector dx(MTTNX); static ColumnVector yz(MTTNYZ); static ColumnVector x (MTTNX); static ColumnVector ui (MTTNYZ); static octave_value_list new_args; x = X.extract (0,MTTNX-1); if (MTTNYZ > 0) ui = X.extract (MTTNX,MTTNX+MTTNYZ-1); #if (CODEGENTARGET != OCTAVEDLD) par = ${sys}_numpar(); u = ${sys}_input(x,y,t,par); #elif (CODEGENTARGET == OCTAVEDLD) par = feval ("${sys}_numpar", new_args, 1)(0).${vector_value} (); new_args(0) = octave_value (x); new_args(1) = octave_value (u); new_args(2) = octave_value (t); new_args(3) = octave_value (par); u = feval ("${sys}_input", new_args, 1)(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) U.insert (u,0); if (MTTNYZ > 0) U.insert (ui,MTTNU); #if (CODEGENTARGET != OCTAVEDLD) dx = ${sys}_${ode} (x,U,t,par); yz = ${sys}_${ae} (x,U,t,par); #elif (CODEGENTARGET == OCTAVEDLD) new_args(1) = octave_value (U); 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++) residual (i) = dx(i) - DX(i); if (MTTNYZ > 0) { residual.insert (yz,MTTNX); |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | } else step = t; for (register int i = MTTNX; i < MTTNX+MTTNYZ; i++) residual(i) += X(i) - DX(i)*step; } | | | | | | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | } else step = t; for (register int i = MTTNX; i < MTTNX+MTTNYZ; i++) residual(i) += X(i) - DX(i)*step; } #if (CODEGENTARGET != OCTAVEDLD) return residual; #elif (CODEGENTARGET == OCTAVEDLD) return octave_value (residual); #endif // (CODEGENTARGET != OCTAVEDLD) } EOF ;; "euler" | "rk4" | *) cat <<EOF >> $filename inline ColumnVector mtt_euler (ColumnVector &x, const ColumnVector &dx, const double &ddt, const int &nx, const ColumnVector &open_switches) { #if (CODEGENTARGET != OCTAVEDLD) return Fmtt_euler (x, dx, ddt, nx, open_switches); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (dx); args (2) = octave_value (ddt); args (3) = octave_value ((double)nx); args (4) = octave_value (open_switches); f = feval ("mtt_euler", args, 1); return f(0).${vector_value} (); #endif // (CODEGENTARGET != OCTAVEDLD) } EOF ;; esac cat <<EOF >> $filename |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | fcputime $insertor t $insertor '\t' $insertor static_cast <double> (cputime - cputime0) / CLOCKS_PER_SEC $insertor '\t' $insertor static_cast <double> (cputime - cputime1) / CLOCKS_PER_SEC $insertor std::endl; cputime1 = cputime; if (nrows == row) { | | | > > > > > > > > > > > > > > | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | fcputime $insertor t $insertor '\t' $insertor static_cast <double> (cputime - cputime0) / CLOCKS_PER_SEC $insertor '\t' $insertor static_cast <double> (cputime - cputime1) / CLOCKS_PER_SEC $insertor std::endl; cputime1 = cputime; if (nrows == row) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == RTXI)) file $insertor "# name: mtt_dump" $insertor std::endl $insertor "# type: matrix" $insertor std::endl $insertor "# rows: " $insertor data.rows () $insertor std::endl $insertor "# columns: " $insertor data.columns () $insertor std::endl $insertor data; file.flush (); #elif ((CODEGENTARGET == OCTAVEDLD) || (CODEGENTARGET == MATLABMEX)) set_global_value ("MTT_data", data); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == RTXI)) row = 0; fcputime.close(); } } #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, const ColumnVector &par, const ColumnVector &simpar) { #endif // (CODEGENTARGET == RTXI) static double first, dt, last, stepfactor; first = simpar (0); last = simpar (1); dt = simpar (2); stepfactor = simpar (3); static ColumnVector dx (MTTNX, 0.0); |
︙ | ︙ | |||
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | const double ddt = dt / stepfactor; const int ilast = static_cast<int> (round ( last / 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) = state0 (i); } 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) { | > > > > > > > > > > | > > > > > | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | const double ddt = dt / stepfactor; const int ilast = static_cast<int> (round ( last / 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; #if (CODEGENTARGET == RTXI) output(i) = y(i); #endif // (CODEGENTARGET == RTXI) } for (register int i = 0; i < MTTNX; i++) { x (i) = state0 (i); } 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 case "$method" in "rk4") cat << EOF >> $filename { static ColumnVector |
︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | } ${sys}_ode2odes (state0, numpar, simpar); plhs[0] = mtt_mxArray (get_global_value ("MTT_data").matrix_value ()); } } #endif // (CODEGENTARGET == STANDALONE) EOF } case ${lang} in m) | > | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | } ${sys}_ode2odes (state0, numpar, simpar); plhs[0] = mtt_mxArray (get_global_value ("MTT_data").matrix_value ()); } } #endif // (CODEGENTARGET == STANDALONE) EOF } case ${lang} in m) |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/mtt_header from [2b6f388347] to [af77a75d17].
︙ | ︙ | |||
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.65 2004/08/29 13:14:29 geraint ## Added rule to make header for sae (sorted algebraic equations). ## ## Revision 1.64 2004/08/29 01:48:46 geraint ## Added rules to create headers for sorted systems: sesx and sesy. ## ## Revision 1.63 2004/08/28 22:08:41 geraint | > > > | 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.66 2005/02/17 18:54:23 geraint ## Fixed a bash-sim: replaced let with $(( )) ## ## Revision 1.65 2004/08/29 13:14:29 geraint ## Added rule to make header for sae (sorted algebraic equations). ## ## Revision 1.64 2004/08/29 01:48:46 geraint ## Added rules to create headers for sorted systems: sesx and sesy. ## ## Revision 1.63 2004/08/28 22:08:41 geraint |
︙ | ︙ | |||
922 923 924 925 926 927 928 929 930 931 932 933 934 935 | #include "${system}_def.h" #include "${system}_sympar.h" // Code generation directives #define STANDALONE 0 #define OCTAVEDLD 1 #define MATLABMEX 2 #ifndef CODEGENTARGET #define CODEGENTARGET STANDALONE #endif // CODEGENTARGET ${arg_type} ${system}_${rep} ( EOF if [ -z ${args:-""} ]; then | > | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | #include "${system}_def.h" #include "${system}_sympar.h" // Code generation directives #define STANDALONE 0 #define OCTAVEDLD 1 #define MATLABMEX 2 #define RTXI 3 #ifndef CODEGENTARGET #define CODEGENTARGET STANDALONE #endif // CODEGENTARGET ${arg_type} ${system}_${rep} ( EOF if [ -z ${args:-""} ]; then |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar2rtxi_txt2cc from [fbdb9437f7] to [690d3775c3].
1 2 3 | #! /bin/sh sys=$1 | < | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #! /bin/sh 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) cat <<EOF > ${RTXI_CC} // -*-c++-*- Put Emacs into c++-mode // Generated from $sympar and $struc by MTT // using $program // at $date #include <${RTXI_H}> extern "C" Plugin::Object *createRTXIPlugin(void) { return new ${sys}(); } static DefaultGUIModel::variable_t vars[] = { EOF gawk ' ($1=="input") { |
︙ | ︙ | |||
65 66 67 68 69 70 71 | { printf(" %s=0.0,\n", $1); } END {printf(" ;\n"); } ' $sympar >> ${RTXI_CC} cat <<EOF >> ${RTXI_CC} static long i_count = 0; | | | < | < | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | { printf(" %s=0.0,\n", $1); } END {printf(" ;\n"); } ' $sympar >> ${RTXI_CC} cat <<EOF >> ${RTXI_CC} 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) { case INIT: EOF gawk ' { |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar2rtxi_txt2h from [6fe211e926] to [7eba5b84fa].
1 2 3 | #! /bin/sh sys=$1 | < | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #! /bin/sh sys=$1 sympar=${sys}_sympar.txt RTXI_H="${sys}_rtxi.h" program=$(basename $0) date=$(date) cat <<EOF > ${RTXI_H} // -*-c++-*- Put Emacs into c++-mode // Generated from $sympar by MTT // using $program // at $date #include <rt.h> #include <default_gui_model.h> class $sys : public DefaultGUIModel { public: $sys(void); virtual ~$sys(void); virtual void execute(void); protected: virtual void update(DefaultGUIModel::update_flags_t); |
︙ | ︙ |