Overview
Comment:Reorganised initialisation
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b1d77fef00506c4699bfae172f9ba89c1ca5ff9b10c5dd20626d5d28517d51be
User & Date: gawthrop@users.sourceforge.net on 1998-07-25 13:05:46.000
Other Links: branch diff | manifest | tags
Context
1998-07-25
14:03:30
Added () to [] conversion when the variable is i j k or an integer or
combination
check-in: c6efb99ede user: gawthrop@users.sourceforge.net tags: origin/master, trunk
13:05:46
Reorganised initialisation check-in: b1d77fef00 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:39:57
begin on same line as for and if check-in: 30c874d920 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35






36
37
38
39
40
41
42
43
44
45
46
47
# Find system constants
Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
 

cat << EOF > $1_ode2odes.m
function $1_ode2odes
EOF

# Do the globals
sympar2global_txt2m $1 >> $1_ode2odes.m

# The rest of the program
cat << EOF >> $1_ode2odes.m

$1_simpar;			# Read in simulation parameters
$1_numpar;			# Read in parameters
MTTx = $1_state;	        # Read in state

iLast = round(Last/DT);         # Total number of steps
 

t = 0.0;






for it = 1:iLast
    MTTu = $1_input(MTTx,t);
    MTTdx = $1_ode(MTTx,MTTu,t);
    for j = 1:$Nx
      MTTx[j] = MTTx[j] + MTTdx[j]*DT;
    end;
    MTTy = $1_odeo(MTTx,MTTu,t);
    t = t + DT;
    mtt_write(t,MTTx,MTTy,$Nx,$Ny);
end;

EOF







|










<

|
|
>

>
>
>
>
>
>




|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Find system constants
Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
 

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

# Do the globals
sympar2global_txt2m $1 >> $1_ode2odes.m

# The rest of the program
cat << EOF >> $1_ode2odes.m

$1_simpar;			# Read in simulation parameters
$1_numpar;			# Read in parameters


iLast = round(LAST/DT);         # Total number of steps

#Initialise
t = 0.0;
MTTx = $1_state;	        # Read in initial state
MTTu = $1_input(MTTx,t);        # Evaluate initial input
MTTy = $1_odeo(MTTx,MTTu,t);    # Evaluate initial output
mtt_write(t,MTTx,MTTy,$Nx,$Ny); # And write them

#Integration loop
for it = 1:iLast
    MTTu = $1_input(MTTx,t);
    MTTdx = $1_ode(MTTx,MTTu,t);
    for j = 1:$Nx
      MTTx(j) = MTTx(j) + MTTdx(j)*DT;
    end;
    MTTy = $1_odeo(MTTx,MTTu,t);
    t = t + DT;
    mtt_write(t,MTTx,MTTy,$Nx,$Ny);
end;

EOF

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