CODESYS Virtual Safe Time Provider
The CODESYS Virtual Safe Time Provider is a standard interface which the user can use to transfer a second and external time base to the CODESYS Virtual Safe Control.
The implementation is done as a client, which must run on another system with an independent time base.
Installation
The CODESYS Virtual Safe Time Provider SL is installed via the CODESYS Control SL Deploy Tool. For more information, see: "The Safe House" Scenario: vPLC + vSafe + ProfiSafe + Time Provider + License Server.
Important
The CODESYS Virtual Safe Time Provider SL must not run on the same host as the CODESYS Virtual Safe Control SL.
Functionality
The Time Provider serves as a second time source for the CODESYS Virtual Safe Control SL and sends a timestamp as a message via the network at a defined interval.
This message can then be received and evaluated by various receivers (CODESYS Virtual Safe Controll SL, redundant Time Provider).
The CODESYS Virtual Safe Control SL runs the application with a defined cycle time where at least one timestamp from an external timer must arrive.
Important
The sending interval of the Time Provider should be configured to be less than half the cycle time of the application.

To increase the stability due to network or scheduling problems of the Time Provider and thus the CODESYS Virtual Safe Control SL, the Time Provider can be executed redundantly.
A distinction is made between two types.
Time Provider redundancy
In the case of Time Provider redundancy, two Time Provider instances run on two independent hosts. One instance acts as an active sender and the other instance passively monitors the sending of the timestamps.
As soon as the sending of the timestamp of the active instance is delayed or does not take place, the passive instance immediately takes over the sending with the last known offset of the active instance. This means that there are no failures of CODESYS Virtual Safe Control SL. It is important that both instances run on the same network. Only then can the passive instance monitor the messages sent by the active instance.

Important
If an active Time Provider in a network detects another active instance on the bus, then the instance with the highest priority IP address remains active and all other instances go into passive mode.
Network redundancy
In the case of network redundancy, the Time Provider instances each use their own network, in contrast to Time Provider redundancy. Nevertheless, it is necessary for the passive Time Provider instance to receive the messages from the active instance in order to take over sending in the event of a delay or failure.

Important
Network redundancy has not yet been implemented.
Configuration
Option | Description | Default Value |
---|---|---|
| Target IP address | 127.0.0.1 (localhost) |
| Target port | 60000 |
| Sending interval of the Time Provider timestamp in [ms] | 3 |
| SCHED_FIFO scheduling priority | 55 |
| CPU pinning All threads are pinned to a defined CPU, starting with the value 0. | 0 |
| Redundancy mode | Disabled |
| Logging of the | Disabled |
| Diagnosis interval in [s] | 60 |
Important
The default value of the IP address is 127.0.0.1 (localhost). You should use this value only for commissioning and testing. The Time Provider provides an independent time base and must therefore not be operated locally. If you use the default value, then Time Provider issues a warning.
Diagnosis
The errors which can occur when evaluating the timestamps on the page of the CODESYS Virtual Safe Control SL:
The configured port is already in use.
If the configured port is already in use and cannot be opened, then the following message is issued:
Could not open port <Port number> it is already in use!
Sending the timestamp in the active instance is delayed or does not take place.
If a timestamp of the active sender is delayed or is not sent and a passive Time Provider instance takes over sending, then the following diagnostic message is issued:
Started sending: take over from higher priority time provider <priority>
When the higher-priority Time Provider instance is available again and takes over sending from the former passive instance, the following message is issued:
Stopped sending: higher priority time provider is active: <priority>
Cyclical statistics on the timestamps (active instance/sender)
The statistics for the timestamps sent are issued at the configured interval (
-stat_print_time
option) in the resolution of microseconds [us]. The minimum and maximum sending interval is issued, as well as an average value over the configured period:Statistics: min: <minimum sending interval>, max: <maximum sending interval>, avg: <average sending interval> - send time interval
Cyclical statistics on the timestamps (passive instance/receiver)
Because the passive instance receives the timestamps sent by the active instance, the information received can be evaluated for diagnostic purposes.
The statistics are issued at the configured interval (
-stat_print_time
option) in the resolution of microseconds [us] as well as percentages [%]. The minimum and maximum interval is issued, as well as an average value over the configured period:Statistics: min: <minimum deviation>, max: <maximum deviation>, avg: <average deviation> - remote to sample time deviation
Statistics: min: <minimum sample interval>, max: <maximum sample interval>, avg: <average sample interval> - sample time interval
Statistics: min: <minimum remote interval>, max: <maximum remote interval>, avg: <average remote interval> - remote time interval
Counter for lost messages
If a timestamp is not sent by the active instance, then a counter is incremented and output:
Statistics: lost messages: <number of lost messages>