Synchronizing clocks with Simulink Realtime

22 views (last 30 days)
Daniel
Daniel on 23 Jul 2014
Answered: Stefanie Schwarz on 5 Apr 2023
Greetings,
I wish to synchronize the clock of my Simulink Realtime machine to two Windows machines.
I was considering using etherCAT. Can the etherCAT master blocks synchronize clocks with etherCAT slaves? I heard from someone that he wasn't sure if etherCAT for Simulink supported distributed clocks and wanted to check.
If not, are there other ways to synchronize the clock of a Simulink Realtime machine with Windows machines, over ethercat (preferred) or otherwise? I looked into NTP and PTP (IEEE 1588), but it doesn't look like there is Simulink Realtime support.
Daniel

Answers (2)

Gordon Weast
Gordon Weast on 24 Jul 2014
This is an area that we're actively working on. Right now, there is no way to dynamically adjust the sample time interval of a running target machine. That's needed for any synchronization scheme where the target is a timing slave. We are working on a PTP implementation, but we're still not sure what release it will be in. This is what you need, but we don't have it yet.
With EtherCAT, we currently need to use the target's sample time be the timing master for devices on the EtherCAT network when we use distributed clocks. This isn't a way to synchronize with a Windows machine.
One way to get a target synchronized is to use an external interrupt to the target machine to run the model. Use a digital output from one of the Windows machines as the source of the signal you use. However, Windows has a lot more timing jitter than the target does when it runs from the timer. The long term average execution times are good from Windows, but not the individual times.
  1 Comment
Daniel
Daniel on 24 Jul 2014
Moved: Stefanie Schwarz on 5 Apr 2023
Greetings,
Thank you greatly for your help.
Responding to your second paragraph, if I had etherCAT slave software running on two Windows machines connected to my Simulink Realtime box set as an etherCAT master, would it be possible to synchronize the clocks that way?
I've also considered buying an etherCAT slave card from speedgoat and connecting my Simulink Realtime box to an etherCAT master on Windows and another etherCAT slave on WIndows. Is this plausible?
Finally, is there any current timetable for when the PTP implementation may be ready (ie next year, next five years, side project with no deadline)?
Thanks again for your help!
Daniel

Sign in to comment.


Stefanie Schwarz
Stefanie Schwarz on 5 Apr 2023

Community Treasure Hunt

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

Start Hunting!