Skip to content

Commit

Permalink
- Fix for delay() when the time step taken was larger than the max delay
Browse files Browse the repository at this point in the history
  - This is a problem because the next value from the buffer will be used even though it has not been initialized
  - Should possibly be fixed in the future by changing the assert to i+1, and changing the solver to never take a too large time step


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5628 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 3, 2010
1 parent bb45ea3 commit cfd11e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions c_runtime/simulation_delay.cpp
Expand Up @@ -227,6 +227,10 @@ double delayImpl(int exprNumber, double exprValue, double time, double delayTime
else {
i = findTime(timeStamp, delayStruct);
assert(i < delayStruct->currentIndex);
// Was it the last value?
if (i+1 == delayStruct->currentIndex) {
return value0;
}
t_TimeAndValue *nearest = delayStruct->expressionDelayBuffer + i;
time0 = nearest[0].time;
value0 = nearest[0].value;
Expand Down

0 comments on commit cfd11e2

Please sign in to comment.