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

Modifying Trend data in Processbook Options · View
ShellAnalyst
#1 Posted : Wednesday, August 11, 2010 10:34:41 PM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 6
Location: Calgary, Canada
Hello!

I am a new PI user and am not very familiar with Processbook or VBA but I think my problem is very simple. I just need to change the data in a processbook trend (basically a unit conversion). After reading these forums it seems that I'll need to manipulate the dataset with VBA but I was just wondering if there's an easier way to do this?
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.
RJK Solutions
#2 Posted : Thursday, August 12, 2010 9:43:24 AM
Rank: Administration

Groups: Administration

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

Welcome to the forum.

The easiest way for unit conversions would be to use the AF dataset in ProcessBook but this is no good if you don't have AF.

You can perform the conversion within a Dataset or create a performance equation tag to store the converted values. It depends if you would need the converted value elsewhere in different displays, spreadsheet etc then use a PE tag otherwise a dataset will do the job.

Principal Consultant
Real-Time Data Management @ Wipro Technologies
ShellAnalyst
#3 Posted : Thursday, August 12, 2010 3:32:12 PM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 6
Location: Calgary, Canada
I am trying to go the Dataset route but I keep getting errors in my code.

Code:

Sub test()

    Dim MyDataset As PIExpressionDataset

    Set MyDataset = MyDatasets.Add("ConvertedValues", Nothing, True, 1, True, pbDatasetPIExpression)

    Set MyDataset = MyDatasets.GetDataset("ConvertedValues")
   
    MyDataset.ServerName = "scpitest"
    MyDataset.Expression = ThisDisplay.Datasets.Expression * 1000
    MyDataset.RefreshInterval = 3600
    MyDataset.ColumnName = "Value"
    MyDataset.Interval = "10m"
   
    ThisDisplay.Datasets.SetDataset MyDataset


End Sub


I am just trying a test for now but it keeps telling me that an object is required.
RJK Solutions
#4 Posted : Thursday, August 12, 2010 7:55:09 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
It looks like this line in your code is incorrect:

Code:

MyDataset.Expression = ThisDisplay.Datasets.Expression * 1000


ThisDisplay.DataSets is a collection thus doesn't have an expression property. Maybe you meant to refer to a specific Dataset from the collection or a PI Point?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
vic3151
#5 Posted : Thursday, August 12, 2010 8:41:22 PM
Rank: Newbie
Groups: Member

Joined: 8/12/2010
Posts: 1
Location: Texas, USA
Forget about VBA there's a much easier way of doing this. Click on the hammer, then double click the trend. Then click the down arrow next to the Tag Search... button. If you see an option called PI Calculation click on that. Then hit the New button in the top left corner. Now in the Definition section choose your server from the drop down menu and then where it says Tag or Expression enter your tag and the formula for the unit conversion so for example you'd put 'MY_TAG'*1.8+36 or something like that. Then choose an interval and click okay and you're done! Just make sure your column label is set to Value. You'll now have two trend lines, your original units and the converted units. Hope this helps!
ShellAnalyst
#6 Posted : Tuesday, August 17, 2010 4:16:03 PM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 6
Location: Calgary, Canada
Thanks for the suggestions. I am afraid that your method vic3151 won't work for me since I need to be able to change the data dynamicaly depending on which display is shown. I was able to fix up my code though and it now runs fine and I can create the new dataset. I just need a way now of showing the data in my trend. I tried Trend1.AddTrend but that only lets you add a string and not a dataset. Any ideas?
RJK Solutions
#7 Posted : Tuesday, August 17, 2010 4:28:17 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
You just need to form the string as "DatasetName.Column", e.g. "MyDataset.Value" or "MyDataset.Average", so:

Code:
MyTrend.AddTrace "MyDataset.Value"
Principal Consultant
Real-Time Data Management @ Wipro Technologies
ShellAnalyst
#8 Posted : Wednesday, August 18, 2010 5:51:17 PM
Rank: Newbie
Groups: Member

Joined: 8/11/2010
Posts: 6
Location: Calgary, Canada
Got it working. Thanks for all your help!
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.