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

2 Pages 12>
Drawing lines on a trend Options · View
kapilrakh
#1 Posted : Friday, December 18, 2009 8:13:50 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Hi there,

This one is tricky. I have a trend in the excel sheet and is plotted with given start and end time. Lets assume it to be last 24 hours. (*-24hr & *)

The user now specifies start and end time which lie in between of the above start and end time. Lets assume it to be last 20 hours TO last 4 hours (*-20hr and *-4hr)

The problem is to draw two vertical lines on the trend at the time given by the user.

I don't know if it is possible at all in PI. I faced such problem before. To solve that I created a temporary tag in PI.

To plot the vertical lines, I would simply write that data to the temporary tag and draw the lines and delete the data before closing the application.

Is there any better solution. I can not create a tag on this system.


Reply

Kapil.

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.
Michael
#2 Posted : Friday, December 18, 2009 8:34:39 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Kapil

to be clear : You added a tag to the system to display a VERTICAL line? What data you added to this tag?


(please see also my last reply on the last topic)

Michael
kapilrakh
#3 Posted : Friday, December 18, 2009 8:48:17 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Michael,


We have to draw two lines. Lets focus drawing the first line first.

At the given time (*-20Hr) , I would get the value of the sinusoid. Now next thing is to draw a vertical line at that point.

Since you can't store more than one value at that point of time, you'll store values at + and - 1 seconds ; + and - 10 units.

It will essentially look like a vertical line. For example if the value at sinusoid is 30. I would assign our tag value of 20 and 40 at 1 second before and after.

Here you'll need two such temporary tags.

But the point is , you are doing this hard way. Plus the temporary tag will appear in the legends. You can't help it though because PI is built only for tags.
RJK Solutions
#4 Posted : Friday, December 18, 2009 9:04:28 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hey guys,

Kapil, are you restricted to Datalink? Within ProcessBook you have Datasets to expand how you collect and display data.
Within Datalink you don't have to just get data from PI tags, you can get data from a worksheet so long as you provide time, value inputs.

Curious, what do the vertical lines signify?

EDIT: Have you got a screenshot using your additional tags, easier to see what you are trying to achieve.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
kapilrakh
#5 Posted : Friday, December 18, 2009 9:09:25 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
RJK,

I am using Datalink. I will try using the data on the worksheet. This might be better solution .I will have to see how the VBA behind it is gonna work.
I guess I've seen you using datasets in one of previous forums. Thats certainly helpful in processbook.
Michael
#6 Posted : Friday, December 18, 2009 9:11:21 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Kapil,

I really enjoy talking to you. (I again replied to your last topic)

Back to your problem:
To be honest, I feel very uncomfortable to add two tags to the PIServer to display something to the user. But this is my personal opinion.

To display such temporary lines you can use datasets if you are running processbook. ( I do not have any experience with PI excel trending)

But what about cursors? This are really vertical lines in a trend. Did you tried? If yes, which problem I have ignored?


It's friday night in good old europe, so don't worry if there is no reply this weekend anymore


Michael

But you can hire me! even in US!

Michael







kapilrakh
#7 Posted : Friday, December 18, 2009 9:14:02 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
The user wants to separate a part of trend by those two vertical lines. I don't have the screen shot right now. I can provide it to you sooner. It has only one line that is called baseline to a sinusoid instead of two lines as I said earlier. ( Its in Processbook )

kapilrakh
#8 Posted : Friday, December 18, 2009 9:19:14 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Here in US its almost the end of the working day. I wanted to get a solution before I go home so I can enjoy the weekend.

Back to the question. Yes you can add the cursors. But wouldn't it look better to add lines.
Michael
#9 Posted : Friday, December 18, 2009 9:44:52 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
So, if cursors can solve your problem, why wasting time? Using a trace to display such a vertical line has also some unaesthetic side effects.

I feel there is no easier solution. If you find one, please let us know.


Thanks again for this question (even if you did not get the solution you expected). I never played with this library, now I did.

Michael
kapilrakh
#10 Posted : Monday, December 21, 2009 8:48:57 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Ok Mike. Even if you add the cursor. Can you remove the values , that it shows , of the points it intersects with the traces ?
Michael
#11 Posted : Saturday, December 26, 2009 5:13:51 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Kapil,

I've never manipulated cursors using VBA, but I will play a little bit to see what is supported. I will keep you informed what I discovered.

UPDATE: I am sorry, but I found no way to modify to look of a cursor using the PBSymLib. Nevertheless, I feel such features should be added to a cursor class. You should ask OSI to enhance this.

Michael
kapilrakh
#12 Posted : Thursday, January 07, 2010 9:38:56 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Can someone provide a simple example of adding the trend from two sources at the same time.

1) Data on the spreadsheet
2) Data coming from PI.

Are there any functions in VBA that let you use the data on the spreadsheet to create a trace?
Please reply.

Thanks
Michael
#13 Posted : Thursday, January 07, 2010 11:43:18 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Hi Kapil,

I played a little bit.

Look for such an object

sheet1.PITrend1_Sheet1

and explore.

To add a new trace you have to:
create a dataobject, add this to DataSetEnvironment, add the trace.

Sorry, no source code available (solution is more theoretical).

For trending I prefer ProcBook. :-)


Michael


UPDATE: For those who are not used to PITREND in Excel

1) for the non PI Data, put the timestamps and the values in separate columns/rows
2) run the PI trend wizard
3) select "data on worksheet", select the cell range, add to the trace list
4) select "Data from PI", add the tag, add it to the trace list
5) press finish, et voila your trend is there.

Be careful using the define trend time option, it is for PIData only.


kapilrakh
#14 Posted : Monday, January 11, 2010 3:47:48 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Thanks for the hint Mike , but I couldn't write such a code. Its little bit confusing as to how to define the DataSourceEnvironment and TraceSet.
You have to add the trace using

Code:

expression.Add DataSourceEnvironment,TraceSet


where expression is a trace.

In this case I would add the data on the sheet first and then add the trace from PI.

May be RJK can help.
Michael
#15 Posted : Monday, January 11, 2010 6:24:18 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Hi Kapil,

you're right, it is confusing.

Try this two functions

Me.ExcelTrendWizard1_Sheet1.ExcelAddQuerySpecs "$A$1:$C$10", True

and

Me.ExcelTrendWizard1_Sheet1.PIAddQuerySpec server, tag

Good luck

Michael
RJK Solutions
#16 Posted : Monday, January 11, 2010 9:40:45 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Kapil, If you want to do this from code then you want to use the PIDAXL.PIExcelData object.

Example (modify to your needs):

Code:

Sub AddTrend(left As Integer, top As Integer, width As Integer, height As Integer)
Me.OLEObjects.Add ClassType:="PITrend.PITrend.1", Link:=False, DisplayAsIcon:=False, left:=left, top:=top, width:=width, height:=height
End Sub


Sub AddPIArichveDataCtrl(left As Integer, top As Integer, width As Integer, height As Integer)
Me.OLEObjects.Add ClassType:="PIDAXL.PIExcelData", Link:=False, DisplayAsIcon:=False, left:=left, top:=top, width:=width, height:=height
End Sub


Private Sub AddTrendToSheet()

Call AddTrend(15, 20, 300, 300)
Me.OLEObjects(Me.OLEObjects.Count).Name = "PITrend1"

Call AddPIArichveDataCtrl(15, 15, 136, 50)

Me.OLEObjects(Me.OLEObjects.Count).Name = "PIADCtrlExcel"

Dim obj As OLEObject
Dim objTrend As OLEObject

Set obj = Me.OLEObjects("PIADCtrlExcel")
obj.Object.AddQuerySpecs "$A$1:$C$3", True

Set objTrend = Me.OLEObjects("PITrend1")
objTrend.Object.DataSourceEnvironments.Add "PIADCtrlExcel"

End Sub
Principal Consultant
Real-Time Data Management @ Wipro Technologies
ThePIman
#17 Posted : Tuesday, January 12, 2010 1:25:44 PM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2009
Posts: 35
Location: UK
Michael wrote:
You should ask OSI to enhance this.

Sorry, just had to add a lol to that

.
kapilrakh
#18 Posted : Thursday, January 14, 2010 6:41:47 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
@RJK

The trend is already there on the excel sheet. It would be great to manipulate an existing trend instead of inserting a new one everytime.

When you add a trend and a trace , we basically have 4 objects on the sheet. Those are,

ExcelTrendWizard1_Sheet1
PITrend1_Sheet1
PIExcelData1_Sheet1
PIArchiveData1_Sheet1


Using these existing objects solving this problem would be an ideal solution.

@Mike,

Thanks for the post. Your approach is right. But not getting anywhere closer Brick wall
Michael
#19 Posted : Thursday, January 14, 2010 7:43:56 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Hi Kapil

if you want to manipulate the trend itself use the PITrend1_Sheet1 object

I add a small example

Dim trc As TrendConfig
Set trc = Me.PITrend1_Sheet1.GetConfiguration
trc.Title.Text = "Hi Kapil"
Me.PITrend1_Sheet1.SetConfiguration trc

kapilrakh
#20 Posted : Thursday, January 14, 2010 8:00:41 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
ya Mike....I have done that...but that don't solve the problem..
Trendconfig can only manipulate the look of the trend. It doesn't manipulate the cursor in any form.
Users browsing this topic
Guest
2 Pages 12>
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.