How can I create a Tag that averages every 24 hours from 8am the previous day to 8am today.
That averages what? Line speed? Cycles per hour?
There probably are ways to it but sounds like you really should be considering using a database and recording the count on the hour and then it's a simple SQL query to return the values any way you like, for any day, week, month or year you like. It will be more reliable and much more useful.
it averages a flowrate per day tag
I already have a an event based Tag named oil_flowrate_bpd but will want to calculate the 8am to 8am (24hours) of the same tag and write it into another tag and store the output as a history tag. So i need the script to do that.
I already have a an event based Tag named oil_flowrate_bpd ...
What happens if there is no event for a couple of hours either side of 08:00? You won't have a count value to calculate from. You might need a scheduled record.
... but will want to calculate the 8am to 8am (24hours) of the same tag and write it into another tag and store the output as a history tag.
If oil_flowrate_bpd
is a counter then just store the counter value every hour in a custom database. The Historian isn't the right tool for the job. There's no need for extra tags. The count for any day can be retrieved using either a Query Binding or using a Named Query.
Ok. kindly assist me with creating a scheduled record.
You've some study to do.
You'll need some basic familiarity with SQL.
"Rate" and "counter" are contradictions. If it really is an analog rate, then it needs to be historized with fine granularity, and the historian queried for the time periods to average. Using the historian every 8am to compute the past 24hour average is the right approach. The result should then be stored in a dedicated table, not in another historized tag.
I know. I know. We were in trouble from the first post.