Skip to content

Commit

Permalink
- Fix for sample(startTime,i). Now doesn't generate events unless tim…
Browse files Browse the repository at this point in the history
…e >= startTime, as expected.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4927 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 5, 2010
1 parent d3b57e1 commit 8634e48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion c_runtime/simulation_events.cpp
Expand Up @@ -334,7 +334,11 @@ double sample(double start, double interval) {
* below should be: if (tmp >= -0.0001 && tmp < 0.0001) but needs more testing as some models from
* testsuite fail.
*/
if (tmp >= -0.0001 && tmp < 0.0001) {
static double eps = 0.0001;
/*
* sjoelund - do not sample before the start value !
*/
if (globalData->timeValue >= start-eps && tmp >= -eps && tmp < eps) {
if (sim_verbose)
cout << "Calling sample(" << start << ", " << interval << ")\n"
<< "+generating an event at time:" << globalData->timeValue
Expand Down

0 comments on commit 8634e48

Please sign in to comment.