RevPiModIO: RuntimeWarning: cycle time of 20 ms exceeded

Moderator: RevPiModIO

Post Reply
saardrimer
Posts: 18
Joined: 15 Jun 2021, 14:16
Answers: 0

RevPiModIO: RuntimeWarning: cycle time of 20 ms exceeded

Post by saardrimer »

Hello all

On one of our two CONNECT+ systems (with MIO and DO modules connected) we occasionally get the following warning from revpimodio2:

Code: Select all

/usr/lib/python3/dist-packages/revpimodio2/helper.py:617: RuntimeWarning: cycle time of 20 ms exceeded - can not hold cycle time!
  RuntimeWarning

I'd like to investigate why this happens -- and why on only one of the systems -- but I'm not sure what the warning actually means. In plain English, does it mean something like:
I'm warning you that it took me longer than 20ms to perform the IO refresh cycle
or
I'm warning you because I'm supposed to refresh the IOs every 20ms, but it took longer than that between my invocations
or something else?

Any suggestions for where to look, what to do to debug, etc. would be welcome.

This is how I instantiate RevPiModIO:

Code: Select all

import revpimodio2
revpi_io = revpimodio2.RevPiModIO(autorefresh=True)
User avatar
RevPiModIO
KUNBUS
Posts: 322
Joined: 20 Jan 2017, 08:44
Answers: 0
Contact:

Re: RevPiModIO: RuntimeWarning: cycle time of 20 ms exceeded

Post by RevPiModIO »

Hi saardrimer!

Your cycle loop function takes to long to execute - Maybe because of a .sleep or .wait or things like that. If you are using the cyclelooop, the cycle function must return in the given cycle time.

Do you have a code example you are using?
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
saardrimer
Posts: 18
Joined: 15 Jun 2021, 14:16
Answers: 0

Re: RevPiModIO: RuntimeWarning: cycle time of 20 ms exceeded

Post by saardrimer »

RevPiModIO wrote: 11 Mar 2022, 15:17 Hi saardrimer!

Your cycle loop function takes to long to execute - Maybe because of a .sleep or .wait or things like that. If you are using the cyclelooop, the cycle function must return in the given cycle time.

Do you have a code example you are using?
Thanks for the clarification! I was careful to code in such a way that there are no idle sleeps. And, curiously, it only happens in one of the systems. I have since re-written some of the code and will see if the issue persists.
Post Reply