Overview
Comment:Global parameter passing.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 56cc8a5b8b8962ff616b33ca77288bff8da5e1217756d3c1e8bed9741076d217
User & Date: gawthrop@users.sourceforge.net on 1996-08-24 14:16:25.000
Other Links: branch diff | manifest | tags
Context
1996-08-24
14:22:23
Put in a ; to avoid excessive log output. check-in: 9252d5aab2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:16:25
Global parameter passing. check-in: 56cc8a5b8b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:02:39
Included glabal parameter passing.
Proper error handling.
check-in: 5ca9342409 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994.

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



## Revision 1.2  1996/08/12 20:22:20  peter
## Paramaters passed via an internal call to _numpar.
## _args script can overide these parameters - sneaky.
##
## Revision 1.1  1996/08/12 19:09:13  peter
## Initial revision
##







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1996/08/18 12:02:46  peter
## Fixed bug when some matrices are empty.
##
## Revision 1.2  1996/08/12 20:22:20  peter
## Paramaters passed via an internal call to _numpar.
## _args script can overide these parameters - sneaky.
##
## Revision 1.1  1996/08/12 19:09:13  peter
## Initial revision
##
︙︙
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
write "% [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm;;";
write "% Linearised descriptor matrices for system $1";
write "% File $1_dm.m";
write "% Generated by MTT";

IF MTTNvar>0 THEN
BEGIN
  write "% Read in the parameters";
  write "[ ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), "] = $1_numpar"
  END;
  write "% Read in the arguments";
  write "$1_args";
END;




%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$







|
|


|
|

<
<

<
<







60
61
62
63
64
65
66
67
68
69
70
71
72
73


74


75
76
77
78
79
80
81
write "% [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm;;";
write "% Linearised descriptor matrices for system $1";
write "% File $1_dm.m";
write "% Generated by MTT";

IF MTTNvar>0 THEN
BEGIN
  write "% Parameters";
  write "global ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), " ..."
                  ELSE write MTTVar(i,1), ";"
  END;


END;




%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
︙︙
︙︙
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.4  1996/08/16 13:04:46  peter
## Fixed problem with more than one output (y vector).
##
## Revision 1.3  1996/08/16 06:36:03  peter
## Removed u from default arg list.
##
## Revision 1.2  1996/08/15 16:24:43  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.5  1996/08/18 12:01:26  peter
## Unified format of time responses.
##
## Revision 1.4  1996/08/16 13:04:46  peter
## Fixed problem with more than one output (y vector).
##
## Revision 1.3  1996/08/16 06:36:03  peter
## Removed u from default arg list.
##
## Revision 1.2  1996/08/15 16:24:43  peter
︙︙
39
40
41
42
43
44
45
46



47
48
49
50
51
52
53
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log




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

  $PARAMS

  %Defaults







|
>
>
>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error

  %Read in parameters
  $1_numpar;

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

  $PARAMS

  %Defaults
︙︙
77
78
79
80
81
82
83













84
85
86
87
88
89
    i=i+1;
    y(i,:) = $1_odeo(x(i,:),tt)';
  end;
  write_matrix([T,y], '$1_odeso');
end;

EOF


























>
>
>
>
>
>
>
>
>
>
>
>
>






83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    i=i+1;
    y(i,:) = $1_odeo(x(i,:),tt)';
  end;
  write_matrix([T,y], '$1_odeso');
end;

EOF

err_length=$(wc -c <mtt_error)

# Test for errors and print if any
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi







︙︙
10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996

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



###############################################################

#Inform user
echo Creating $1_ode.m
echo Creating $1_odeo.m









>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/08/18 12:03:49  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_ode.m
echo Creating $1_odeo.m


︙︙
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
%Define the common part of the functions.

PROCEDURE common;
BEGIN
  IF MTTNvar>0 THEN
  BEGIN
    write "% Read in the parameters";
    write "[ ...;;";
    FOR i := 1:MTTNvar DO
    BEGIN
       IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                    ELSE write MTTVar(i,1), "] = $1_numpar"
    END;
  END;
  
  write "% Read in the input";
  write "u = $1_input(t)";

  write "% Read in the arguments";







|


|
|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%Define the common part of the functions.

PROCEDURE common;
BEGIN
  IF MTTNvar>0 THEN
  BEGIN
    write "% Read in the parameters";
    write "global ...;;";
    FOR i := 1:MTTNvar DO
    BEGIN
       IF i<MTTNvar THEN write MTTVar(i,1), " ..."
                    ELSE write MTTVar(i,1), ";"
    END;
  END;
  
  write "% Read in the input";
  write "u = $1_input(t)";

  write "% Read in the arguments";
︙︙
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cardno!* := 1$
fortwidth!* := 100$
OFF period$

MTTy := MTTy;

SHUT "$1_odeo.m";















<







119
120
121
122
123
124
125

126
127
128
129
130
131
132
cardno!* := 1$
fortwidth!* := 100$
OFF period$

MTTy := MTTy;

SHUT "$1_odeo.m";








︙︙
10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1996.

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



## Revision 1.2  1996/08/19 16:25:18  peter
## Fixed bug when Nx=0.
##
## Revision 1.1  1996/08/19 15:14:51  peter
## Initial revision
##
###############################################################







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1996/08/19 18:38:43  peter
## Read in the numerical params etc ...
##
## Revision 1.2  1996/08/19 16:25:18  peter
## Fixed bug when Nx=0.
##
## Revision 1.1  1996/08/19 15:14:51  peter
## Initial revision
##
###############################################################
︙︙
42
43
44
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
89
90
91
92
93
94
95
96
97
MTTNVar := 0;

%Read in the parameter file
IN "$1_sympar.r";


OUT "$1_sm.m";

%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)

IF MTTNvar>0 THEN
BEGIN
  write "function [MTTA,MTTB,MTTC,MTTD] = $1_sm(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), ");;";
  END;
END
ELSE write "function [MTTA,MTTB,MTTC,MTTD] = $1_sm;;";


IF MTTNvar>0 THEN
BEGIN
  write "%function [MTTA,MTTB,MTTC,MTTD] = $1_sm(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write "%", MTTVar(i,1), ",..."
                  ELSE write "%", MTTVar(i,1), ");;";
  END;
END
ELSE write "%function [MTTA,MTTB,MTTC,MTTD] = $1_sm;;";


write "%Linearised state matrices for system $1";
write "%File $1_sm.m";
write "%Generated by MTT";
IF MTTNvar>0 THEN
BEGIN
  write "% Read in the parameters";
  write "[ ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), "] = $1_numpar"
  END;
  write "% Read in the arguments";
  write "$1_args";
END;


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$







<



<
<
|
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<






|
|


|
|

<
<







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
MTTNVar := 0;

%Read in the parameter file
IN "$1_sympar.r";


OUT "$1_sm.m";

%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)



write "function [MTTA,MTTB,MTTC,MTTD] = $1_sm;;";











write "%function [MTTA,MTTB,MTTC,MTTD] = $1_sm;;";









write "%Linearised state matrices for system $1";
write "%File $1_sm.m";
write "%Generated by MTT";
IF MTTNvar>0 THEN
BEGIN
  write "% Set the parameters";
  write "global ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), "..."
                  ELSE write MTTVar(i,1), ";"
  END;


END;


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
︙︙
︙︙
10
11
12
13
14
15
16



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

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



## Revision 1.5  1996/08/16 14:27:25  peter
## Make a dummy function when no parameters (MTTNVar=0).
##
## Revision 1.4  1996/08/15 12:46:59  peter
## Removed a spuriuos echo.
##
## Revision 1.3  1996/08/12 20:20:59  peter







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1996/08/20 08:21:24  peter
## *** empty log message ***
##
## Revision 1.5  1996/08/16 14:27:25  peter
## Make a dummy function when no parameters (MTTNVar=0).
##
## Revision 1.4  1996/08/15 12:46:59  peter
## Removed a spuriuos echo.
##
## Revision 1.3  1996/08/12 20:20:59  peter
︙︙
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
89
90
91
92
MTTNVar := 0;

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar.m";




IF MTTNvar>0 THEN
BEGIN
  write "function [ ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), "] = $1_numpar;;";
  END
END; 

if MTTNVar=0 THEN
  write "function foo=$1_numpar;;";


write "% function [par_list] = $1_numpar;";
write "% Created by MTT";

%% Write RCS stuff



IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
  BEGIN
    write MTTVar(i,1), "  = 1;	% Default value";
  END;
END;

if MTTNVar=0 THEN
  write "foo=0";


SHUT "$1_numpar.m";












>
>



|


|
|


<
<
<
<
<
<
<
<
<
<












<







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
MTTNVar := 0;

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar.m";

write "% Script $1_numpar;";
write "% Created by MTT";

IF MTTNvar>0 THEN
BEGIN
  write "global ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), " ..."
                  ELSE write MTTVar(i,1), ";";
  END
END; 












IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
  BEGIN
    write MTTVar(i,1), "  = 1;	% Default value";
  END;
END;

if MTTNVar=0 THEN
  write "foo=0";


SHUT "$1_numpar.m";





︙︙

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