Real-Time Synchronization dose not pause, please help

2 Ansichten (letzte 30 Tage)
bethel o
bethel o am 2 Aug. 2012
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

Akzeptierte Antwort

Jan Houska
Jan Houska am 2 Aug. 2012
Bearbeitet: Jan Houska am 2 Aug. 2012
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.
  3 Kommentare
bethel o
bethel o am 2 Aug. 2012
@ Jan
I have just tested my setup, everything has worked fine: Thank you very much for the code. You can forget about my second question above.
Thanks
Bethel
bethel o
bethel o am 6 Aug. 2012
Ok, after more critical testing, I found that it did not work. The external EEG box gave random time delayed output.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by