Overview
Comment:Lowercase mttLAST etc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ef568d94e826d651eb966a05edd7f023e1d983becc3c8029ef98084ae6cd1076
User & Date: gawthrop@users.sourceforge.net on 1998-08-11 13:32:42
Other Links: branch diff | manifest | tags
Context
1998-08-11
13:38:35
Zapped the obsolete args stuff check-in: 3a2581cd75 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
13:32:42
Lowercase mttLAST etc check-in: ef568d94e8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:32:07
Added comments at procedure begin and end. check-in: f46e205efb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/dm2fr_m from [fda871e4a8] to [aa5007007b].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

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



## Revision 1.9  1998/02/26 15:12:26  peterg
## Removed parameter stuff
##
# Revision 1.8  1996/08/30  14:54:36  peter
# Took back lock.
#
## Revision 1.7  1996/08/24  14:23:00  peter







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.10  1998/07/27 20:27:25  peterg
## Now get parameters for simpar file.
##
## Revision 1.9  1998/02/26 15:12:26  peterg
## Removed parameter stuff
##
# Revision 1.8  1996/08/30  14:54:36  peter
# Took back lock.
#
## Revision 1.7  1996/08/24  14:23:00  peter
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
# Simulation parameters
  $1_simpar;

  [nx,ny,nu,nz,nyz] = $1_def

  %Defaults
  
  if exist('mttWMIN')==0
    mttWMIN = -1;
  end;

  if exist('mttWMAX')==0
    mttWMAX = 2;
  end;

  if exist('mttWSTEPS')==0
    mttWSTEPS = 100;
  end;

  W = logspace(mttWMIN,mttWMAX,mttWSTEPS)';

  if exist('u0')==0
    u0 = zeros(nu,1);
    u0(1) = 1;
  end;









|
|


|
|


|
|


|







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
# Simulation parameters
  $1_simpar;

  [nx,ny,nu,nz,nyz] = $1_def

  %Defaults
  
  if exist('mttwmin')==0
    mttwmin = -1;
  end;

  if exist('mttwmax')==0
    mttwmax = 2;
  end;

  if exist('mttwsteps')==0
    mttwsteps = 100;
  end;

  W = logspace(mttwmin,mttwmax,mttwsteps)';

  if exist('u0')==0
    u0 = zeros(nu,1);
    u0(1) = 1;
  end;


Modified mttroot/mtt/bin/trans/make_ode2odes from [12daf8e2e4] to [43be042abf].

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.6  1998/07/30 10:44:37  peterg
## INcluded othe integration methods.
##
## Revision 1.5  1998/07/26 11:02:20  peterg
## Put mtt or MTT  in front of variable names to avoid clashes with
## globals
##











>
>
>







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.7  1998/07/30 11:29:54  peterg
## Added implicit integration stuff
##
## Revision 1.6  1998/07/30 10:44:37  peterg
## INcluded othe integration methods.
##
## Revision 1.5  1998/07/26 11:02:20  peterg
## Put mtt or MTT  in front of variable names to avoid clashes with
## globals
##
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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

MTTiLast = round(mttLAST/mttDT);         # Total number of steps
mttDDT = mttDT/mttSTEPFACTOR;

#Initialise
MTTt = 0.0;
[MTTx] = $1_state;	        # Read in initial state
[MTTu] = $1_input(MTTx,MTTt);        # Evaluate initial input
[MTTy] = $1_odeo(MTTx,MTTu,MTTt);    # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them
[mttA] = zeros($Nx); # Zero the A matrix

if mttMETHOD==2 #Linear implicit
  mttA = $1_smx(MTTx,MTTu); # Set up A matrix - linearised system
end;

#Integration loop
for MTTit = 1:MTTiLast
    for MTTi = 1:mttSTEPFACTOR
        [MTTu] = $1_input(MTTx,MTTt);# Input
        [MTTx] = $1_switch(MTTx); # Switches
        [MTTdx] = $1_ode(MTTx,MTTu,MTTt);
        if mttMETHOD==3
          mttA = $1_smx(MTTx,MTTu); # Set up A matrix - linearised system
        end;
        [MTTx] = mtt_update(MTTdx,MTTx,mttDDT,$Nx,mttMETHOD,mttA);
        [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
	MTTt = MTTt + mttDDT;
    end;
    mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
end;

EOF











<
|
|









|




|
|



|


|

|









48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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

MTTilast = round(mttlast/mttdt);         # Total number of steps
mttddt = mttdt/mttstepfactor;

#Initialise
MTTt = 0.0;
[MTTx] = $1_state;	        # Read in initial state
[MTTu] = $1_input(MTTx,MTTt);        # Evaluate initial input
[MTTy] = $1_odeo(MTTx,MTTu,MTTt);    # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them
[mttA] = zeros($Nx); # Zero the A matrix

if mttmethod==2 #Linear implicit
  mttA = $1_smx(MTTx,MTTu); # Set up A matrix - linearised system
end;

#Integration loop
for MTTit = 1:MTTilast
    for MTTi = 1:mttstepfactor
        [MTTu] = $1_input(MTTx,MTTt);# Input
        [MTTx] = $1_switch(MTTx); # Switches
        [MTTdx] = $1_ode(MTTx,MTTu,MTTt);
        if mttmethod==3
          mttA = $1_smx(MTTx,MTTu); # Set up A matrix - linearised system
        end;
        [MTTx] = mtt_update(MTTdx,MTTx,mttddt,$Nx,mttmethod,mttA);
        [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
	MTTt = MTTt + mttddt;
    end;
    mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
end;

EOF




Modified mttroot/mtt/bin/trans/sm2sr_m from [ff6fb9a1d5] to [23cd003cc0].

12
13
14
15
16
17
18



19
20
21
22
23
24
25
# Copyright (c) P.J.Gawthrop, 1996.

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



## Revision 1.14  1998/07/25 10:00:48  peterg
## *** empty log message ***
##
## Revision 1.13  1997/06/13 12:52:18  peterg
## Removed extra ; from $PARAMS
##
# Revision 1.12  1996/09/12  18:45:31  peter







>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  1998/07/27 20:31:40  peterg
## New simpar version
##
## Revision 1.14  1998/07/25 10:00:48  peterg
## *** empty log message ***
##
## Revision 1.13  1997/06/13 12:52:18  peterg
## Removed extra ; from $PARAMS
##
# Revision 1.12  1996/09/12  18:45:31  peter
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

  % Read in the simulation parameters
  $1_simpar;

  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.

  T=[0:mttDT:mttLAST]'

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);







|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

  % Read in the simulation parameters
  $1_simpar;

  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.

  T=[0:mttdt:mttlast]'

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);

Modified mttroot/mtt/bin/trans/txt2m from [bc8b4abfab] to [b8cecb2297].

11
12
13
14
15
16
17



18
19
20
21
22
23
24


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



# %% Revision 1.8  1998/07/30 12:52:38  peterg
# %% Adds ; to end of statements
# %% Translates ' to " before removal
# %%
# %% Revision 1.7  1998/07/30 09:32:33  peterg
# %% Replaces:
# %% 	euler by 1







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.9  1998/07/30 15:07:17  peterg
# %% Added _ to the disallowed chars around t
# %%
# %% Revision 1.8  1998/07/30 12:52:38  peterg
# %% Adds ; to end of statements
# %% Translates ' to " before removal
# %%
# %% Revision 1.7  1998/07/30 09:32:33  peterg
# %% Replaces:
# %% 	euler by 1
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
quote = "\047";
doublequote = "\042";
}
{
  N=split($1,a,"=");
  if (N==2) {
    LHS = a[1];
    RHS = tolower(a[2]);
    gsub(quote, doublequote, RHS);









    sub(/["]*euler["]*/, 1, RHS);   
    sub(/["]*implicitl["]*/, 2, RHS);   
    sub(/["]*implicit["]*/, 3, RHS);  
    statement = sprintf("%s=%s",LHS,RHS);
    if (match(statement,";")==0)


      statement = sprintf("%s;", statement);
  }
  else
    statement = $1;

  if (NF<2) print statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
     -e 's/LAST/mttLAST/g' \
     -e 's/DT/mttDT/g' \
     -e 's/STEPFACTOR/mttSTEPFACTOR/g' \
     -e 's/METHOD/mttMETHOD/g' \
     -e 's/WMIN/mttWMIN/g' \
     -e 's/WMAX/mttWMAX/g' \
     -e 's/WSTEPS/mttWSTEPS/g' \
     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \
>> $1_$2.m











|

>
>
>
>
>
>
>
>
>



|
|
>
>










<
<
<
<
<
<
<








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
128
129
130
131
quote = "\047";
doublequote = "\042";
}
{
  N=split($1,a,"=");
  if (N==2) {
    LHS = a[1];
    RHS = a[2];
    gsub(quote, doublequote, RHS);
    sub(/^LAST/, "mttLAST", LHS);
    sub(/^DT/, "mttDT", LHS);
    sub(/^STEPFACTOR/, "mttSTEPFACTOR", LHS);
    sub(/^METHOD/, "mttMETHOD", LHS);
    sub(/^WMIN/, "mttWMIN", LHS);
    sub(/^WMAX/, "mttWMAX", LHS);
    sub(/^WSTEPS/, "mttWSTEPS", LHS);
    LHS = tolower(LHS);
    RHS = tolower(RHS);
    sub(/["]*euler["]*/, 1, RHS);   
    sub(/["]*implicitl["]*/, 2, RHS);   
    sub(/["]*implicit["]*/, 3, RHS);  
    statement = sprintf("%s= %s",LHS,RHS);
    if ( (match(statement,";")==0)&&\
         ((match(statement,"if ")==0))&&\
         ((match(statement,"for ")==0)) )
      statement = sprintf("%s;", statement);
  }
  else
    statement = $1;

  if (NF<2) print statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \







     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \
>> $1_$2.m





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