YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

PI Calculation or Dataset help needed Options · View
zaphodalive
#1 Posted : Wednesday, August 11, 2010 1:56:29 AM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 3
Location: Wellington, New Zealand
Hi

I've just started working with PI Processbook and programming an interface with VBA, but I'm not sure how to tackle a certain functionality I'm after so any help would be greatly appreciated.

Basically I have a drop-down box which specifies the timeframe on a Trend, e.g. 1 day, 1 week, 1 month, etc., and a date picker for the date reference. What I would like is to have another drop-down box which specifies how the data is displayed, with options such as Daily Average, Daily Sum, Weekly Average, Weekly Sum, All Periods, etc.

An example is a Trend that spans a week, and the trace shows the average in daily blocks rather than averaging the entire week - it would end up looking something like a bar graph. I can create a PI Calculation Dataset to average the entire week, but I'm not sure how to get each day averaging separately over a week.

Any ideas how I would approach this?

Thanks for your time.

Eamonn
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
zaphodalive
#2 Posted : Wednesday, August 11, 2010 2:02:09 AM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 3
Location: Wellington, New Zealand
Just realised I put this in the wrong section... feel free to move to the Need a little help? section. Thanks.
RJK Solutions
#3 Posted : Wednesday, August 11, 2010 4:23:53 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Eamonn,

Welcome to the forum.

Try the following:
- Create a PI Calculation and set the expression to be your PI tag.
- Set the interval to be "1d".
- Set the sync time to be 00:00:00 (unless you want to average from a different time, e.g. start of shift).
- Make sure "Stepped" is selected.
- Add a Trend to your display.
- Set the trend end time to *-7day.
- Add your PI tag as a trace.
- Add you PI calculation as a trace but select the "Average" column.

You will see your daily averages over the period of 1 week. Hope this is what you required.

Then if you want to manipulate the average period and trend time range then you would use VBA to manipulate the dataset. e.g. for the average interval, just change the dataset interval (example, 1d to 1h) and to change the trend then change the start/end time (example, *-7d to *-1d). Following the example, your VBA would change the trend from showing daily averages over a week to hourly averages over a day.

You need to look at GetDataset, SetDataset in VBA for manipulating the PI Calculations based on your drop downs.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
zaphodalive
#4 Posted : Thursday, August 12, 2010 5:26:47 AM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 3
Location: Wellington, New Zealand
Hi

That's great, I thought I had tried that originally but I had used Value instead of Average and was wondering why the lines were so inaccurate... a silly mistake, it does in fact work perfectly.

Thanks very much for your help.

Eamonn
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.