Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
PBRM
Contributor II
Contributor II

monitor compressor on/off times

Hi all,

I want to do something with ioT and connected my air compressor to some sensors.  Now I want to monitor the time the compressor is on (and off) and if there is any change over time. I have  data like:

time                                compressor    airpressure

26-09-2020 12:00       True                   6.0

26-09-2020 12:02                                    6.7

26-09-2020 12:05                                    7.2

26-09-2020 12:06                                     7.8

26-09-2020 12:08       False                   8.0

26-09-2020  12:10                                    6.5

26-09-2020  12:13      True                     6.1

and so on..

Any hints how I can determine the time between a True and False statement  ?

Regards,

PBRM

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try something like this. 

Load time, compressor, airpressure, if(compressor='True', time, peek('time')) as TmpStartTim, 

If(compressor ='True', 0, time-peek('TmpStartTime' )) as Duration 

From DataSource ;

Drop field TmpStartTime;

View solution in original post

2 Replies
Vegar
MVP
MVP

Try something like this. 

Load time, compressor, airpressure, if(compressor='True', time, peek('time')) as TmpStartTim, 

If(compressor ='True', 0, time-peek('TmpStartTime' )) as Duration 

From DataSource ;

Drop field TmpStartTime;

PBRM
Contributor II
Contributor II
Author

Hi Vegar, thanks for the tip!. The script with the temporary field 'TmpStartTime' and 'time-peek(..' did the job. Thanks!