BookmarkSubscribeSubscribe to RSS Feed
Kevin

Occasional Contributor

Joined:

Jun 28, 2018

calculate value based on certain time interval

Hello,

 

I need to calculate the average temperature in a cycle of 30s, and my temperature log is taking one reading every 15 sec. I recorded cycle end time, and I would like to write script to calculate the average  temperature during 30s prior to the cycle end time.

TimeCycle End TimeTemperature
6/26/2018 13:45:006/26/2018 13:4622.32
6/26/2018 13:45:156/26/2018 13:4622.52
6/26/2018 13:45:306/26/2018 13:4622.62
6/26/2018 13:45:456/26/2018 13:4622.55
6/26/2018 13:46:006/26/2018 13:4622.41
6/26/2018 13:46:156/26/2018 13:4822.32
6/26/2018 13:46:306/26/2018 13:4822.18
6/26/2018 13:46:456/26/2018 13:4822.54
6/26/2018 13:47:006/26/2018 13:4822.51
6/26/2018 13:47:156/26/2018 13:4822.46
6/26/2018 13:47:306/26/2018 13:4822.35
6/26/2018 13:47:456/26/2018 13:4822.28
6/26/2018 13:48:006/26/2018 13:4822.51

 

The final table I would like is :

TimeCycle End TimeTemperatureAverage Temperature in Cycle
6/26/2018 13:45:006/26/2018 13:4622.3222.585
6/26/2018 13:45:156/26/2018 13:4622.5222.585
6/26/2018 13:45:306/26/2018 13:4622.6222.585
6/26/2018 13:45:456/26/2018 13:4622.5522.585
6/26/2018 13:46:006/26/2018 13:4622.4122.585
6/26/2018 13:46:156/26/2018 13:4822.3222.38
6/26/2018 13:46:306/26/2018 13:4822.1822.38
6/26/2018 13:46:456/26/2018 13:4822.5422.38
6/26/2018 13:47:006/26/2018 13:4822.5122.38
6/26/2018 13:47:156/26/2018 13:4822.4622.38
6/26/2018 13:47:306/26/2018 13:4822.3522.38
6/26/2018 13:47:456/26/2018 13:4822.2822.38
6/26/2018 13:48:006/26/2018 13:4822.5122.38

Does anyone know how to do that?

2 REPLIES
dale_lehman

Community Trekker

Joined:

Jan 29, 2015

Re: calculate value based on certain time interval

This isn't right, but I think you can get there by modifying the formulas I used in this table.  I also think your example doesn't match what you are asking for.  The averages you show in what you desire appear to be for all time readings within a minute of the cycle end time, not 30 seconds.  Sorry, I don't script, but you can easily get the script from my attached table - but first, you'll need to modify the formulas to get exactly what you want.

Highlighted
Kevin

Occasional Contributor

Joined:

Jun 28, 2018

Re: calculate value based on certain time interval

cycle is 30 sec, for example, at 1:46pm, that's the end of cycle, so cycle start at 1:45:30pm, and same for cycle end time 1:48pm, the start time is 1:47:30pm, so any time between 1:46:00pm and  1:47:30, there is no cycle or no critical operation, which I don't need to average temperature at those time peroid.