Overview
Comment:Fix for [ 553218 ] simpar.oct and simpar.m different.
Translation added between ColumnVector in base .cc and Octave_map in .oct.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b6a47212b3c128afbc4ce90409476f2863ba93d71999516c68ae25a805289703
User & Date: geraint@users.sourceforge.net on 2002-05-11 01:14:17
Other Links: branch diff | manifest | tags
Context
2002-05-13
08:16:32
Now handles derivative causality when fixcc is set in _dae.r check-in: 723f46c1d7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2002-05-11
01:14:17
Fix for [ 553218 ] simpar.oct and simpar.m different.
Translation added between ColumnVector in base .cc and Octave_map in .oct.
check-in: b6a47212b3 user: geraint@users.sourceforge.net tags: origin/master, trunk
00:53:27
reinstated dependency on libncurses5-dev - liboctinterp needs it. check-in: 0c34112393 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [3cae7314b9] to [2e04af1961].

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







+
+
+







# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## 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.
## Implicit integration not supported yet.
##
## build with: mtt -i euler MotorGenerator sfun mexglx.
2134
2135
2136
2137
2138
2139
2140
2141

2142
2143

2144
2145
2146

2147
2148
2149
2150
2151
2152
2153
2137
2138
2139
2140
2141
2142
2143

2144
2145
2146
2147
2148
2149

2150
2151
2152
2153
2154
2155
2156
2157







-
+


+


-
+








# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files
$1_%.oct:  $1_%.cc $1_def.h $1_sympar.h $1_cr.h
	echo Creating $1_\$*.oct; $MKOCTFILE -DCODEGENTARGET=OCTAVEDLD $1_\$*.cc
	echo Creating $1_\$*.oct; $MKOCTFILE ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $1_\$*.cc

.PRECIOUS: mtt_%.oct
.PRECIOUS: $1_%.oct
mtt_%.oct: mtt_%.cc
	echo Compiling \$<
	${MKOCTFILE} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$<
	${MKOCTFILE} ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$<

## .mex files
$1_%.mexglx: $1_%.cc $1_def.h $1_sympar.h $1_cr.h mtt_kpathsea.cc mtt_matlab_octave.cc mtt_matlab_octave.hh
	echo Creating $1_\$*.mexglx
	${MTT_CXX} -shared -o $1_\$*.mexglx $1_\$*.cc \
	${MTT_MATLAB_FLAGS} -DCODEGENTARGET=MATLABMEX \
	${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} mtt_kpathsea.cc mtt_matlab_octave.cc
2806
2807
2808
2809
2810
2811
2812
2813

2814
2815
2816
2817
2818
2819
2820
2810
2811
2812
2813
2814
2815
2816

2817
2818
2819
2820
2821
2822
2823
2824







-
+







$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DCODEGENTARGET=STANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common_oct.stamp $1_ode2odes_${integration_method}_oct.stamp $1_ode2odes_${algebraic_solver}.o
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE -DCODEGENTARGET=OCTAVEDLD $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc
	$MKOCTFILE ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc

$1_ode2odes.mexglx: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	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} \

Modified mttroot/mtt/bin/trans/make_ode2odes from [e5d0e1820f] to [8e9033d762].

1
2
3
4
5
6
7
8
9
10
11




12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22











+
+
+
+







#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.77  2002/05/08 16:03:32  geraint
## Added mex support for ode2odes: mtt sys ode2odes mexglx.
## This mex stuff seems to require octave2.1-headers.
##
## Revision 1.76  2002/05/08 14:14:55  geraint
## Tidied up ode2odes code - reduced interweaving of STANDALONE/OCTAVEDLD sections
##
## Revision 1.75  2002/05/07 13:48:42  geraint
## Improved clarity of code generated for -cc and -oct (except ode2odes).
## Octave DEFUN_DLDs now call (rather than replace) their .cc equivalents.
##
998
999
1000
1001
1002
1003
1004
1005
1006


1007
1008
1009
1010
1011
1012
1013
1002
1003
1004
1005
1006
1007
1008


1009
1010
1011
1012
1013
1014
1015
1016
1017







-
-
+
+







}

void
${sys}_ode2odes (ColumnVector &state0, ColumnVector &numpar, ColumnVector &simpar)
{
  static double first, dt, last, stepfactor;
  first		= simpar (0);
  dt		= simpar (1);
  last		= simpar (2);
  last		= simpar (1);
  dt		= simpar (2);
  stepfactor	= simpar (3);

  static ColumnVector	dx (MTTNX, 0.0);
  static ColumnVector	x (MTTNX, 0.0);
  static ColumnVector	u (MTTNU, 0.0);
  static ColumnVector	y (MTTNY, 0.0);

1153
1154
1155
1156
1157
1158
1159


1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173

1174
1175
1176
1177
1178
1179
1180
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178

1179
1180
1181
1182
1183
1184
1185
1186







+
+













-
+







  state0	= mtt_state (numpar);

  ${sys}_ode2odes (state0, numpar, simpar);

  return 0;
}
#elif (CODEGENTARGET == OCTAVEDLD)
#include <mtt_simpar.hh>

DEFUN_DLD (${sys}_ode2odes, args, ,
"Octave ode2odes representation of system with $method integration method\nUsage: mtt_data = ${sys}_ode2odes (state0, numpar, simpar)\n")
{
  static octave_value_list retval;

  static ColumnVector	state0 (MTTNX);
  static ColumnVector	numpar (MTTNPAR);
  static ColumnVector	simpar (8);
  
  int nargin = args.length ();
  switch (nargin)
    {
    case 3:
      simpar	= args(2).${vector_value} ();
      simpar	= mtt_simpar (args(2).map_value ());
      numpar	= args(1).${vector_value} ();
      state0	= args(0).${vector_value} ();
      break;
    case 2:
      simpar	= mtt_simpar ();
      numpar	= args(1).${vector_value} ();
      state0	= args(0).${vector_value} ();

Modified mttroot/mtt/bin/trans/mtt_header from [630b2a9dfd] to [83d0d37bdc].

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







+
+
+







# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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.
##
## Revision 1.46  2002/05/07 13:48:43  geraint
## Improved clarity of code generated for -cc and -oct (except ode2odes).
320
321
322
323
324
325
326
327



328
329
330
331
332
333
334
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337
338
339







-
+
+
+







        output='mtt_data'
        args='x0,par,simpar'
	;;
    simpar)
	states=no;
	inputs=no;
	parameters=no;
        output='mttsimpar'
	output='mttsimpar'
	oct_rep_include="#include <mtt_simpar.hh>"
	oct_return_type="mtt_simpar"
	;;
    sm)
	states=no;
	inputs=no;
	parameters=yes;
        output='mtta,mttb,mttc,mttd'
        args=mttpar;
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
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







+
+









-
-
+
+








write_oct()
{
    func=${1:-"<insert function name>"}
    args=${2:-""}
    cat <<EOF
#if (CODEGENTARGET == OCTAVEDLD)
$oct_rep_include

DEFUN_DLD (${system}_${rep}, args, ,
"Usage: [$output] = ${system}_${rep}($args)\nOctave ${rep} representation of system ${system}\nGenerated by MTT on `date`")
{
  static octave_value_list retval;

EOF
    map_oct_inputs ${args}
    cat <<EOF

  retval (0) = ${func} (${args});
  return (retval);
  retval (0) = octave_value ($oct_return_type (${func} (${args})));
  return retval;
}
#endif // (CODEGENTARGET == OCTAVEDLD)

EOF
}

write_mex ()

Modified mttroot/mtt/cc/mtt_m2cc.sh from [9fd3491043] to [d5b350ce6a].

34
35
36
37
38
39
40
41
42


43
44
45
46
47
48
49
34
35
36
37
38
39
40


41
42
43
44
45
46
47
48
49







-
-
+
+








rep_footer ()
{
(case ${REP} in
    simpar)
	cat <<EOF
  mttsimpar_map(0)	= (double) mttsimpar.first;
  mttsimpar_map(1)	= (double) mttsimpar.dt;
  mttsimpar_map(2)	= (double) mttsimpar.last;
  mttsimpar_map(1)	= (double) mttsimpar.last;
  mttsimpar_map(2)	= (double) mttsimpar.dt;
  mttsimpar_map(3)	= (double) mttsimpar.stepfactor;
  mttsimpar_map(4)	= (double) mttsimpar.wmin;
  mttsimpar_map(5)	= (double) mttsimpar.wmax;
  mttsimpar_map(6)	= (double) mttsimpar.wsteps;
  mttsimpar_map(7)	= (double) mttsimpar.input;
EOF
	;;

Added mttroot/mtt/lib/cc/mtt_simpar.hh version [8e34c674fd].






































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

#include <octave/oct.h>
#include <octave/ov-struct.h>

static ColumnVector
mtt_simpar (Octave_map simpar)
{
  static ColumnVector retval (8);

  retval (0) = simpar ["first"     ].double_value ();
  retval (1) = simpar ["last"      ].double_value ();
  retval (2) = simpar ["dt"        ].double_value ();
  retval (3) = simpar ["stepfactor"].double_value ();
  retval (4) = simpar ["wmin"      ].double_value ();
  retval (5) = simpar ["wmax"      ].double_value ();
  retval (6) = simpar ["wsteps"    ].double_value ();
  retval (7) = simpar ["input"     ].double_value ();

  return retval;
}

static Octave_map
mtt_simpar (ColumnVector simpar)
{
  static Octave_map retval;

  retval ["first"     ] = simpar (0);
  retval ["last"      ] = simpar (1);
  retval ["dt"        ] = simpar (2);
  retval ["stepfactor"] = simpar (3);
  retval ["wmin"      ] = simpar (4);
  retval ["wmax"      ] = simpar (5);
  retval ["wsteps"    ] = simpar (6);
  retval ["input"     ] = simpar (7);

  return retval;
}


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]