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.36 2000/05/19 17:48:16 peterg
## Argument to state
##
## Revision 1.35 2000/05/18 18:59:40 peterg
## Removed the First time stuff
##
## Revision 1.34 2000/05/16 18:56:14 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.37 2000/08/01 12:25:06 peterg
## Now includes euler
##
## Revision 1.36 2000/05/19 17:48:16 peterg
## Argument to state
##
## Revision 1.35 2000/05/18 18:59:40 peterg
## Removed the First time stuff
##
## Revision 1.34 2000/05/16 18:56:14 peterg
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# Find system constants
Nx=`mtt_getsize $Sys x` # States
Nu=`mtt_getsize $Sys u` # Inputs
Ny=`mtt_getsize $Sys y` # Inputs
if [ "$method" = "implicit" ]; then
ode=cse
odeo=cseo
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
|
|
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# Find system constants
Nx=`mtt_getsize $Sys x` # States
Nu=`mtt_getsize $Sys u` # Inputs
Ny=`mtt_getsize $Sys y` # Inputs
if [ "$method" = "implicit" ]; then
ode=csex
odeo=cseo
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
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
endif
## Initialise
t = 0.0;
ddt = simpar.dt/simpar.stepfactor;
ilast = round(simpar.last/ddt)+1; # Total number of steps
## Following remove due to p2c bug
## [u] = zero_input(1); # Zero the input
mttj = 0;
for it = 1:ilast #Integration loop
[y] = $1_$odeo(x,u,t,par);# Output
[u] = $1_input(t,x,y); # Input
if mttj==0
mtt_write(t,x,y,$Nx,$Ny); # Write it out
endif
|
|
|
>
>
>
>
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
endif
## Initialise
t = 0.0;
ddt = simpar.dt/simpar.stepfactor;
ilast = round(simpar.last/ddt)+1; # Total number of steps
## Following removed due to p2c bug
## [u] = zero_input($Nu); # Zero the input
for MTTi=1:$Nu
u(MTTi) = 0;
endfor;
mttj = 0;
for it = 1:ilast #Integration loop
[y] = $1_$odeo(x,u,t,par);# Output
[u] = $1_input(t,x,y); # Input
if mttj==0
mtt_write(t,x,y,$Nx,$Ny); # Write it out
endif
|