Overview
Comment:Added switches
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 37d2b01af35f8e81dd0be8a29fc9a1159d24bdd9d050eb03e38a1653ed0dff7e
User & Date: gawthrop@users.sourceforge.net on 1998-07-25 18:18:23.000
Other Links: branch diff | manifest | tags
Context
1998-07-25
18:26:33
*** empty log message *** check-in: 73f4b5eedb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:18:23
Added switches check-in: 37d2b01af3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:59:40
Give other procedures local i,j vars. check-in: 874ad25f70 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
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
54
55
56
# 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










>










>
|
>
|
|
|
|
|
|
>







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
54
55
56
57
58
59
60
# 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
DDT = DT/STEPFACTOR;

#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
    for i = 1:STEPFACTOR
	MTTu = $1_input(MTTx,t);# Input
        MTTx = $1_switch(MTTx); # Switches
	MTTdx = $1_ode(MTTx,MTTu,t);
	for j = 1:$Nx
	    MTTx(j) = MTTx(j) + MTTdx(j)*DDT;
	end;
	MTTy = $1_odeo(MTTx,MTTu,t);
	t = t + DDT;
    end;
    mtt_write(t,MTTx,MTTy,$Nx,$Ny);
end;

EOF



︙︙

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