Overview
Comment:This still needs worjk doing for c generation!!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3a08793cf5fb7e0ea0596ae64116828f95c4ee8d2cb4c0a094681e38fa7996db
User & Date: gawthrop@users.sourceforge.net on 1998-05-24 12:47:39
Other Links: branch diff | manifest | tags
Context
1998-05-24
15:43:10
Added symbolic solution of alg. equations (-A) check-in: 38619f5a57 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:47:39
This still needs worjk doing for c generation!! check-in: 3a08793cf5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-05-23
16:18:37
ordinary differential equation.m files generated with the new ode2lang
method.
check-in: ffb4b91e0b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/lang_header from [75ad26faec] to [72de602827].

1
2
3
4
5
6
7
8
9
10



11
12
13
14
15
16
17
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
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 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("  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);
    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);
  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
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("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 ]