Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove (or reduce) warnings that simulation time is greater than timer's time #9

Open
ralph-lange opened this issue May 16, 2022 · 0 comments
Assignees

Comments

@ralph-lange
Copy link
Collaborator

The FMIAdapterNode uses a standard ROS timer to advance the FMU simulation. If the timer's period is not much greater than the simulation step-size but close to it, the FMIAdapterNode frequently emits a warning "Simulation time [..] is greater than timer's time [..]. Is your step size to large?" as an info-level log message.

Explanation

Internally, the timer callback of FMIAdapterNode calls FMIAdapter::doStepsUntil(..) with the current ROS time obtained from Node::now(). Given this current ROS time, the function FMIAdapter::doStepsUntil(..) performs simulation steps until a time-point between now() - step_size/2 and now() + step_size/2 is reached, i.e., it rounds to the closest step-size.

If in the next invocation of the timer callback the current ROS time now() is still smaller than the time-point until the FMU simulation was advanced in the previous invocation, then the timer callback emits the warning stated above. This happens especially if the timer period is only slightly larger than the step-size and if the processing of the timer callback is preempted by other processes or threads.

Possible fixes

  1. Remove the warning completely.
  2. Reduce the number of warnings (e.g., only a first time and then only once per minute).

Notes

Independent of this warning: If FMIAdapter::doStepsUntil(..) is called with an older time-point that would cause a backward step, a runtime error is thrown.

@ralph-lange ralph-lange self-assigned this May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant