Time synchronization

This section describes how to perform time synchronization of HIL device(s).

IRIG-B

IRIG-B is a serial date-time format consisting of a 1-second frame that contains 100 pulses divided into fields. The time-synchronized device decodes the second, minute, hour and day fields and sets its internal time clock upon detecting the valid time data in the IRIG time mode.

HIL devices support unmodulated IRIG-B input. The unmodulated IRIG-B time-code is IRIG-B00x. The last digit, either 2 or 0, indicates the coded expression(s).

The time-code format IRIG-B002 is a binary-coded decimal (BCD) timecode (HH, MM, SS, DDD). This format represents the traditional, or legacy IRIG-B.

The time-code format IRIG-B000 consists of a BCD timecode (HH, MM, SS, DDD), plus straight binary seconds (SBS) of the day (0-86400 s), and also contains control function extensions that include data for: year, leap seconds, daylight time, UTC time offset, time quality and parity (odd).

When using the IRIG-B000 time-code format, the HIL device will only parse timecode data.

Time synchronization can be achieved with a precision of 100th of a second. This means that the HIL device will decode the tens of seconds, second, minute, hour and day fields and will set the internal time clock upon detecting the valid time data in the IRIG time mode at the resolution of 10 ms.

PTP

The Precision Time Protocol (PTP) is a protocol used to synchronize clocks throughout a computer network. On a local area network, it achieves clock accuracy in the sub-microsecond range, making it suitable for measurement and control systems. PTP is described in the IEE 1588 standard.

The IEEE 1588 standards describe a hierarchical master–slave architecture for clock distribution. Under this architecture, a time distribution system consists of one or more communication media (network segments), and one or more clocks. An ordinary clock is a device with a single network connection and is either the source of (master or leader) or destination for (slave or follower) a synchronization reference. A boundary clock has multiple network connections and can accurately synchronize one network segment to another. A synchronization master is selected for each of the network segments in the system. The root timing reference is called the grandmaster. The grandmaster transmits synchronization information to the clocks residing on its network segment.

An example of a PTP network architecture is shown in Figure 1.

Figure 1. PTP network architecture [1]

IEEE 1588 includes a profile concept defining PTP operating parameters and options. Several profiles have been defined for applications including telecommunications, electric power distribution and audiovisual.

HIL devices are capable of working only as an Ordinary Clock.

Time synchronization usage

Three levels of synchronization can be defined for the HIL device:

  1. Full device synchronization

    HIL device capabilities when fully synchronized include:

    • Synchronizing the internal device clock, which helps prevent drifts over long periods of time
    • Simulation start time synchronization (the simulation will start on the second rollover, i.e. at the beginning of the next second)
    • Real time trigger timestamps for signal capture
    • Internal system time synchronization
    • Communication protocols synchronization
    Table 1. Device support and configuration
    Synchronization source HIL device Time synchronization component configuration
    PTP HIL404 and HIL606
    • Select "PTP" as the synchronization source
    • Select any available ethernet port
    • Select a preset or configure a custom PTP configuration
    IRIG-B HIL604 and HIL606
    • Select "IRIG-B" as the synchronization source
    Important: In order to achieve full system synchronization over PTP, it is necessary to use the hardware time stamping method.
  2. Internal system time synchronization

    Some applications in the Typhoon HIL toolchain use the HIL device internal system time as a synchronization source. For this reason, the internal system time of a HIL device can be synchronized using PTP, even on devices that do not support full device synchronization.

    Applications that are synchronized by the internal system device time:

    Time synchronization component configuration:

    • Select "PTP" as the synchronization source
    • Select the ethernet port 1
    • Select a preset or configure a custom PTP configuration
      Important: In order to synchronize the internal system time on a device that does not support full device synchronization, it is necessary to use the software time stamping method.
  3. Individual communication protocols synchronization

    For supported protocols, it is possible to configure individual, application-based synchronization without having full system synchronization. Instructions for each protocol are located on their respective documentation pages.

    Communication protocols that support application-based time synchronization include:

To better understand the usage of time synchronization, three cases will be described:

  • HIL working in standalone mode (without synchronization)
  • HIL connected to PC (without synchronization)
  • HIL with IRIG-B/PTP connection
Table 2. Time synchronization usage explained
HIL Configuration Description

HIL working in standalone mode

When the HIL is tuning during standalone boot, without a connection to the PC, the HIL time will start counting from January 1, 1970. All the network messages (coming from the communication protocols) will be stamped with this time value.

HIL connected to PC

When the HIL is connected to the PC, the current time is read from the PC and that time is applied to the HIL.

HIL with IRIG-B/PTP connection

When IRIG-B/PTP is connected, the exact time information is received every second and the HIL time is updated constantly, ensuring that all network messages have the correct time stamp.

Time synchronization component

The Time Synchronization component is used to configure the time synchronization on a HIL device and monitor its status.

Table 3. Time Synchronization component
Icon Dialog window Properties

Time Synchronization

  • General
    • Sync source
    • Ethernet port
    • Execution rate
  • PTP Options
    • PTP configuration
Table 4. Time Synchronization component properties
Tab Property name Description
General Sync source Choose whether to use PTP or IRIG-B as the synchronization source
Ethernet port Select the ethernet port through which the PTP signal will be received
Execution rate Signal Processing execution rate
PTP Options PTP configuration Choose between preconfigured and custom PTP configuration options. Custom options are expected to be provided as a dictionary (example). PTP is based on the Linux ptp4l library and the options can be changed according to the library specification.

On HIL604 and HIL602+ devices, it is possible to select the "both" option for the ethernet port property in the Time Synchronization component which allows for simultaneous synchronization of the internal system time through ethernet port 1 and synchronization of supported communication protocols through ethernet port 2.

Predefined IEC 61850-9-3 PTP options include:

  • measurement of the link delay is performed by peer-to-peer (Pdelay) message exchange
  • domainNumber: 0 (default), 93 (when a conflict exist with another PTP time distribution)
  • Announce interval: 1 s (fixed)
  • Sync interval: 1 s (fixed)
  • Pdelay interval: 1 s (fixed)
  • Announce receipt time-out: 3 s (fixed)
  • priority1: 255 for slave-only
  • priority2: 255 for slave-only
An example of a custom PTP configuration option is as follows:
{
"time_stamping": "hardware",
"network_transport": "L2",
"slaveOnly": "1",
"priority1": "255",
"priority2": "255",
"domainNumber": "0",
"delay_mechanism": "E2E",
"logAnnounceInterval": "0",
"logSyncInterval": "0",
"logMinPdelayReqInterval": "0",
"announceReceiptTimeout": "3"
}

The Time Synchronization component has three outputs:

  • GPS - Indicates presence of the external IRIG-B source. A value of 1 indicates that the system is actively being synchronized.
  • PTP - Indicates presence of the external PTP source. A value of 1 indicates that the system is actively being synchronized.
  • Synchronized - Indication whether the HIL device has achieved full synchronization or not. The output value will be 1 if the device was actively being synchronized by the selected external source at simulation start. If synchronization is lost at any point during the simulation, the HIL device will be considered out of sync for the remainder of the simulation, even if synchronization is reestablished.

Multi HIL Setup

In a multi HIL setup, it is only required to synchronize the master HIL device. Other HIL devices in the setup will be synchronized through the master device.

Important: Applications that use the HIL device Internal system time for time synchronization need to be mapped to the master HIL device in order to have an accurate time reference.

Virtual HIL support

Virtual HIL does not support time synchronization. When using a Virtual HIL environment (e.g. when running the model on a local computer), the configuration of the Time synchronization component will be discarded and its outputs will be zeroed.

References

  1. Industrial Ethernet Book, Safeguarding PTP Protocol with Parallel Redundancy Protocol, September 20, 2021