Timescales
- Updated2023-09-14
- 3 minute(s) read
Timescales
NI-XNET uses time for a variety of features, including timestamping of received frames, timestamping of trigger signals, waveform sampling, and timestamped transmission. Timescale refers to the concept of a clock that measures the progression of time. NI-XNET uses three distinct timescales:
- Local time is the clock on the XNET hardware product, which in some cases is used to synchronize with other National Instruments products.
- Network time is, for XNET Ethernet products, the time on the network of your ECUs, such as when IEEE Std 802.1AS is used to synchronize time among ECUs.
- Host time is the clock of the operating system where LabVIEW is running (e.g., Windows or Linux).
Local Time
An XNET PXI product, by default, uses the PXI backplane clock (PXI_Clk10, PXI_Clk100), for synchronization with other products in the PXI chassis. If the PXI backplane clock is not available (e.g., turned off), the product uses its local oscillator.
An XNET PCI or USB product, by default, uses its local oscillator, and trigger signals can be used to achieve synchronization.
An XNET C Series module, by default, uses the time provided by the C Series chassis. If time is not available from the C Series chassis, the XNET C Series module uses its local oscillator.
For some XNET products, the default source of local time can be changed with XNET Connect Terminals and/or terminal properties. With XNET Connect Terminals, use the destination terminal of the Master Timebase to change the local clock.
Most clocks that are used for local time provide frequency (with an oscillator), but not date/time information. When a session is created, XNET initializes the date/time information for the local clock using host time.
In DAQmx terminology, XNET local time is analogous to DAQmx I/O device time.
Network Time
Many in-vehicle Ethernet networks use a protocol such as IEEE Std 802.1AS to synchronize time among ECUs. XNET Ethernet products participate in the time synchronization protocol in the ECU network. This network time is used to timestamp received Ethernet frames (in addition to the timestamp from the local time).
When an XNET Ethernet port acts as the grandmaster in the ECU network (i.e., Port State is Master), local time is used for the grandmaster clock, and date/time information in the ECU network is initialized from host time.
When an XNET Ethernet port acts as a slave in the ECU network, local time and network time will eventually drift relative to one another. The date/time information for network time is obtained from the ECU that acts as the grandmaster.
Host Time
Most computers and controllers maintain date/time information for the timescale provided by the operating system. This host time can obtain the date/time using a Real Time Clock (RTC), or a Network Time Protocol (NTP) server. Many implementations of host time are traceable to a global timescale, such as Coordinated Universal Time (UTC) and International Atomic Time (TAI).
Although host time provides accurate date/time information, the accuracy and resolution of its clock can often be in tens of milliseconds. In contrast, the XNET hardware for local time and network time provides resolution in nanoseconds. Although local time and network time use host time to initialize their date/time information, local and network times do not use the same physical clock as host time. Therefore, both local time and network time will eventually drift relative to host time.
Many National Instruments products initialize their date/time information from host time as described above. This initialization occurs at the moment that the hardware is initialized. Because each hardware product initializes at a different moment, the date/time information for each local clock might not be identical for a given point in time. For example, if you connect a shared start trigger to two DAQmx PXI cards and two XNET PXI cards, each of the four cards might report a slightly different timestamp for the pulse of that start trigger (e.g., t0 in a waveform). The cards are tightly synchronized in reality, but the differing timestamps give the appearance of inaccuracy. This issue can be corrected using techniques such as the LabVIEW Align Waveform Timestamps VI and NI-XNET Adjust Local Time property.