Join us today!
Measuring the scan cycle of PLC
Write a PLC program to measure the scan cycle (scans per second) of PLC continuosly. Share your solution along with your PLC scan cycle settings and the measured scan cycle value.
Happy coding! 😊
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols are you looking to read the Task Cycle time, for example, from PlcTaskSystemInfo.CycleTime or are you looking to see how long your task took to execute PlcTaskSystemInfo.LastExecTime?
I guess that scans per second would always be consistent with the CycleTime, unless you are seeing PlcTaskSystemInfo.CycleTimeExceeded. In which case you could recalculate your scans / second accordingly. I'd advise against allowing your task to exceed. Rather to increase the Task time to accommodate the actual time required, or move some lower priority code to a slower task.
My blog: codingbytes
My code: https://github.com/benhar-dev
@benhar-dev It is actually a simple challenge question to calculate how many cycle it takes a plc task in a second. For example, the plc task cycle time below is set to 10ms, therefore it will be executed 100 times in one second.
Thank you for mentioning the PlcTaskSystemInfo type. I make use of it in my programs sometimes.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
I do it in the following way:
https://github.com/runtimevic
https://github.com/TcMotion
https://www.youtube.com/playlist?list=PLEfi_hUmmSjFpfdJ6yw3B9yj7dWHYkHmQ
https://github.com/VisualPLC
@runtimevictor Thank you for sharing your solution! Could you also share your program output and the screenshot of PlcTask settings page?
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
Hi All,
Not sure if this is helpful, but I also like to measure the PLC code execution itself, the task related times encapsulate all the task related operations, like process data mapping updates for example, you can see more info in the TE1010 docus on infosys.
But to monitor execution times i use the Profiler block, call it before and after a code section to see how long it really took.
-
Array Comparison
2 years ago
-
Momentary Push Button and LED - Programming Challenge
2 years ago
-
Traffic Simulation
2 years ago
-
Adjustable Flowing LEDs - PLC Programming Challenge
2 years ago
-
Custom Flash Timer
2 years ago
- 17 Forums
- 267 Topics
- 942 Posts
- 3 Online
- 722 Members