Greetings all,
I have a data point which is cyclic and more or less repeats every 24hrs. I would like to compare it on a 24hr basis to other points in time.
The way I have the current trend set up it starts/ends at midnight of the current day showing live data for that day. ('T' and 'T+1d')
I then created a data set for the previous day using the following equasion
TagVal('sinusoid','*-1d')
I added the data set to the trend and so far, so good.
Next, I'm wanting to add a trend showing the 24hr period that achieved the maximum value over the last week/month/etc. and this is where I'm stuck.
I've been able to obtain what the max value is by using TagMax.
I've also been able to determine when it occured by nesting TagMax inside of FindEq. (btw... is there some way of referencing a dataset value in the equasion for another data set?)
I've also determined how many days ago the event occured doing some time stamp math ('T' - max value time, devide by 86400, then truncate and finally add 1 day)
Thinking I had it in the bag, I figured I could take the number of days to the max event and substitute that equasion back up into the same equasion I used for the previous days data set. Unfortunately... It's not working.
When I try to change the '*-1d' portion of the equasion to something like
parsetime(text("*-", my formula here ,"d"))
I end up getting a flat line! I thought my formula was causing the issue so I tried the following instead to see if I could get aything different...
parsetime(text("*-", "2d"))
But... I still get a flat line! From what I can derive, it is doing a calculation of what the value is at the instant the equasion tries to update and then substitutes that value for all the times for that day. Rather odd. So, then I tried changing it to read as follows...
'* parsetime(text("-2", "d"))'
But then it doesn't recognize the -2d portion and only graphs todays values.
I'm sure I'm making this harder than it needs to be, so any help would be apreciated. I would like to solve this in the data set equasions rather than doing it in VBA. I have VBA experience using Excel; but, I've never used it with PI ProcessBook. If it can only be done with VBA, please also point me to a good PI VBA reference source as I've yet to find anything that is decent.
Many thanks in advance,
-C