Real-Time Synchronization dose not pause, please help
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone!
I have a problem using the 'Real-Time Synchronization' block. My model is paused at certain times but the 'Real-Time Synchronization' does not seem to be paused too. I noticed this because when I resume the model, the model seem to run a lot faster to catch with the missed ticks(the lag during pause period).
What I really want is for the model to resume at exactly where it was when it was paused and continue to run at the original rate without attempting to catch up with the missed time during the pause period. How can I achieve this?
I just hope that I have made myself clear enough.
Thanks alot Bethel
0 个评论
采纳的回答
Jan Houska
2012-8-2
编辑:Jan Houska
2012-8-2
What you are trying to do is somewhat against the purpose of real-time synchronization. If you have your model connected to a real-world device, you can stop your model with the Pause button but this will (of course) not stop the real-world device time. Strange things may then happen when you continue the simulation because the state of the real-world device will probably not match what your model expects.
That said, it is possible to pause the real-time clock when the model pauses if you know what you are doing. In your model, go to File, Model Properties, Callbacks. As the PauseFcn callback, use
stop(getfield(RT.Kernel, 'Timers'));
and as the ContinueFcn callback, use
start(getfield(RT.Kernel, 'Timers'));
Please be warned that these functions are not documented and may be changed in a future release.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Target Computer Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!