07-13-2018 09:27 AM
I'm using a while loop to run my ethercat input and output, and the ethercat cycle time is set at 10 ms. To my great surprise, I measured and found that the loop was taking 30 – 40 ms to complete. Not only that, but as the program runs for minute or so, that time gradually rises to 70 – 80 ms. Doesn't matter whether it is busy or idle (steady in state 20). I looked in vain for any likely cause: an array that is steadily increasing, resources continually being taken up. Could find none.
Questions: 1. Where are some likely places to look for such slowness? Apart from the reading and writing of the ethercat data itself, the main thing going on is the displaying a handful of status items from that data as Boolean and Numeric indicators. Is this time-consuming?
2. Where some likely places to look for steadily increasing loop times?
(The main loop VI and its main subroutine, the state machine, are attached. It is impossible to attach all the dependencies, most of which come from the commercially available ethercat library from ackermann-automation.de)
Thanks,
Ken
07-13-2018 10:32 PM
Hello Ken,
Looking at the attached VIs, I feel like too many stuffs were put into a single VI. It's hard for others to tell why the slowness happens. I would recommend you use RT Trace Viewer to go on your investigating: http://zone.ni.com/reference/en-XX/help/370715P-01/lvtracehelp/lv_tracetoolkit_help/
Generally speaking, while loop in a normal priority VI would be possible to be interrupted by other high priority tasks. You can replace the while loop with timed loop to make the loop time more accurate. Or you can split the while loop to a sub VI and assign high priority to this sub VI.