Questions about the RTC

Hi, I’m working on a project that measures a time interval between some events. I’m using TCP/IP to get the data from a PLcnext to a Siemens PLC via the function blocks in the PLCnext Engineer, also in C# and C++ code. I’m using the RTC to know when I start the proces of connecting the 2 PLC’s, when the connection is made and when the data transfer is done. Those times are measured with the RTC. The questions are:

                                             * How accurate is the RTC in the PLCnext engineer?
                                             * Are the C# and C++ the same RTC as the PLCnext?
                                             * If not, what is the accurarancy in the C# and C++ code?

Greetings,
Arne

Hi Arne, PLCnext Engineer projects uses the Linux system clock. I am not sure what you mean by “accurate”? I guess that you are not concerned with the absolute time, but probably the delta between the events you are measuring. In that case the deltas should be good - the C# DateTime.Now property uses the same clock as the IEC code, and depending on how you write your C++ code, it probably also uses the Linux system clock. Remember that all code executed by the ESM - including IEC code, C# functions and function blocks, and C++ programs - executes in ESM tasks. If this is a cyclic task, then the smallest delta you will measure (for events that do not happen in the same scan cycle) is the period of the task, e.g. 100 ms for a 100 ms task. This is probably much larger than any inaccuracy in the system clock. ~ Martin.