Differences From Artifact [5be501a234]:

To Artifact [9330add422]:


1
2
3
4
5
6
7
8
9
10
11



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

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

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



## Revision 1.32  2000/05/11 08:30:00  peterg
## Old version -- about to try new parameterised version
##
## Revision 1.31  2000/05/10 18:33:25  peterg
## Use smxa and smxax in place of smx
##
## Revision 1.30  2000/04/18 11:24:19  peterg
## Removed _numpar.
##











>
>
>

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.33  2000/05/11 19:33:18  peterg
## Uniform version for _sim.m
##
## Revision 1.32  2000/05/11 08:30:00  peterg

##
## Revision 1.31  2000/05/10 18:33:25  peterg
## Use smxa and smxax in place of smx
##
## Revision 1.30  2000/04/18 11:24:19  peterg
## Removed _numpar.
##
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155

156
157
158

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

#cat << EOF > $1_ode2odes.m
# Program $1_ode2odes
#EOF

# Do the globals
#sympar2global_txt2m $1 >> $1_ode2odes.m
lang_header  $1 ode2odes m  'x,U,par,simpar' '[Y,X,t]' > $1_ode2odes.m

cat >> $1_ode2odes.m <<EOF
global MTT_data;

  if nargin<1 
    x  =  $1_state; 

  endif
  if nargin<2
    U =   $1_input(0);
   endif
  if nargin<3
    par = $1_numpar; 

  endif
  if nargin<4
    simpar = $1_simpar; 

  endif

  ## Initialise
  t = 0.0;
  ilast = round(simpar.last/simpar.dt); # Total number of steps

  [u]  = zero_input(1);		# Zero the input

  for it = 1:ilast		#Integration loop
    [y] = $1_cseo(x,u,t,par);# Output 
    [u] = $1_input(t,x,y,U);	# Input
    if (t>=simpar.first)
      mtt_write(t,x,y,$Nx,$Ny); # Write it out
    endif
    [dx] = $1_cse(x,u,t,par);	# State derivative
    [AA] = $1_smxa(x,u,simpar.dt,par);	# (I-Adt) and (I-Adt)x
    [AAx] = $1_smxax(x,u,simpar.dt,par); # (I-Adt) and (I-Adt)x
    [open] = $1_switchopen(x);	# Open switches
    [x] = mtt_implicit(x,dx,AA,AAx,simpar.dt,$Nx,open); # Implicit update
    t = t + simpar.dt;
  endfor;			# Integration loop

  t = MTT_data(:,1);
  Y = MTT_data(:,2);
  X  = MTT_data(:,4);








|




|

>


<
<
<

>

|

>




|





|






|
|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

#cat << EOF > $1_ode2odes.m
# Program $1_ode2odes
#EOF

# Do the globals
#sympar2global_txt2m $1 >> $1_ode2odes.m
lang_header  $1 ode2odes m  'x,par,simpar' '[Y,X,t]' > $1_ode2odes.m

cat >> $1_ode2odes.m <<EOF
global MTT_data;

  if nargin<1
    x  =  $1_state; 
    [x] = mtt_state_update(x);
  endif
  if nargin<2



    par = $1_numpar; 
    [par] = mtt_numpar_update(par);
  endif
  if nargin<3
    simpar = $1_simpar; 
    [simpar.dt] = mtt_simpar_update;
  endif

  ## Initialise
  t = 0.0;
  ilast = round(simpar.last/simpar.dt)+1; # Total number of steps

  [u]  = zero_input(1);		# Zero the input

  for it = 1:ilast		#Integration loop
    [y] = $1_cseo(x,u,t,par);# Output 
    [u] = $1_input(t,x,y);	# Input
    if (t>=simpar.first)
      mtt_write(t,x,y,$Nx,$Ny); # Write it out
    endif
    [dx] = $1_cse(x,u,t,par);	# State derivative
    [AA] = $1_smxa(x,u,simpar.dt,par);	# (I-Adt) and (I-Adt)x
    [AAx] = $1_smxax(x,u,simpar.dt,par); # (I-Adt) and (I-Adt)x
    [open_switches] = $1_switchopen(x);	# Open switches
    [x] = mtt_implicit(x,dx,AA,AAx,simpar.dt,$Nx,open_switches); # Implicit update
    t = t + simpar.dt;
  endfor;			# Integration loop

  t = MTT_data(:,1);
  Y = MTT_data(:,2);
  X  = MTT_data(:,4);


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