Differences From Artifact [7cda0137f2]:

To Artifact [ebfab81400]:


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











+
+
+







#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.43  2000/12/04 10:59:40  peterg
## *** empty log message ***
##
## Revision 1.42  2000/11/10 14:19:50  peterg
## Corrected the csex and cseo functions
##
## Revision 1.41  2000/11/09 17:06:39  peterg
## Now does euler for cc
##
## Revision 1.40  2000/10/17 09:55:00  peterg
163
164
165
166
167
168
169
170


171
172
173
174
175
176
177
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181







-
+
+







    algorithm="mtt_implicit(x,dx,AA,AAx,ddt,$Nx,open_switches)"
else
    ode=ode
    odeo=odeo
    algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
fi

function make_m() {
make_m()
{
#lang_header  $1 ode2odes m  'x,par,simpar' '[Y,X,t]' > $filename
mtt_header ${sys} ode2odes m > $filename
cat <<EOF >> $filename 
global MTT_data;

  if nargin<3
    simpar = ${sys}_simpar(); 
232
233
234
235
236
237
238
239


240
241
242
243
244
245
246
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251







-
+
+







  X  = MTT_data(:,4);

endfunction

EOF
} # make_m

function make_cc() {
make_cc() 
{

cat <<EOF  > $filename
#include <octave/oct.h>

#include <octave/toplev.h>
#include <octave/LSODE.h>
#include <octave/ov-struct.h>
527
528
529
530
531
532
533
534

535
536
537
538
539
540
541
532
533
534
535
536
537
538

539
540
541
542
543
544
545
546







-
+







  ColumnVector	AAx (MTTNX);

  ColumnVector	open_switches (MTTNX);

  register double t	= 0.0;

  const double	ddt	= simpar ["dt"].double_value () / simpar ["stepfactor"].double_value ();
  const int	ilast	= (int)round (simpar ["last"].double_value () / ddt);
  const int	ilast	= (int)round (simpar ["last"].double_value () / ddt) + 1;

  // cse translation
  // LSODE will need ODEFUNC

  for (register int j = 0, i = 1; i <= ilast; i++)
    {
      y	= mtt_${odeo} (x, u, t, par);
558
559
560
561
562
563
564
565

566
567
568
569
570
571
572
563
564
565
566
567
568
569

570
571
572
573
574
575
576
577







-
+








## Common stuff
cat <<EOF >> $filename
      open_switches = mtt_logic (x, u, t, par);
      x =  $algorithm; 
      t += ddt;
      j++;
      j = (j == (int)simpar ["stepfactor"].double_value ()) ? j : 0;
      j = (j == (int)simpar ["stepfactor"].double_value ()) ? 0 : j;
    }

  retval (0) = octave_value (y);
  retval (1) = octave_value (x);
  retval (2) = octave_value (t);
  return (retval);
}

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