Overview
Comment:Changed function name to name()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 436a0a6509aa547ba5f25702cd679e26bc6aa9684a3e521660ce4d33fbff21d7
User & Date: gawthrop@users.sourceforge.net on 2000-12-05 12:11:45
Other Links: branch diff | manifest | tags
Context
2000-12-05
12:12:39
Initial revision check-in: f5def571c2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:11:45
Changed function name to name() check-in: 436a0a6509 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:05:26
Changed to () form check-in: 2f1942ae91 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/cbg2ese_m2r from [0f74549f73] to [fd5b5dde90].

12
13
14
15
16
17
18



19
20
21
22
23
24
25

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$



## Revision 1.25  2000/12/01 14:51:26  peterg
## Major changes towards partioning
##
## - generates sub ese, def and struc
## - generates indices for conversion of subsystem in/out/state - but not used yet
##
## Revision 1.24  2000/11/30 15:12:55  peterg







>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.26  2000/12/05 09:04:54  peterg
## *** empty log message ***
##
## Revision 1.25  2000/12/01 14:51:26  peterg
## Major changes towards partioning
##
## - generates sub ese, def and struc
## - generates indices for conversion of subsystem in/out/state - but not used yet
##
## Revision 1.24  2000/11/30 15:12:55  peterg
186
187
188
189
190
191
192
193

194
195
196
197
198
199
200

else # Partition the system

  # Save up the full def file
  mv $1_def.r mtt_all_def.r

## Recreate def file from the ese file directly
function makedef {


echo Creating $1_def.r

Nx=`mtt_getsize -external $1 dX`
Nz=`mtt_getsize -external $1 z`
Ny=`mtt_getsize -external $1 y`
Nu=`mtt_getsize -external $1 u`







|
>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204

else # Partition the system

  # Save up the full def file
  mv $1_def.r mtt_all_def.r

## Recreate def file from the ese file directly
makedef ()
{

echo Creating $1_def.r

Nx=`mtt_getsize -external $1 dX`
Nz=`mtt_getsize -external $1 z`
Ny=`mtt_getsize -external $1 y`
Nu=`mtt_getsize -external $1 u`
221
222
223
224
225
226
227
228

229
230
231
232
233
234

235
236
237
238
239
240
241
  makedef(structure,deffilenum);  #Create definitions
EOF

echo "END;" >> $1_def.r
}


function get_indices {

  sys=$1
  which=$2
  awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt
}

function convert_indices {

  sys=$1
  Which="input output state"
  for which in $Which; do
  
    indices=`get_indices ${sys} $which`
  
    case $which in







|
>





|
>







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
  makedef(structure,deffilenum);  #Create definitions
EOF

echo "END;" >> $1_def.r
}


get_indices ()
{
  sys=$1
  which=$2
  awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt
}

convert_indices ()
{
  sys=$1
  Which="input output state"
  for which in $Which; do
  
    indices=`get_indices ${sys} $which`
  
    case $which in

Modified mttroot/mtt/bin/trans/make_ode2odes from [7cda0137f2] to [ebfab81400].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



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











>
>
>







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
    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() {

#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(); 







|
>







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

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
  X  = MTT_data(:,4);

endfunction

EOF
} # make_m

function make_cc() {


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

#include <octave/toplev.h>
#include <octave/LSODE.h>
#include <octave/ov-struct.h>







|
>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  X  = MTT_data(:,4);

endfunction

EOF
} # make_m

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
  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);

  // cse translation
  // LSODE will need ODEFUNC

  for (register int j = 0, i = 1; i <= ilast; i++)
    {
      y	= mtt_${odeo} (x, u, t, par);







|







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

## 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;
    }

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







|







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 ()) ? 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 ]