Overview
| Comment: | Reset open switches after update to eliminate overshoots. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
166ac6ed30e046ab680ef831f407413c |
| User & Date: | geraint@users.sourceforge.net on 2005-04-26 23:43:35.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2005-08-05
| ||
| 15:35:17 | Fixed _ in ports check-in: 065c2e0e55 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
|
2005-04-26
| ||
| 23:43:35 | Reset open switches after update to eliminate overshoots. check-in: 166ac6ed30 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
| 22:52:26 | The Octave load/save -ascii option is deprecated in favour of -text check-in: 091179f94f user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Added mttroot/mtt/bin/trans/m/mtt_zeroswitches.m version [ac6908b24d].
Modified mttroot/mtt/bin/trans/make_ode2odes
from [b57eec8f4f]
to [24363b5ab0].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
| > > > | 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 |
EOF
fi
cat <<EOF >> $filename
[open_switches] = ${sys}_logic(x,u,t,par); # Switch logic
[x] = $algorithm; # Integration update
t = t + ddt; # Time update
mttj = mttj+1; # Increment counter
if mttj==simpar.stepfactor
mttj = 0; # Reset counter
endif
endfor; # Integration loop
| > > | 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 |
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))
}
EOF
case "$method" in
"implicit")
cat <<EOF >> $filename
inline ColumnVector
mtt_implicit (ColumnVector &x,
| > > > > > > > > > > > > > > | 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 |
;;
esac
## Common stuff
cat <<EOF >> $filename
open_switches = mtt_logic (x, u, t, par);
x = $algorithm;
t += ddt;
j++;
j = (j == static_cast<int> (stepfactor)) ? 0 : j;
}
}
| > > | 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;
}
}
|
| ︙ | ︙ |