Add code to get the real time cycle time and latency, the maximum/minimum/average values would be printed out in the logs as a summary at the end of the OpenPLC running. The following diagram describes the logic.
"|": Beginning of execution of the PLC code
"s": Start of execution of PLC code
"e": End of execution of PLC code
Therefore, the time interval between two "|" symbols is usually 20ms by default(defined in OpenPLC Editor program), while "timeof(e) - timeof(s)" represents the cycle time and "timeof(s) - timeof(|)" represents the latency after sleep.
|_se__|s_e__|s_e__|_____|
Also a new function RecordCycletimeLatency() was added which uses special_function[4] and special_function[5] to store the cycle time and latency in the running OpenPLC cycle, so in the webpage they can be displayed if necessary.
Thanks my colleagues Alexander Lougovski, Marcelo Tosatti and Wenkang Ji a lot for the initiating, ideas and help.
Add code to get the real time cycle time and latency, the maximum/minimum/average values would be printed out in the logs as a summary at the end of the OpenPLC running. The following diagram describes the logic.
"|": Beginning of execution of the PLC code "s": Start of execution of PLC code "e": End of execution of PLC code
Therefore, the time interval between two "|" symbols is usually 20ms by default(defined in OpenPLC Editor program), while "timeof(e) - timeof(s)" represents the cycle time and "timeof(s) - timeof(|)" represents the latency after sleep.
|_se__|s_e__|s_e__|_____|
Also a new function RecordCycletimeLatency() was added which uses special_function[4] and special_function[5] to store the cycle time and latency in the running OpenPLC cycle, so in the webpage they can be displayed if necessary.
Thanks my colleagues Alexander Lougovski, Marcelo Tosatti and Wenkang Ji a lot for the initiating, ideas and help.