Real-Time Synchronization dose not pause, please help

4 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Jan Houska
Jan Houska il 2 Ago 2012
Modificato: Jan Houska il 2 Ago 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 Commenti
bethel o
bethel o il 2 Ago 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 il 6 Ago 2012
Ok, after more critical testing, I found that it did not work. The external EEG box gave random time delayed output.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su EEG/MEG/ECoG in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by