1

I'm fresher level person in influxDB and I strongly believe that this query is little hard to me. So before starting my question, first I'm showing my snippets

Measurement: Power

time                id level wp1  wp2  wp3
----                -- ----- ---  ---  ---
1674012918143941800 1  0.2   0    0    0
1674012946442606600 1  0.3   0    0    0
1674012956373793000 1  0.4   0    0    0
1674012960513270300 1  0.5   0    0    0
1674012964636921000 1  0.6   0    0    0
1674012969387566800 1  0.7   0    0    0
1674012975236928500 1  0.8   0    0    0
1674012979176158400 1  0.9   0    0    0
1674012985735524600 1  1     0    0    0
1674013002642438500 1  1.1   0.9  0    0
1674013014405825000 1  1.2   17.3 0    0
1674013024368173700 1  1.2   17.2 0    0
1674013030284261700 1  1.1   17.5 0    0
1674013035202912500 1  1     17.5 0    0
1674013048221657300 1  0.9   17.1 0    0
1674013055478454000 1  0.8   17.7 0    0
1674013063071284300 1  0.7   17.9 0    0
1674013071595783200 1  0.6   17.5 0    0
1674013121251525800 1  0.5   17.4 0    0
1674013149886737100 1  0.4   0.4  0    0
1674013162976838600 1  0.5   0    0    0
1674013171731741300 1  0.6   0    0    0
1674013175329837000 1  0.7   0    0    0
1674013179396594100 1  0.8   0    0    0
1674013185464567200 1  0.9   0    0    0
1674013202283232100 1  1     0    6.2  0
1674013215395312900 1  1.1   0    22.3 0
1674013222458146000 1  1.1   0    22.1 0
1674013242581765500 1  1     0    22.6 0
1674013249941544200 1  0.9   0    22.6 0
1674013257400012100 1  0.8   0    22.3 0
1674013263325355200 1  0.7   0    22.5 0
1674013269931344900 1  0.6   0    22.2 0
1674013287223505700 1  0.5   0    22   0
1674013296618633300 1  0.4   0    0.2  0
1674013306827048400 1  0.4   0    0    0

If you see the row 1674013002642438500 has wp1 is 0.9 which is greater than 0.5 and this wp1 value consistent by time and fall down at 1674013149886737100 row with value 0.4 which is less than 0.5 and in between of both time, if we find mid row then we'll get this row 1674013048221657300 1 0.9 17.1 0 0 So here we can call this start, stop and mid as a cycle.

And this kind of multiple cycle we can got in a day. And I wanna fetch the rows.

So if I search cycles for wp1 then the result data will be:

time                id level wp1  wp2  wp3
----                -- ----- ---  ---  ---
1674013002642438500 1  1.1   0.9  0    0
1674013048221657300 1  0.9   17.1 0    0
1674013149886737100 1  0.4   0.4  0    0

And same if we search based on wp2 then the retrieve data should be:

time                id level wp1  wp2  wp3
----                -- ----- ---  ---  ---
1674013202283232100 1  1     0    6.2  0
1674013249941544200 1  0.9   0    22.6 0
1674013296618633300 1  0.4   0    0.2  0

And if the search condition based on both wp1 & wp2 then result will be:

time                id level wp1  wp2  wp3
----                -- ----- ---  ---  ---
1674013002642438500 1  1.1   0.9  0    0
1674013048221657300 1  0.9   17.1 0    0
1674013149886737100 1  0.4   0.4  0    0
1674013202283232100 1  1     0    6.2  0
1674013249941544200 1  0.9   0    22.6 0
1674013296618633300 1  0.4   0    0.2  0

Could you please help me with this? I'll be so thankful to you.

Md Enayat
  • 147
  • 1
  • 12

0 Answers0