i know questions about this warning are asked a lot, and I read a lot about them but have no answer yet to my specific case.
I use Revpi Core 3 with 4 MIO Modules to get 30 1-10 V Analog Inputs.
I want to achive a frequency of 100 Hz => a cycletime of 10 ms in my thread that reads the inputs. (I read that 8 ms can be possible with the Hardware.)
For that I use the cycleloop method as follows. I tried too keep the called function very short to not waste any time and do the further processing of the values in a different thread.
Code: Select all
#...
q = queue.Queue(maxsize)
def measure(revpi=0):
measures = [datetime.now(timezone.utc)] # first column is time
for inputName in inputNames:
measures.append(
# The analog inputs are sampled with 15-bit resolution and are available in the process image as a millivolt value (0 to 10000).
revpi.io[inputName]
)
q.put(measures, block=False)
return
revpi = revpimodio2.RevPiModIO(autorefresh=True)
# start thread to listen to "Prozessabbild" managed by revpimodio2 library
revpi.cycleloop(measure, cycletime=int(10), blocking=False)
# do other things...
When the cycletime is exceeded is the function interrupted? Or if not, is the next call of the function started in a parallel thread? (i guess it is interrupted because it does not work with shorter cycletimes than 50 ms)
As my function "measure" is so short all of the time that leads to the warning/error is needed for building the prozessabbild?
Do i have to change the autorefresh parameter? Or what can i do to speed things up?
Thank you for your help,
smn