Overview
Comment:Updated for new data file parameter/state update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 28ecc6bfb805ecac9c94ee9d4f268731e202f6d028caacc1a9ce6958b0a2211a
User & Date: gawthrop@users.sourceforge.net on 2000-05-16 11:59:01
Other Links: branch diff | manifest | tags
Context
2000-05-16
11:59:34
Stard new version with data files not argv. check-in: 2a7d780b55 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:59:01
Updated for new data file parameter/state update check-in: 28ecc6bfb8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:42:14
Addded /usr/lib/libp2c.a to gcc check-in: 01ab033260 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_m2p from [fe00ece6d6] to [cc6de330d2].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop 1998

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



## Revision 1.44  2000/05/13 11:52:16  peterg
## A now matrix in smxa rep
##
## Revision 1.43  2000/05/11 19:35:16  peterg
## Major revisions for new paprameter passing versions
##
## Revision 1.42  2000/04/18 11:11:44  peterg







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.45  2000/05/13 13:16:52  peterg
## Matrix initialisation for smxa
##
## Revision 1.44  2000/05/13 11:52:16  peterg
## A now matrix in smxa rep
##
## Revision 1.43  2000/05/11 19:35:16  peterg
## Major revisions for new paprameter passing versions
##
## Revision 1.42  2000/04/18 11:11:44  peterg
259
260
261
262
263
264
265

266
267
268
269

270
271
272
273
274
275
276
	echo "                       mttx       : StateVector;"
	echo "                       mttu       : InputVector;"
	echo "                       mttt      : REAL;"
	echo "                       mttpar     : ParameterVector);"
	;;
    ode2odes)
	echo "PROGRAM $Sys_rep;"

	echo "CONST"
	echo "    MTT_MaxParameters = 100;"
	echo "    MTT_Npar = $Npar;"
	echo "    MTT_Nx = $Nx;"

	echo "TYPE"
	echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"
	echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"
	echo "    OutputVector = ARRAY[1..$Ny] OF REAL;"
	echo "    ParameterVector = ARRAY[1..$Npar] OF REAL;"
	echo "    SimulationParameters = RECORD"
	echo "    dt, first, input, last, stepfactor, wmax, wmin, wsteps: REAL"







>




>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
	echo "                       mttx       : StateVector;"
	echo "                       mttu       : InputVector;"
	echo "                       mttt      : REAL;"
	echo "                       mttpar     : ParameterVector);"
	;;
    ode2odes)
	echo "PROGRAM $Sys_rep;"
        echo ""
	echo "CONST"
	echo "    MTT_MaxParameters = 100;"
	echo "    MTT_Npar = $Npar;"
	echo "    MTT_Nx = $Nx;"
        echo ""
	echo "TYPE"
	echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"
	echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"
	echo "    OutputVector = ARRAY[1..$Ny] OF REAL;"
	echo "    ParameterVector = ARRAY[1..$Npar] OF REAL;"
	echo "    SimulationParameters = RECORD"
	echo "    dt, first, input, last, stepfactor, wmax, wmin, wsteps: REAL"
293
294
295
296
297
298
299
300

301
302
303
304
305
306
307
	echo "    par                         : ParameterVector;"
	echo "    mttpar                      : ParameterVector;"
	echo "    mttnpar                     : INTEGER;"
	echo "    AA                          : StateMatrix;"
	echo "    MTTi,MTTj,it,iLast: INTEGER;"
	##echo "    mttSTEPFACTOR,mttWSTEPS,mttSTEPS,mttINPUT : INTEGER;"
	## echo "    mttMETHOD : IntegrationMethod;"
	echo "    open  : StateVector;"

	echo ""
        ;;
    switchopen)
	echo "PROCEDURE $Sys_rep(VAR open : StateVector; mttx : StateVector);"
	echo "VAR"
	echo "    MTTi,MTTj :  INTEGER;"
	;;







|
>







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
	echo "    par                         : ParameterVector;"
	echo "    mttpar                      : ParameterVector;"
	echo "    mttnpar                     : INTEGER;"
	echo "    AA                          : StateMatrix;"
	echo "    MTTi,MTTj,it,iLast: INTEGER;"
	##echo "    mttSTEPFACTOR,mttWSTEPS,mttSTEPS,mttINPUT : INTEGER;"
	## echo "    mttMETHOD : IntegrationMethod;"
	echo "    open_switches  : StateVector;"
	echo "    numparfile, statefile, simparfile  : TEXT;"
	echo ""
        ;;
    switchopen)
	echo "PROCEDURE $Sys_rep(VAR open : StateVector; mttx : StateVector);"
	echo "VAR"
	echo "    MTTi,MTTj :  INTEGER;"
	;;
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
  name="[a-zA-Z0-9_]*"
  fun_name="$Sys\_$name"
  mttfun_name=$name
  tab='	'
  space="[ $tab]*"
  spaces="[ $tab][ $tab]*"
  non_space="[^ ]*"
  args="[a-zA-Z0-9,.]*"

# Body	
cat $Sys_rep.m |\
grep -v '^[ ]*function'  |\
grep -v '^[ ]*endfunction'  |\
grep -v 'MTT_data'  |\
sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\







|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
  name="[a-zA-Z0-9_]*"
  fun_name="$Sys\_$name"
  mttfun_name=$name
  tab='	'
  space="[ $tab]*"
  spaces="[ $tab][ $tab]*"
  non_space="[^ ]*"
  args='[a-zA-Z0-9,._"]*'

# Body	
cat $Sys_rep.m |\
grep -v '^[ ]*function'  |\
grep -v '^[ ]*endfunction'  |\
grep -v 'MTT_data'  |\
sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\
380
381
382
383
384
385
386

387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413


414
415
416
417
418
419
420
      }
    }
    else 
    {
      if (doing_header==1){
        if (rep=="ode2odes"){
          printf("\n{%s $MTTPATH/trans/p/mtt_write.p}\n",inc)

          printf("{%s $MTTPATH/trans/p/sign.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_euler.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_solve.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_implicit.p}\n",inc)
          # printf("{%s $MTTPATH/trans/p/zero_matrix.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_input.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_state.p}\n",inc)
          printf("{%s %s_simpar.p}\n",inc,Sys) 
          printf("{%s %s_numpar.p}\n",inc,Sys)
          printf("{%s $MTTPATH/trans/p/mtt_getargs.p}\n",inc)
          printf("{%s %s_state.p}\n",inc,Sys)
          printf("{%s %s_input.p}\n",inc,Sys)
          if (Method=="euler") {
            printf("{%s %s_ode.p}\n",inc,Sys)
            printf("{%s %s_odeo.p}\n",inc,Sys)
          }
          if (Method=="implicit") {
            printf("{%s %s_cse.p}\n",inc,Sys)
            printf("{%s %s_cseo.p}\n",inc,Sys)
            printf("\n{%s %s_smxa.p}\n",inc,Sys);
            printf("\n{%s %s_smxax.p}\n",inc,Sys);
          }
          printf("{%s %s_switchopen.p}\n\n",inc,Sys)

          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN{%s}\n", Sys_rep)


        }
        else{
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("VAR \n");
          for (k=1;k<i;k++) printf("  %s,\n",global[k])
          printf("%s : REAL;\n", global[i])







>









|

















>
>







386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
      }
    }
    else 
    {
      if (doing_header==1){
        if (rep=="ode2odes"){
          printf("\n{%s $MTTPATH/trans/p/mtt_write.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_par_update.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/sign.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_euler.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_solve.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_implicit.p}\n",inc)
          # printf("{%s $MTTPATH/trans/p/zero_matrix.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_input.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_state.p}\n",inc)
          printf("{%s %s_simpar.p}\n",inc,Sys) 
          printf("{%s %s_numpar.p}\n",inc,Sys)
          # printf("{%s $MTTPATH/trans/p/mtt_getargs.p}\n",inc)
          printf("{%s %s_state.p}\n",inc,Sys)
          printf("{%s %s_input.p}\n",inc,Sys)
          if (Method=="euler") {
            printf("{%s %s_ode.p}\n",inc,Sys)
            printf("{%s %s_odeo.p}\n",inc,Sys)
          }
          if (Method=="implicit") {
            printf("{%s %s_cse.p}\n",inc,Sys)
            printf("{%s %s_cseo.p}\n",inc,Sys)
            printf("\n{%s %s_smxa.p}\n",inc,Sys);
            printf("\n{%s %s_smxax.p}\n",inc,Sys);
          }
          printf("{%s %s_switchopen.p}\n\n",inc,Sys)

          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN{%s}\n", Sys_rep)
          printf("  open(statefile,\"%s_state.dat\");\n", Sys)
          printf("  open(numparfile,\"%s_numpar.dat\");\n", Sys)
        }
        else{
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("VAR \n");
          for (k=1;k<i;k++) printf("  %s,\n",global[k])
          printf("%s : REAL;\n", global[i])
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
sed 's/(\([ijk0-9,]*\))/\[\1\]/g'    |\
sed 's/(\(MTT[ijk0-9],[0-9]*\))/\[\1\]/g' |\
sed 's/(\([0-9]*,MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g'  |\
sed 's/switcha(mttAA,/switcha(/g'   |\
sed 's/switch(MTTx,/switch(/g'  |\
sed 's/nargin<1/mttnpar<1/'  |\
sed 's/if nargin<2 THEN//'  |\
sed 's/nargin<3/mttnpar<1/' | \
sed 's/if nargin<4/if mttnpar<1/'  \
>> $Filename

# p2c doesn't like mixed case filenames!
#if [ "$Filename" != "$filename" ]; then
#  echo Creating $filename
#  cp -f $Filename $filename
#fi







<
|
<
<







505
506
507
508
509
510
511

512


513
514
515
516
517
518
519
sed 's/(\([ijk0-9,]*\))/\[\1\]/g'    |\
sed 's/(\(MTT[ijk0-9],[0-9]*\))/\[\1\]/g' |\
sed 's/(\([0-9]*,MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g'  |\
sed 's/switcha(mttAA,/switcha(/g'   |\
sed 's/switch(MTTx,/switch(/g'  |\

sed 's/if nargin<[1-9] THEN//'  \


>> $Filename

# p2c doesn't like mixed case filenames!
#if [ "$Filename" != "$filename" ]; then
#  echo Creating $filename
#  cp -f $Filename $filename
#fi


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