Skip to content

Prevent time catch up in real time mode#1213

Merged
agodemar merged 4 commits intoJSBSim-Team:masterfrom
bcoconni:bcoconni/issue1187
Jan 3, 2025
Merged

Prevent time catch up in real time mode#1213
agodemar merged 4 commits intoJSBSim-Team:masterfrom
bcoconni:bcoconni/issue1187

Conversation

@bcoconni
Copy link
Member

This PR fixes the bug reported in the issue #1187.

A new class Timer is added that manages elapsed time. It is inheriting SGPropertyChangeListener so that every time the property simulation/reset is set the timer is properly reset.

The CI workflow is also modified to check that executing the following command takes at least 90 seconds (i.e. 2 runs of 25 seconds and 1 run of 40 seconds):

JSBSim scripts/c172_cruise_8K.xml --realtime --nice

The script c172_cruise_8K.xml is also simplified:

  • It runs quicker: the end time and the time that triggers the reset have been shortened.
  • The termination event has been removed. Instead the last run is executed until the end time is reached.

@bcoconni bcoconni linked an issue Dec 30, 2024 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 24.96%. Comparing base (330a6e3) to head (b61c15f).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1213   +/-   ##
=======================================
  Coverage   24.96%   24.96%           
=======================================
  Files         170      170           
  Lines       19281    19281           
=======================================
  Hits         4814     4814           
  Misses      14467    14467           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bcoconni bcoconni changed the title Fix time catch up in real time mode Prevent time catch up in real time mode Dec 30, 2024
@agodemar agodemar merged commit 5be7eab into JSBSim-Team:master Jan 3, 2025
@bcoconni bcoconni deleted the bcoconni/issue1187 branch January 3, 2025 17:01
@coasho
Copy link

coasho commented Jan 16, 2025

thanks @bcoconni for implementing this fix! The new Timer class with SGPropertyChangeListener handles the reset behavior really well. I tested PR #1213 and it works exactly as expected now.

bcoconni added a commit to bcoconni/jsbsim that referenced this pull request Feb 22, 2025
@bcoconni bcoconni added the bug label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reset command causes rapid time-catch-up in realtime mode

3 participants