Main Content

Precision Time Protocol

Measurement and control systems increasingly use distributed system technologies. To distribute measurement or control tasks over interconnected computing devices, such systems maintain a system-wide sense of time. Simulink® Real-Time™ uses the Precision Time Protocol (PTP) to synchronize the system clock of each target computer to a reference time.

PTP (IEEE® 1588) is a protocol that synchronizes PTP clocks throughout a computer network. The current version of PTP (IEEE 1588-2008) describes a hierarchical architecture for clock distribution.

By design, this protocol is more accurate for local systems than the Network Time Protocol (NTP) and more robust than the Global Positioning System (GPS). On a local area network, the protocol achieves PTP clock accuracy in the sub micro second range, making it suitable for distributed measurement. When you use this protocol to synchronize Simulink Real-Time applications across multiple target computers, it can synchronize execution to under 10 µs.

Suppose that you are designing a control system for a wind power plant. To determine the plant parameters, you attach sensors that acquire the data shown in the diagram.

To record the data and timestamps, connect the sensors to a set of data acquisition target computers. Interconnect the data acquisition computers through an Ethernet network and a switch that supports the PTP protocol (a PTP transparent clock or boundary clock). To access the data and timestamps, connect the target computers to a development computer through another Ethernet network and switch. On the development computer, run MATLAB® to do the data analysis, including:

  • Sorting by time the data recorded on the different computers to analyze the event sequence over time.

  • Filtering sensor data that has invalid (unsynchronized) timestamps.

  • Integrating values of measured data collected at the same time from sensors connected to different computers.

Finally, you build and download the real-time applications to each target computer, run the applications, and collect and analyze the results at each valid timestamp. You use the results to design a control system for the wind power generator.

Simulink Real-Time supports the PTP protocol by using the RTOS PTP daemon. The ptpd daemon implements the Precision Time Protocol (PTP) Version 2 as defined by the IEEE 1588-2008 standard. For more information about the daemon, see the QNX Neutrino documentation.

To synchronize the target computer PTP clocks:

  1. Connect the target computers by using their Intel® i210 Ethernet cards.

  2. On the target computer that sends the clock, start the PTP daemon by using the start(target_object.ptpd) command or the target_object.ptpd.AutoStart property.

  3. On the target computer that receives the clock, start the PTP daemon by using the start(target_object.ptpd) command or the target_object.ptpd.AutoStart property.

The PTP protocol on the target computer that receives the clock synchronizes its clock to the PTP protocol on the target computer that sends the clock. The hardware timestamp from the Intel i210 Ethernet cards provides IEEE 1588-2008 standard compliant clock synchronization.

To get information about clock synchronization, add an IEEE 1588 Read Parameter block to the model. This block outputs a Precision Time Protocol parameter value that you select. For more information, see IEEE 1588 Read Parameter.

See Also

|

Related Examples

More About

External Websites