Overview
Comment:Now handles derivative causality when fixcc is set in _dae.r
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 723f46c1d756735bdf2319a0b26f3dc5f7495f56ec608aec684d52f24b185fa6
User & Date: gawthrop@users.sourceforge.net on 2002-05-13 08:16:32
Other Links: branch diff | manifest | tags
Context
2002-05-13
08:52:23
FIRST parameter of simpar now specifies first printed point -
simulation still starts at zero
check-in: b97e3c9beb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:16:32
Now handles derivative causality when fixcc is set in _dae.r check-in: 723f46c1d7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2002-05-11
01:14:17
Fix for [ 553218 ] simpar.oct and simpar.m different.
Translation added between ColumnVector in base .cc and Octave_map in .oct.
check-in: b6a47212b3 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/cse2smx_lang from [cb75626e58] to [6253408dee].

26
27
28
29
30
31
32
33


34

35

36
37
38
39
40
41
42
26
27
28
29
30
31
32

33
34
35
36

37
38
39
40
41
42
43
44







-
+
+

+
-
+







	matrix='yes';
	;;
    -optimise)
	optimise='LOAD SCOPE; ON GENTRANOPT;';
        iname='INAME mtt_o;';
	;;
    -fixcc )
        fix_pow='FOR ALL x,y LET x^y = pow(x,y);'
        fix_mtt_pow='FOR ALL x,y LET x^y = mtt_pow(x,y);'
        operator='OPERATOR mtt_pow;'
        blurb2='fixing c and cc code';
        unfix_mtt_pow='FOR ALL x,y CLEAR x^y;'
        unfix_pow='FOR ALL x,y CLEAR x^y;'
        unfix_pow='FOR ALL x,y LET pow(x,y) = x^y;';
		;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done
104
105
106
107
108
109
110

111
112
113
114
115
116
117
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120







+







rm -f $1_smxx.$lang
rm -f $1_smxtx.$lang
rm -f $1_$rep.body

# Use reduce to accomplish the transformation
$SYMBOLIC << EOF  >cse2smx_lang.log

${operator} %% Define mtt_pow if needed
lang := $lang;

in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";

161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176

177
178
179
180
181

182
183
184
185
186
187
188
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178

179
180
181
182
183

184
185
186
187
188
189
190
191







-
+







-
+




-
+







    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

  ${fix_pow} %% set x^y to pow(x,y)
 ${unfix_pow} %% set pow(x,y) to x^y

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
    FOR j := 1:MTTNx DO
    BEGIN
      ${unfix_pow} %% Revert to x^y form
      ${unfix_mtt_pow} %% Revert to x^y form
      ij := i + MTTNx*(j-1);
      xj := mkid(mttx,j);
      a_ij := df(MTTEdx(i,1), xj, 1);
      aa_ij := MTTE(i,j) - mttt*a_ij;
      ${fix_pow} %% set x^y to pow(x,y)
      ${fix_mtt_pow} %% set x^y to mtt_pow(x,y)
      IF (aa_ij NEQ 0) THEN
        IF ($nmatrix EQ 1) THEN
        BEGIN
          %% Write a  with full indexing
          $iname
          GENTRAN mtta(i,j) ::=: aa_ij;
        END;
200
201
202
203
204
205
206

207
208
209
210
211
212
213




214
215
216
217
218

219
220
221
222
223
224
225
226
227
228
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226
227
228
229
230
231
232











+







+
+
+
+




-
+






-
-
-
-
          $iname
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;


  END;

  
%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF

fix_broken_numbers ( ) {
    sed -e "/[0-9.]$/ N" -e "s/\([0-9.]\)[\n\t\ ]*\([0-9]\)/\1\2/g"
}

refix_pow() {
    sed 's/mtt_pow/pow/g'
}

if [ "$lang" = "m" ]; then
#  lang_header $noglobals $parameters $1 $rep m 'mttx,mttu,mttt,mttpar' $out > $1_$rep.m
  mtt_header $1 $rep m > $1_$rep.m
  cat $1_$rep.body | fix_broken_numbers | mtt_p2m >> $1_$rep.m
  cat $1_$rep.body | fix_broken_numbers | refix_pow | mtt_p2m >> $1_$rep.m
  echo "## END Code" >> $1_$rep.m
  echo "endfunction" >> $1_$rep.m
fi
 
# Now invoke the standard error handling.
mtt_error_r cse2smx_lang.log





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