I was wondering what the limits are for the python programs running (using RevPiModIO) on the RevPi for pure measuring purposes (sensor values from the AIO)
I want to measure a 4..20 mA signal at a e.g. freq. of 100Hz. Currently (this was before I saw the concept of cycleloop) I've tried this with a manual loop (see part of script below). But this causes regularly crashes, without knowing the issues.
Also in a next step I want to write this data to a (binary) file to transfer it to the cloud. So I was wondering if you have examples or best practises for doing exactly this:
- simply measuring AIO values (4..20mA, 0-10V, RTD, ...)
- frequencies up to 100Hz --> limit??
- writing this data to file and upload files (-> too load intensive for RevPi??)
Thanks a lot,
Code: Select all
IO_LIST = ['InputValue_1','InputValue_2','InputValue_4']
perf_time_next = now + 1
number_of_samples = 60*100 # 1 minute at 100Hz
sample_count = 0
rawdata = []
polling_time = 0.010 # 10 ms -> 100Hz
while sample_count < total_number_of_samples:
# Wait until next planned sample point start time
while perf_time_next > time.perf_counter():
pass
perf_time_next += polling_time # seconds
# ---------------------------------
# Sample
values = []
for input_name in IO_LIST:
values.append(float(revpi.io[input_name].value))
sample_count += 1
rawdata.append(values)