Synchronizing clocks with Simulink Realtime
8 views (last 30 days)
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.
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.
Stefanie Schwarz on 5 Apr 2023
PTP support was added to the Simulink Real-Time product in the meantime:
Links for R2020b and later:
Links for R2020a and prior: