Differences From Artifact [b57eec8f4f]:

To Artifact [24363b5ab0]:


1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21











+
+
+







#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.89  2004/08/29 16:04:44  geraint
## Fixed ae for non-sorted code.
##
## Revision 1.88  2004/08/29 13:15:28  geraint
## Uses sys_sae instead of sys_ae if sorted equations are being used.
##
## Revision 1.87  2004/08/29 01:46:56  geraint
## Added rules to create ode2odes for sorted system: sesx and sesy.
##
## Revision 1.86  2004/08/29 00:19:49  geraint
508
509
510
511
512
513
514


515
516
517
518
519
520
521
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526







+
+








EOF
fi

cat <<EOF >> $filename
    [open_switches] = ${sys}_logic(x,u,t,par); # Switch logic
    [x] = $algorithm; # Integration update
    [open_switches] = ${sys}_logic(x,u,t,par); # Switch logic
    [x] = mtt_zeroswitches(x,$Nx,open_switches);
    t = t + ddt;   # Time update
    mttj = mttj+1;    # Increment counter
    if mttj==simpar.stepfactor
       mttj = 0;      # Reset counter
    endif

  endfor;			# Integration loop
806
807
808
809
810
811
812














813
814
815
816
817
818
819
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838







+
+
+
+
+
+
+
+
+
+
+
+
+
+







  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_${odeo}", args, 1);
  return f(0).${vector_value} ();
#endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))
}

inline ColumnVector
mtt_zeroswitches (ColumnVector &x,
		  const int Nx,
		  const ColumnVector &openx)
{
  for (register int i = 0; i < Nx; i++) {
    if (0 != openx (i)) {
      x(i) = 0.0;
    }
  }
  return x;
}
  

EOF
case "$method" in
    "implicit")
	cat <<EOF >> $filename
inline ColumnVector
mtt_implicit (ColumnVector &x,
1194
1195
1196
1197
1198
1199
1200


1201
1202
1203
1204
1205
1206
1207
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228







+
+







    ;;
esac

## Common stuff
cat <<EOF >> $filename
      open_switches = mtt_logic (x, u, t, par);
      x =  $algorithm; 
      open_switches = mtt_logic (x, u, t, par);
      x = mtt_zeroswitches (x, $Nx, open_switches);
      t += ddt;
      j++;
      j = (j == static_cast<int> (stepfactor)) ? 0 : j;
    }

}


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