Overview
Comment:Rearranged evaluation to: state - input - output - write
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1fa0f2242b38845e70f6f210f24fc9a32d6e245c4d451ff0dd2750b40398c9a2
User & Date: gawthrop@users.sourceforge.net on 1999-03-06 02:28:38
Other Links: branch diff | manifest | tags
Context
1999-03-08
03:51:12
Version 3.5 for Linux Red Hat 5.2 (Newcastle) check-in: 5a8a6af074 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-03-06
02:28:38
Rearranged evaluation to: state - input - output - write check-in: 1fa0f2242b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
02:19:43
Changed args to _input check-in: ade2e4aa5c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [052d182f42] to [148d9eb790].

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.14  1998/10/01 16:02:01  peterg
## Integration with switches handled separately fro Euler and Implicit.
##
## Revision 1.13  1998/09/30 17:41:24  peterg
## Implicit method now allows for switches via _switchA
##
## Revision 1.12  1998/08/27 08:55:18  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.15  1999/03/06 02:19:43  peterg
## Changed args to _input
##
## Revision 1.14  1998/10/01 16:02:01  peterg
## Integration with switches handled separately fro Euler and Implicit.
##
## Revision 1.13  1998/09/30 17:41:24  peterg
## Implicit method now allows for switches via _switchA
##
## Revision 1.12  1998/08/27 08:55:18  peterg
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
120
121
122
123
124

$1_simpar;			# Read in simulation parameters
$1_numpar;			# Read in parameters
MTTilast = round(mttlast/mttdt); # Total number of steps

#Initialise
MTTt = 0.0;

[MTTx] = $1_state;	        # Read in initial state
[MTTu] = $1_input(MTTt,MTTx,mtty);	# Evaluate initial input
[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

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

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

#Integration loop
for MTTit = 1:MTTilast
  [MTTu] = $1_input(MTTt,MTTx,MTTy);	# 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
      [MTTx] = $1_switch(MTTx);	# Switches
      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
    [mttAA] = $1_switcha(mttAA,MTTx);	# Switches
    [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
    [MTTx] = $1_switch(MTTx);	# Switches
    MTTt = MTTt + mttdt;
  endif;


  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);

  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
endfor;				# Integration loop

EOF











>

<

>













<


















<
|
>
|







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
120
121
122
123
124
125
126
127

$1_simpar;			# Read in simulation parameters
$1_numpar;			# Read in parameters
MTTilast = round(mttlast/mttdt); # Total number of steps

#Initialise
MTTt = 0.0;
[MTTu]  = zero_vector($Nu);	# Zero the input
[MTTx] = $1_state;	        # Read in initial state

[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output
[MTTu] = $1_input(MTTt,MTTx,MTTy);	# Evaluate initial input
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

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

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

#Integration loop
for MTTit = 1:MTTilast


  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
      [MTTx] = $1_switch(MTTx);	# Switches
      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
    [mttAA] = $1_switcha(mttAA,MTTx);	# Switches
    [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
    [MTTx] = $1_switch(MTTx);	# Switches
    MTTt = MTTt + mttdt;
  endif;


  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);     # Output 
  [MTTu] = $1_input(MTTt,MTTx,MTTy);	# Input
  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);    # Write it out
endfor;				# Integration loop

EOF





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