
Re: Processbook Nested If Time Calculation
mtippett Feb 8, 2018 5:54 AM (in response to TuiBray)1 of 1 people found this helpfulHi Tui,
I think you are talking about doing this in Processbook datasets, is that correct? Assuming you are, here is a sample dataset configuration for the tag 'sinusoid'
100 * (TimeLT('sinusoid','1Jan','*',50)  TimeLE('sinusoid','1Jan','*',0)) / ( DaySec('*') + (Yearday('*')1)*86400 )
To break this down, a bit:
TimeLT('sinusoid','1Jan','*',50)  returns the number of seconds that the tag sinusoid is less than 50 over the time period 1Jan of current year to execution time
TimeLE('sinusoid','1Jan','*',0)  returns the number of seconds that the tag sinusoid is less than or equal to 0 over the time period 1Jan of current year to execution time
DaySec('*')  returns the number of elapsed seconds in the current day
Yearday('*')  returns the number of the current day, i.e. 1 for 1Jan, 32 for 1Feb etc.
The numerator of the equation above finds the number of seconds sinusoid was less than 50 and greater than 0 (multiplied by 100 get get a percentage), and the denominator finds the number of elapsed seconds the current year. The result is below, as expected the percentage varies a a lot initially and settles out at just below 50%.
Note that this method doesn't take daylight savings into account, so there will be some errors in the calculation, though it might need someone smarter than me to work that issues out.

Re: Processbook Nested If Time Calculation
TuiBray Feb 8, 2018 8:43 PM (in response to mtippett)Thanks Michael. You are correct, I was doing this in Processbooks datasets and that worked perfectly. Thanks so much for your help.
