Overview
Comment:_sim.m now returns time as third argument
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 864f048dbc60279d76d5308addd078c89ae06d889bd8968f3239a490e755e1ab
User & Date: gawthrop@users.sourceforge.net on 2002-04-23 17:46:05
Other Links: branch diff | manifest | tags
Context
2002-04-23
17:50:39
error --> err to avoid name clash with built in function check-in: 1288c7a627 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:46:05
_sim.m now returns time as third argument check-in: 864f048dbc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:44:34
Fix for bug [ 547495 ] - renamed "sim" representation as "cxxsim".
This representation creates a C++ simulation without using Reduce.
Additional files are required.
check-in: fd12d1c586 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_sim from [2bb203ef7d] to [7a48ad2de1].

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
#!/bin/sh

## Makes the sensitivity simulation
## Copyright (C) 2001 by Peter J. Gawthrop

sys=$1
lang=$2

outfile=${sys}_sim.${lang}

echo Creating $outfile

make_m() {
mtt_header ${sys} sim m >  ${outfile}
cat >> ${outfile} <<EOF

 ## Pass input as a global
 global MTT_input MTT_input_index MTT_input_last

  [nx,ny] = ${sys}_def;
  y_par = [];
  MTT_input = u;
  [MTT_input_last,m] = size(u);

  MTT_input_index = 0;
  [mtt_data] = ${sys}_ode2odes(x0,par,simpar);
  y = mtt_data(:,2:1+ny);
  x = mtt_data(:,3+ny:2+ny+nx);
  ypar = [];







endfunction
EOF

}

case ${lang} in
    m)
	make_m
	;;
    *)
	echo Language ${lang} not supported - sorry
esac











>

|















>
>
>
>
>
>













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
#!/bin/sh

## Makes the sensitivity simulation
## Copyright (C) 2001 by Peter J. Gawthrop

sys=$1
lang=$2

outfile=${sys}_sim.${lang}

echo Creating $outfile

make_m() {
mtt_header ${sys} sim m  >  ${outfile}
cat >> ${outfile} <<EOF

 ## Pass input as a global
 global MTT_input MTT_input_index MTT_input_last

  [nx,ny] = ${sys}_def;
  y_par = [];
  MTT_input = u;
  [MTT_input_last,m] = size(u);

  MTT_input_index = 0;
  [mtt_data] = ${sys}_ode2odes(x0,par,simpar);
  y = mtt_data(:,2:1+ny);
  x = mtt_data(:,3+ny:2+ny+nx);
  ypar = [];

  if nargout>2
    ## Create time vector
    [N,M] = size(y);
    t = simpar.dt*[0:N-1]';
  endif;

endfunction
EOF

}

case ${lang} in
    m)
	make_m
	;;
    *)
	echo Language ${lang} not supported - sorry
esac

Modified mttroot/mtt/bin/trans/mtt_header from [0a1d86f26e] to [83dcd3c682].

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.39  2002/04/15 10:54:31  geraint
## Statically declare outputs and initialise to zero.
## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u"  (Reduce:see NERO)).
##
## Revision 1.38  2001/07/23 23:43:15  gawthrop
## header only version does not need to compute sizes from _def.r
##







>
>
>
>







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.40  2002/04/17 16:23:59  geraint
## Partial fix for [ 545113 ] zeros missing in c++.
## Fixes -oct by removing duplicate initialisation (-c is still outstanding).
##
## Revision 1.39  2002/04/15 10:54:31  geraint
## Statically declare outputs and initialise to zero.
## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u"  (Reduce:see NERO)).
##
## Revision 1.38  2001/07/23 23:43:15  gawthrop
## header only version does not need to compute sizes from _def.r
##
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
        args=mttpar
        declarestates=yes
	;;
    sim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,x'
        args='x0,par,simpar,u'
	;;
    ssim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,y_par,x'







|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
        args=mttpar
        declarestates=yes
	;;
    sim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,x,t'
        args='x0,par,simpar,u'
	;;
    ssim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,y_par,x'


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