Overview
Comment: | Code for Simulink S-function target written direct to sfun.cc instead of calling .mexglx files. This eliminates the sfun dependency on Octave ColumnVectors. sys_sfun.cc should build directly on a MS Windows machine (can't test this yet). added sfun.zip target to create source code to export. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d9e3b30dc2047e52a3939ebf68080e8c |
User & Date: | geraint@users.sourceforge.net on 2002-05-15 14:22:26 |
Other Links: | branch diff | manifest | tags |
Context
2002-05-15
| ||
16:32:35 | Now notices changes in numpar state input and simpar check-in: 84114d6041 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
14:22:26 |
Code for Simulink S-function target written direct to sfun.cc instead of calling .mexglx files. This eliminates the sfun dependency on Octave ColumnVectors. sys_sfun.cc should build directly on a MS Windows machine (can't test this yet). added sfun.zip target to create source code to export. check-in: d9e3b30dc2 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
11:01:24 | New PI controller component check-in: 2d57a51128 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/mtt from [2e04af1961] to [af644c2eee].
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + + + + | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.344 2002/05/11 01:14:17 geraint ## Fix for [ 553218 ] simpar.oct and simpar.m different. ## Translation added between ColumnVector in base .cc and Octave_map in .oct. ## ## Revision 1.343 2002/05/10 14:07:16 geraint ## Preserve .cc files. ## ## Revision 1.342 2002/05/10 13:24:58 geraint ## Added initial support for building Simulink S-functions. ## Rates do not update properly yet. ## Inertial switches do not work yet. |
︙ | |||
2156 2157 2158 2159 2160 2161 2162 | 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 | - + | ${MTT_MATLAB_FLAGS} -DCODEGENTARGET=MATLABMEX \ ${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} mtt_kpathsea.cc mtt_matlab_octave.cc ## .cc files .PRECIOUS: %.cc # Don't let mtt delete them .PRECIOUS: $1_%.cc # Don't let mtt delete them $1_%.cc: $1_%.m |
︙ |
Modified mttroot/mtt/bin/trans/mtt_header from [83d0d37bdc] to [c5cc8a3a52].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | + + + + | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.49 2002/05/11 01:14:17 geraint ## Fix for [ 553218 ] simpar.oct and simpar.m different. ## Translation added between ColumnVector in base .cc and Octave_map in .oct. ## ## Revision 1.48 2002/05/08 14:51:03 geraint ## Moved matlab/octave data type conversion functions to a separate file. ## ## Revision 1.47 2002/05/07 23:50:34 geraint ## Preliminary support for Matlab dynamically linked shared objects: ## invoke with: mtt -cc sys rep mexglx ## ode2odes support is not yet included. |
︙ | |||
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | + + + + + + + + + + + + + + | declarestates=no declareinputs=no declareswitches=no ;; oct) modeline="// -*-c++-*- Put Emacs into c++-mode"; Lc='//'; Lb='('; Rb=')'; oct_header=yes; constant_declaration="const double " var_declaration="double " minusone="-1" map="_map" declaredummies=yes ;; sfun) modeline="// -*-c++-*- Put Emacs into c++-mode"; Lc='//' Rc='' Lb='[' Rb=']' start="## BEGIN Code" finish="## END Code" constant_declaration="const double " var_declaration="double " minusone="-1" ;; *) echo Language $language not supported - sorry; exit 1 esac if [ "$rep" = "simpar" ]; then output=${output}${map} # Output is simpar_map in this case fi |
︙ | |||
582 583 584 585 586 587 588 | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | - + - + - + - + | { # Parameters if [ "$parameters" = "yes" ]; then cat <<EOF $Lc Parameters $Rc EOF |
︙ |
Modified mttroot/mtt/bin/trans/sympar2par_txt2m from [c3e5676656] to [ea07b68f51].
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 | 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 33 34 35 36 37 38 39 | + + + - - + + | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: sympar2par_txt2m # Symbolic parameters parameter conversion # Used in lang_header # Copyright (C) 2000 by Peter J. Gawthrop Lb=${5:-'('} Rb=${6:-')'} case $2 in zero) strip_comments <$1_sympar.txt |\ gawk '{ i++; printf(" %s %s = 0.0;\n", tolower($1)); }' ;; set) strip_comments <$1_sympar.txt |\ gawk '{ i++; printf(" %s mttpar(%i) \t= %s;\n", i, tolower($1)); }' ;; *) strip_comments <$1_sympar.txt |\ gawk '{ |
Modified mttroot/mtt/cc/def_m2h.sh from [78c95b87eb] to [8879414d17].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | + + + + | #! /bin/sh # $Id$ # $Log$ # Revision 1.2 2002/04/28 18:58:06 geraint # Fixed [ 549658 ] awk should be gawk. # Replaced calls to awk with call to gawk. # # Revision 1.1 2000/12/28 09:46:05 peterg # put under RCS # # Revision 1.3 2000/12/05 12:13:52 peterg # Changed function name to name() # # Revision 1.2 2000/12/04 12:04:46 peterg |
︙ | |||
24 25 26 27 28 29 30 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | get_array_size () { vec=$1 gawk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;// } |
Modified mttroot/mtt/cc/mtt_m2cc.sh from [d5b350ce6a] to [7e5ae6afba].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + - + - + | #! /bin/sh SYS=$1 REP=$2 TARGET=${3:-cc} |
︙ | |||
105 106 107 108 109 110 111 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - - - - - - - - - - - + + + + + + + + + + + | }; decrement_indices () { # first section appends '-1' to container indices # to convert from FORTRAN-type numbering to C-type numbering |
︙ | |||
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | 151 152 153 154 155 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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + | sed 's/600\-1\([\,\)]\)/599\1/g' |\ sed 's/700\-1\([\,\)]\)/699\1/g' |\ sed 's/800\-1\([\,\)]\)/799\1/g' |\ sed 's/900\-1\([\,\)]\)/899\1/g' |\ sed 's/\([(,]\)0\([0-9]\)/\1\2/g' }; fortran_to_c_paren () { # converts [i] to (i) sed 's/\[\([^[]*\)\]/(\1)/g' } fix_pow () { # matches number^number where number is one or more digits and one or zero decimal points # converts to pow (number, number) sed 's/\([0-9]*\)\(\.\)\{0,1\}\([0-9]*\)\^\([0-9]*\)\(\.\)\{0,1\}\([0-9]*\)/pow \(\1\2\3,\4\5\6\)/g' }; echo Creating ${OUT} case ${TARGET} in sfun) mtt_header ${SYS} ${REP} "sfun" > ${TMP} echo "## END Code" >> ${TMP} find_code ${TMP} head > ${OUT} find_code ${IN} body |\ decrement_indices |\ fix_comment_delimiter |\ fix_pow |\ strip_junk |\ ${PARSER} >> ${OUT} find_code ${TMP} foot >> ${OUT} rm ${TMP} ;; cc | *) |
Modified mttroot/mtt/lib/rep/sfun_rep/Makefile from [0703d3d39e] to [f2177a72f4].
1 2 | 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 | - - - - + + + + + + + + + + + + + + + + + + + + | #! /usr/bin/make -f |
Modified mttroot/mtt/lib/rep/sfun_rep/sfun.cc.tmpl from [3d56d803b8] to [cc87f430f2].
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + - + + + - - - - + + + + + + + - + - + - + - + | // -*-c++-*- |
︙ | |||
89 90 91 92 93 94 95 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - - - - - - - + - + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + - + - - | ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); } #define MDL_INITIALIZE_CONDITIONS static void mdlInitializeConditions(SimStruct *S) { |