Overview
Comment:Mods to integration methods
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3c8adbbfcc7fcaa6a08fca41c2be32eac4baccd2728a40913d587c6b6c01c771
User & Date: gawthrop@users.sourceforge.net on 1998-08-27 08:55:40
Other Links: branch diff | manifest | tags
Context
1998-08-31
10:49:15
Minor changes to -abg operation check-in: 77e68e13f0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-08-27
08:55:40
Mods to integration methods check-in: 3c8adbbfcc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:33:21
New reduce integration methods - euler/Implicit only check-in: 1f43226f4f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [84f8932a0c] to [b393691984].

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.10  1998/08/25 12:22:45  peterg
## Put _switch after update and also at initilisation
##
## Revision 1.9  1998/08/15 13:46:59  peterg
## New versions of integration routines
##
## Revision 1.8  1998/08/11 13:28:03  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.11  1998/08/25 12:28:31  peterg
## Move initila switch to after initial input
##
## Revision 1.10  1998/08/25 12:22:45  peterg
## Put _switch after update and also at initilisation
##
## Revision 1.9  1998/08/15 13:46:59  peterg
## New versions of integration routines
##
## Revision 1.8  1998/08/11 13:28:03  peterg
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

103
104
105
106
107







108
109
110
111
112
113
114
115
116
117
118
119
[MTTx] = $1_switch(MTTx);       # Switches
[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them

[mttAA]  = zero_matrix($Nx);	# Zero the A matrix
[mttAAx] = zero_vector($Nx);	# Zero the AAx vector

if mttmethod==1			#Euler
  mttsteps = mttstepfactor;
endif;

if mttmethod>1			#everything else
  mttsteps = 1;
end;


mttddt = mttdt/mttsteps;	# The small sample interval

if mttmethod==2			#Linear implicit
  mttAA = $1_smx(MTTx,MTTu,mttdt); # Set up AA= I-Adt matrix - linearised system
end;

#Integration loop
for MTTit = 1:MTTilast
  if mttmethod==3		# nonlinear implicit
    [mttAA] = $1_smx(MTTx,MTTu,mttdt); # Set up AA=I-A*dt  matrix - linearised system
  end;
  if mttmethod>1		# nonlinear implicit
    [mttAAx] = $1_smxx(MTTx,MTTu,MTTx,mttdt); # Set up AAx = AA*x vector - linearised system
  end;

  [MTTu] = $1_input(MTTx,MTTt);	# Input


  for MTTjt = 1:mttsteps
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [MTTx] = mtt_update(MTTdx,MTTx,mttAAx,mttAA,mttdt,mttstepfactor,$Nx,mttmethod);
    MTTt = MTTt + mttddt;
  end;








  [MTTx] = $1_switch(MTTx);	# Switches

  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
end;

EOF











|
|
|

<
<
<
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<


>
|
|
|
|
|
>
>
>
>
>
>
>





|






73
74
75
76
77
78
79
80
81
82
83











84
85







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
[MTTx] = $1_switch(MTTx);       # Switches
[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them

[mttAA]  = zero_matrix($Nx);	# Zero the A matrix
[mttAAx] = zero_vector($Nx);	# Zero the AAx vector

  if mttmethod==1		# Euler
    MTTddt = mttdt/mttstepfactor; # The small sample interval
  endif;












#Integration loop
for MTTit = 1:MTTilast







  [MTTu] = $1_input(MTTx,MTTt);	# Input

  if mttmethod==1		# Euler
    for MTTjt = 1:mttstepfactor
      [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
      [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update
      MTTt = MTTt + MTTddt;
    endfor;
  endif;
  if mttmethod==2		# Implicit 
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt);	# (I-Adt) and (I-Adt)x
    [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
    MTTt = MTTt + mttdt;
  endif;

  [MTTx] = $1_switch(MTTx);	# Switches

  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
endfor;				# Integration loop

EOF




Modified mttroot/mtt/bin/trans/mtt_m2p from [1ec895e0c4] to [acbac27d53].

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.16  1998/08/19 08:46:00  peterg
## Now translates ; % to #
##
## Revision 1.15  1998/08/15 13:46:01  peterg
## Included new sparse update routines
##
## Revision 1.14  1998/08/12 15:21:12  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.17  1998/08/27 07:38:40  peterg
## About to change to new integration (Euler/Implicit only)
##
## Revision 1.16  1998/08/19 08:46:00  peterg
## Now translates ; % to #
##
## Revision 1.15  1998/08/15 13:46:01  peterg
## Included new sparse update routines
##
## Revision 1.14  1998/08/12 15:21:12  peterg
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    odeo)
	echo "PROCEDURE $Sys_rep(VAR mtty : OutputVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL);"
	;;
    smx)
	echo "PROCEDURE $Sys_rep(VAR mtta : StateMatrix;"
	echo "                   VAR mttx : StateVector;"
	echo "                   VAR mttu : InputVector;"
	echo "                       mttdt : REAL);"
	;;
    smxx|smxtx)
	echo "PROCEDURE $Sys_rep(VAR mttax : StateVector;"
	echo "                       mttx  : StateVector;"
	echo "                       mttu  : InputVector;"
	echo "                       mttxx : StateVector;"
	echo "                       mttdt : REAL);"
	;;
    ode2odes)
	echo "PROGRAM $Sys_rep;"
	echo "TYPE"
	echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"
	echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"
	echo "    OutputVector = ARRAY[1..$Ny] OF REAL;"







|
|
|
<
<
<
<
|
<
<
<







107
108
109
110
111
112
113
114
115
116




117



118
119
120
121
122
123
124
    odeo)
	echo "PROCEDURE $Sys_rep(VAR mtty : OutputVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL);"
	;;
    smx)
	echo "PROCEDURE $Sys_rep(VAR mtta       : StateMatrix;"
	echo "                   VAR mttax,mttx : StateVector;"
	echo "                   VAR mttu       : InputVector;"




	echo "                       mttdt      : REAL);"



	;;
    ode2odes)
	echo "PROGRAM $Sys_rep;"
	echo "TYPE"
	echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"
	echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"
	echo "    OutputVector = ARRAY[1..$Ny] OF REAL;"
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
        doing_header = 1
      }
    }
    else 
    {
      if (doing_header==1){
        if (rep=="ode2odes"){
          printf("VAR ");
          for (k=1;k<i;k++) printf("%s,",global[k])
          printf("%s : REAL;\n", global[i])
          printvar("x",Nx);
          printvar("u",Nu);
          printvar("y",Ny);
          printvar("_t",Nt);

          printf("\n{%s %s_smx.p}\n",inc,sys)
          printf("{%s %s_smxx.p}\n",inc,sys)
          printf("{%s %s_smxtx.p}\n\n",inc,sys)

          printf("\nPROCEDURE mtt_asub(VAR x,y : StateVector; n : INTEGER);\n");
          printf("{Sparse update routine -- y = Ax}\n");
          printf("BEGIN {asub}\n");
          printf("  %s_smxx(y,mttx,mttu,x,mttdt);\n", Sys);
          printf("END {asub};\n");
          printf("\nPROCEDURE mtt_atsub(VAR x,y : StateVector; n : INTEGER);\n");
          printf("{Sparse update routine -- y = ATx}\n");
          printf("BEGIN {atsub}\n");
          printf("  %s_smxtx(y,mttx,mttu,x,mttdt);\n", Sys);
          printf("END {atsub};\n\n");

          printf("\n{%s sign.p}\n",inc,sys)
          printf("{%s mtt_update.p}\n",inc)

          printf("{%s mtt_write.p}\n",inc)
          printf("{%s zero_matrix.p}\n",inc)
          printf("{%s zero_vector.p}\n",inc)
          printf("{%s %s_simpar.p}\n",inc,sys) 
          printf("{%s %s_numpar.p}\n",inc,sys)
          printf("{%s %s_state.p}\n",inc,sys)
          printf("{%s %s_input.p}\n",inc,sys)







|
|







<
<
<
<
<
<
<
<
<
<
<
<
<
<

|
>







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232














233
234
235
236
237
238
239
240
241
242
        doing_header = 1
      }
    }
    else 
    {
      if (doing_header==1){
        if (rep=="ode2odes"){
          printf("VAR \n");
          for (k=1;k<i;k++) printf("  %s,\n",global[k])
          printf("%s : REAL;\n", global[i])
          printvar("x",Nx);
          printvar("u",Nu);
          printvar("y",Ny);
          printvar("_t",Nt);

          printf("\n{%s %s_smx.p}\n",inc,sys)














          printf("\n{%s sign.p}\n",inc,sys)
          printf("{%s mtt_euler.p}\n",inc)
          printf("{%s mtt_implicit.p}\n",inc)
          printf("{%s mtt_write.p}\n",inc)
          printf("{%s zero_matrix.p}\n",inc)
          printf("{%s zero_vector.p}\n",inc)
          printf("{%s %s_simpar.p}\n",inc,sys) 
          printf("{%s %s_numpar.p}\n",inc,sys)
          printf("{%s %s_state.p}\n",inc,sys)
          printf("{%s %s_input.p}\n",inc,sys)


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