Index: mttroot/mtt/bin/trans/mtt_header ================================================================== --- mttroot/mtt/bin/trans/mtt_header +++ mttroot/mtt/bin/trans/mtt_header @@ -10,10 +10,22 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.51 2002/05/19 13:01:21 geraint +## Numerical solution of algebraic equations implemented for S-function target. +## +## Equation solving requires the Matlab Optimization Toolbox to be installed. +## +## Code has been changed from C++ to C to allow mex files to be built with LCC, +## the compiler bundled with Matlab. +## +## Parameters are now obtained from numpar.c instead of a dialogue box. +## +## `mtt sfun zip` creates all necessary files for building the model mex files. +## ## Revision 1.50 2002/05/15 14:22:25 geraint ## 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). @@ -484,10 +496,11 @@ modeline="/* -*-c-*- Put Emacs into c-mode */"; Lc='/*' Rc='*/' Lb='[' Rb=']' + parameters=no constant_declaration="const double " var_declaration="double " minusone="-1" ;; *) Index: mttroot/mtt/lib/rep/sfun_rep/Makefile ================================================================== --- mttroot/mtt/lib/rep/sfun_rep/Makefile +++ mttroot/mtt/lib/rep/sfun_rep/Makefile @@ -9,11 +9,11 @@ $(SYS)_sfun.c:: ${MTT_REP}/sfun_rep/sfun.c.tmpl echo Creating $@ cat $^ | sed 's//$(SYS)/g' > $@ -$(SYS)_sfun_ae.mexglx: $(SYS)_sfun_ae.c $(SYS)_def.h $(SYS)_ae.c +$(SYS)_sfun_ae.mexglx: $(SYS)_sfun_ae.c $(SYS)_def.h $(SYS)_sympar.h $(SYS)_ae.c echo Creating $@ mex $(SYS)_sfun_ae.c $(SYS)_sfun_ae.c:: ${MTT_REP}/sfun_rep/mex_ae.c.tmpl echo Creating $@ @@ -78,16 +78,16 @@ $(SYS)_struc.c: $(SYS)_struc.txt echo Creating $@ gawk '\ ($$1 == "input") { printf " double *%s\t= &(mttu[%d]);\t/* input and output */\n", $$4, $$2-1 }\ -($$1 == "state") { printf " const double *%s\t= &(mttx[%d]);\t/* input */\n", $$4, $$2-1 }\ -($$1 == "output") { printf " const double *%s\t= &(mtty[%d]);\t/* input */\n", $$4, $$2-1 }\ +($$1 == "state") { printf " const double *_%s\t= &(mttx[%d]);\t/* input */\n", $$4, $$2-1 }\ +($$1 == "output") { printf " const double *_%s\t= &(mtty[%d]);\t/* input */\n", $$4, $$2-1 }\ ($$1 != "input" && $$1 != "state" && $$1 != "output") { }\ ' $^ > $@ sfun_debug.h:: ${MTT_REP}/sfun_rep/sfun_debug.h echo Copying $@ cp $^ $@ %:: mtt -q $(OPTS) `echo $* | sed 's/\(.*\)_\(.*\)\.\(.*\)/\1 \2 \3/'` Index: mttroot/mtt/lib/rep/sfun_rep/mex_ae.c.tmpl ================================================================== --- mttroot/mtt/lib/rep/sfun_rep/mex_ae.c.tmpl +++ mttroot/mtt/lib/rep/sfun_rep/mex_ae.c.tmpl @@ -7,10 +7,11 @@ #include #include #include #include "sfun_debug.h" #include "_def.h" +#include "_sympar.h" /* utility procedures */ double * array_of_double (size_t n) Index: mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl ================================================================== --- mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl +++ mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl @@ -10,10 +10,11 @@ #include #include #include "simstruc.h" #include "sfun_debug.h" #include "_def.h" +#include "_sympar.h" static double *mttdx; /* pointer to rates */ static double *mttu; /* pointer to inputs */ static double *mttpar; /* pointer to parameters */ static double *mttx; /* pointer to states */ @@ -33,11 +34,10 @@ } static void _numpar (void) { -#include "_sympar.h" #include "_numpar.c" PRINT_LEAVE; } static void Index: mttroot/mtt/lib/rep/sfun_rep/sfun_input.c.tmpl ================================================================== --- mttroot/mtt/lib/rep/sfun_rep/sfun_input.c.tmpl +++ mttroot/mtt/lib/rep/sfun_rep/sfun_input.c.tmpl @@ -10,10 +10,11 @@ #include #include #include "simstruc.h" #include "sfun_debug.h" #include "_def.h" +#include "_sympar.h" static double *mttu; /* pointer to inputs */ static double *mttpar; /* pointer to parameters */ static double *mttx; /* pointer to states */ static double *mtty; /* pointer to outputs */ @@ -31,11 +32,10 @@ } static void _numpar (void) { -#include "_sympar.h" #include "_numpar.c" PRINT_LEAVE; } /* utility procedures */