Differences From Artifact [75ad26faec]:

To Artifact [72de602827]:


1
2
3
4
5
6
7
8
9
10



11
12
13
14
15
16
17
#!/bin/sh

# Generates function header for a computer language
# PJ Gawthrop May 1998

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



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


# Set up the language specific stuff
system=$1
rep=$2
language=$3










>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# Generates function header for a computer language
# PJ Gawthrop May 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/05/23 16:17:40  peterg
## Initial revision
##
###############################################################


# Set up the language specific stuff
system=$1
rep=$2
language=$3
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
98




99
100
101
102
103
104
105

# Declarations
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  printf("$Lc Declare standard arrays $Rc\n");
  printf("  extern double y[%i]; \t $Lc $1_ode output $Rc\n", ny+1);
  printf("  extern double dx[%i]; \t $Lc $1_ode state derivative $Rc\n", nx+1);
  printf("  extern double x[%i]; \t $Lc $1_ode state $Rc\n", nx+1);
  printf("  extern double u[%i]; \t $Lc $1_ode input $Rc\n\n", nu+1);

  printf("$Lc Dummy variable list $Rc\n");
  printf("  double t0;\n\n");


  printf("$Lc State variable list $Rc\n");
  for i = 1:nx
    printf("  double mttx%i\n",i);
  end;
printf("\n");

printf("$Lc State variable input list $Rc\n");
for i = 1:nu
  printf("  double mttu%i\n",i);
end;
printf("\n");

printf("$Lc Counter $Rc\n");
printf("  int i;\n");
printf("\n");





EOF

fi

# Any extra bits ..
if [ -n "$extras" ]; then







|
|
|
|







|





|






>
>
>
>







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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

# Declarations
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  printf("$Lc Declare standard arrays $Rc\n");
  printf("  extern double mtty[%i]; \t $Lc $1_ode output $Rc\n", ny+1);
  printf("  extern double mttdx[%i]; \t $Lc $1_ode state derivative $Rc\n", nx+1);
  printf("  extern double mttx[%i]; \t $Lc $1_ode state $Rc\n", nx+1);
  printf("  extern double mttu[%i]; \t $Lc $1_ode input $Rc\n\n", nu+1);

  printf("$Lc Dummy variable list $Rc\n");
  printf("  double t0;\n\n");


  printf("$Lc State variable list $Rc\n");
  for i = 1:nx
    printf("  double mttx%i;\n",i);
  end;
printf("\n");

printf("$Lc State variable input list $Rc\n");
for i = 1:nu
  printf("  double mttu%i;\n",i);
end;
printf("\n");

printf("$Lc Counter $Rc\n");
printf("  int i;\n");
printf("\n");

printf("$Lc Time $Rc\n");
printf("  double t;\n");
printf("\n");

EOF

fi

# Any extra bits ..
if [ -n "$extras" ]; then
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Use octave for this bit - needs the definition file
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;


printf("$Lc======  Read in the input ======$Rc\n");
printf("mttu = $1_input(mttx,t)\n");
printf("\n");


printf("$Lc====== Set up the state variables ======$Rc\n");
for i = 1:nx
  printf("  mttx%i = mttx$Lb%i$Rb;\n",i,i);
end;







|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Use octave for this bit - needs the definition file
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;


printf("$Lc======  Read in the input ======$Rc\n");
printf("mttu = $1_input(mttx,t);\n");
printf("\n");


printf("$Lc====== Set up the state variables ======$Rc\n");
for i = 1:nx
  printf("  mttx%i = mttx$Lb%i$Rb;\n",i,i);
end;

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