Overview
Comment:Fixed bugs with ny>1. Could be made faster by not generating y when
y_sim >1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: f2956c27241b487b08f3780a2ef9594136d38b629e929a7173335553ad22bdbb
User & Date: gawthrop@users.sourceforge.net on 2000-05-17 17:20:49
Other Links: branch diff | manifest | tags
Context
2000-05-18
09:27:07
Now does matrix version of smxa check-in: a82ebd773f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-05-17
17:20:49
Fixed bugs with ny>1. Could be made faster by not generating y when
y_sim >1
check-in: f2956c2724 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:02:58
Fixed documentation check-in: a4862b1949 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_make_sim from [b302223b07] to [d1873d8c15].

9
10
11
12
13
14
15



16
17
18
19
20
21
22
# Copyright (C) 2000 by Peter J. Gawthrop

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



## Revision 1.4  2000/05/16 18:57:15  peterg
## Still debugging
##
## Revision 1.3  2000/05/16 11:59:34  peterg
## Stard new version with data files not argv.
##
## Revision 1.2  2000/05/11 19:32:29  peterg







>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2000/05/17 16:01:42  peterg
## Fixed bug for n_y>1
##
## Revision 1.4  2000/05/16 18:57:15  peterg
## Still debugging
##
## Revision 1.3  2000/05/16 11:59:34  peterg
## Stard new version with data files not argv.
##
## Revision 1.2  2000/05/11 19:32:29  peterg
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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
189
190
191
192
193
194
195
196
197
198

199
200
201
202
203
204
205
206
207

  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## main simulation loop
  n_sim = max(1,n_sens);
  for i_sim=1:n_sim
    if i_sim==1
      i_1 = 2;
    else
      i_1 = 2+n_y;
    endif;

    if doing_state
      i_2 = i_1 + n_y - 1;
      i_3 = i_1 + n_y + 1;
      i_4 = i_1 + n_y + $Nx;
    else
      if doing_sensitivities
        i_2 = 1 + 2*n_y;
        ipars = [ipar; [sensitivities(i_sim) 1]];
        save -ascii   $1_numpar.dat ipars 
      else
        i_2 = i_1 + n_y -1;
      endif
    endif;

    if doing_state # Need to cut twice
      command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i,%i-%i | tail -%i;", i_1,i_2,i_3,i_4,n_t);
    else
      command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i | tail -%i;", i_1,i_2,n_t);
    end;

  ## Execute external programme
  S = [S;sprintf("Run %i\t",i_sim)];
  tim = time;
  yy_str=system(command);
  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## Convert data
  S = [S;sprintf("Conv %i\t",i_sim)];
  tim = time;
  yy = str2num(yy_str)'; #'
  dtime = time-tim;
  T = [T; num2str(dtime)];


  [N_yy,M_yy] = size(yy);

  if i_sim==1




    y = yy(1:n_y,:);              # Output
    i_1 = n_y+1;
    if doing_state 

      i_2 = i_1 + $Nx - 1;
      ys = yy(i_1:i_2,:);
    endif;
  else
    i_1 = 1;
  endif

  if doing_sensitivities
    i_2 = i_1 - 1 + n_y;
    ys =  [ys; yy(i_1:i_2,:)];
  endif; 


  endfor;
  ##RealTime = [S T]
endfunction

EOF
    
else








<
|
<
<
<















|
|
|
|
|



















>
>
>
>
|
|

>



|
<
<
<
|
<
|
|
>

|







137
138
139
140
141
142
143

144



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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
189
190
191
192
193
194
195



196

197
198
199
200
201
202
203
204
205
206
207
208

  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## main simulation loop
  n_sim = max(1,n_sens);
  for i_sim=1:n_sim

    i_1 = 2;




    if doing_state
      i_2 = i_1 + n_y - 1;
      i_3 = i_1 + n_y + 1;
      i_4 = i_1 + n_y + $Nx;
    else
      if doing_sensitivities
        i_2 = 1 + 2*n_y;
        ipars = [ipar; [sensitivities(i_sim) 1]];
        save -ascii   $1_numpar.dat ipars 
      else
        i_2 = i_1 + n_y -1;
      endif
    endif;

      if doing_state # Need to cut twice
        command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i,%i-%i | tail -%i;", i_1,i_2,i_3,i_4,n_t);
      else # not doing_state
        command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i | tail -%i;", i_1,i_2,n_t);
      endif

  ## Execute external programme
  S = [S;sprintf("Run %i\t",i_sim)];
  tim = time;
  yy_str=system(command);
  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## Convert data
  S = [S;sprintf("Conv %i\t",i_sim)];
  tim = time;
  yy = str2num(yy_str)'; #'
  dtime = time-tim;
  T = [T; num2str(dtime)];


  [N_yy,M_yy] = size(yy);

  if i_sim==1
    if doing_sensitivities
      y = yy(1:n_y:2*n_y,:);              # Output
      ys = yy(2:n_y:2*n_y,:);
    else
      y = yy(1:n_y,:);
    endif;
    if doing_state 
      i_1 = n_y+1;
      i_2 = i_1 + $Nx - 1;
      ys = yy(i_1:i_2,:);
    endif;
  else # i_sim>1



    if doing_sensitivities

      ys =  [ys; yy(2:n_y:2*n_y,:)];
    endif; 
  endif

   endfor;
  ##RealTime = [S T]
endfunction

EOF
    
else


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