I’m working with sensor data to calculate cycle times for an assembly process. For a given station, the cycle time starts and ends with given sensor readings, with one or more intermediate steps taken. I am currently querying data from influxdb using the python client and calculating the cycle times using pandas using a combination of for loops and if conditions.
I am working to port this work to flux, so that cycle time data can be displayed in a histogram on dashboard. Any thoughts on how I can incorporate this workflow? The sticking point for me is including multiple rows within a map function. Ultimately I will likely use this as influx task to push cycle times to a new bucket.
Psuedocode below- In this example cycles start at sensor 1 and end at sensor 4 and must pass through 2 and 3 between.
cycletimes = new list
sensordata = data from query
for rows in sensordata:
if sensordata.row.property = sensor1:
starttime = sensordata.row.time
while sensordata.row.property != sensor2:
while sensordata.row.property != sensor3:
while sensordata.row.property != sensor 4:
endtime = sensordata.row.time