Technical introduction
TwinCAT offers different interfaces for the external time provider and the external time consumer in order to utilize the concept of corrected timestamps.
On the external time consumer side, different TwinCAT components are able to use the external timestamp. In addition, there are different access options for applications.
On the external time provider side, modules are provided that can calculate and provide an offset via NTP. In addition, there is a module that can use the offset via DC. The corresponding interface for providing the offset is also offered for TwinCAT C++, so that customers can create their own external time providers.
Timestamps for different use cases
It should be noted that TwinCAT differentiates between four types of timestamps in this concept:
- None: Local system time and no correction
- Soft: Recommended use e.g. for NTP
- Medium: Recommended use e.g. for IEEE1588
- Hard: Recommended use e.g. for hardware synchronization where no drift should occur
An external time provider provides one of the possible offsets; only one provider can be defined for each type.
An external time consumer can then use any offset; all four offset types can be used as required. Thus it is possible to use different timestamps in different ensembles or operation modes. For example, a local diagnosis can take place with the local system time, while at the same time aggregated data from different systems can be corrected with the offset type Soft and stored in a common database.
The interfaces of the corrected timestamps use data types with a length of 8 bytes and are counted from 1.1.1601 in 100 ns steps.